Good art is a taste, good design is an opinion.


Come as guest, stay as family.
Board Index

Come as guest, stay as family.


You are not connected. Please login or register

Foto

[Solved] message counter



View previous topic View next topic Go down Message [Page 1 of 1]

1
Offline

  Zildjian

Zildjian
Punbb Junior
Punbb Junior

  • Description:

hi! i just want to ask for the codes for message counter just what like in this image [Solved] message counter Sss10




  • Information:

Forum:http://merchantmu.forumtl.comVersion:PUNBB
Type:Request a codeTags:message,counter

Powered by PunBB
Currently 0 users have thanked Zildjian for this post:

2
Offline

  Van-Helsing

Van-Helsing
★Moderator★
★Moderator★
Hello,
Try this javascript:
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");
                }
            });
          }
      })});

and check it in the topics

Powered by PunBB
Currently 0 users have thanked Van-Helsing for this post:

3
Offline

  Zildjian

Zildjian
Punbb Junior
Punbb Junior
thank you bro.

solved.

Powered by PunBB
Currently 0 users have thanked Zildjian for this post:

4
Offline

  Virus

Virus
★Moderator★
★Moderator★
[sucesso="Marked as Solved"]The question(s) in this topic have been answered and the owner has been able to solve the problem. Because of this, the topic has been marked as Solved.

If you have further questions, please open a new topic.[/sucesso]

Powered by PunBB
Currently 0 users have thanked Virus for this post:

5
Offline

  Sponsored content



Powered by PunBB
Currently 0 users have thanked Sponsored content for this post:

View previous topic View next topic Back to top Message [Page 1 of 1]


Topic URL's

URL
BBcode
HTML

Permissions in this forum:
You cannot reply to topics in this forum