Search
 
 

Display results as :
 

 


Rechercher Advanced Search
Latest topics
» New button
Wed Jan 06, 2016 9:14 am by Admin

» Scrolling Widgets
Sat Oct 24, 2015 3:13 am by Admin

» Questions on forumotion
Tue Aug 25, 2015 12:55 am by Admin

» Adding affiliates
Sat Aug 22, 2015 6:57 am by Admin

» hash tagging
Sat Aug 22, 2015 6:43 am by Admin

» Alert system
Sat Aug 22, 2015 6:41 am by Admin

» Facebook for kumari
Fri Aug 21, 2015 1:10 am by Admin

» Countdown for the site
Fri Aug 21, 2015 12:54 am by Admin

» background on top of background
Fri Aug 21, 2015 12:47 am by Admin

» transparent background
Mon Aug 17, 2015 12:34 pm by Admin

Click below for our World Map
 photo Kumari draft4_zpsyulb95s8.png
Switch Accounts


Control Panel

Code: Select Content

Your profile

Information

Preference

Signature

Avatar

Social

Friends and Foes

Memberlist

Groups

Private messages

Inbox

PM sent

Other

Topic is being watched


Share | 
 

 Word Counter on qUICK REPLY

View previous topic View next topic Go down 
AuthorMessage
Admin
Admin


Posts : 71
Join date : 2014-04-29

PostSubject: Word Counter on qUICK REPLY   Fri Jun 20, 2014 3:29 am

Code:
   $(function(){$(function(){

       var MinNumberOfWords = 5;
       var LetterCountPerWord = 3;
       var ico_compl = "http://i73.servimg.com/u/f73/18/10/89/49/ok-gre10.png";
       var ico_incompl = "http://i73.servimg.com/u/f73/18/10/89/49/exclam10.png";   
   
     if($("#text_editor_textarea").length != 0){
          $("input[type='submit'][name='post']").attr("disabled", true).css("opacity", "0.5");      
          $(".sceditor-container").after("<br/><div id='div_minchars' align='center'><div id='div_minchars_header'> Minimum words to send a message: " + MinNumberOfWords + " (at least " + LetterCountPerWord + " letters)</div><div id='div_minchars_info'></div></div>");
          
          var sceditor = $("#text_editor_textarea").sceditor("instance");                  
          var str = sceditor.val();
          var regex = new RegExp('\\w{' + LetterCountPerWord + ',}\\b', 'g');
          var str_arr = str.match(regex);
          var str_len = str_arr == null ? 0 : str_arr.length;
          
          if(str_len >= MinNumberOfWords) $("input[type='submit'][name='post']").attr("disabled", false).css("opacity", "1");
          
          sceditor.keyUp(function(e) {
             str = sceditor.val();
             str_arr = str.match(regex);
             str_len = str_arr == null ? 0 : str_arr.length;
             if(str_len >= MinNumberOfWords) {
                $("#div_minchars_info").html("You've written <span style='color:green'>" + str_len + "</span> word(s). You can now send the message <img src='" + ico_compl  + "' />");   
            $("input[type='submit'][name='post']").attr("disabled", false).css("opacity", "1");
             }else{
                $("#div_minchars_info").html("You've written <span style='color:red'>" + str_len + "</span> word(s). You need " + (MinNumberOfWords - str_len) + " word(s) to send this message <img src='" + ico_incompl  + "' />");
                $("input[type='submit'][name='post']").attr("disabled", true).css("opacity", "0.5");
             }
          });
       }
    })});

Administration Panel > Modules > HTML & Javascript > Javascript codes management
Back to top Go down
View user profile http://tester.omgforum.net
 
Word Counter on qUICK REPLY
View previous topic View next topic Back to top 
Page 1 of 1
 Similar topics
-
» Quick reply colour tweak??
» Trading Richter Thumper for Shield/Counter
» Counter/Token contest.
» Counter -Strike Global Offensive
» Counter Strike #1 Budva LAN (DMG GAMERS)

Permissions in this forum:You cannot reply to topics in this forum
 :: Your first category ::  Rose :: North :: Codes-
Jump to: