The forum of the forums
Would you like to react to this message? Create an account in a few clicks or log in to continue.

Problem in Add a word counter to the editor

3 posters

Go down

Solved Problem in Add a word counter to the editor

Post by Michael_vx March 22nd 2014, 6:20 am

the code in that page
https://help.forumotion.com/t131191-add-a-word-counter-to-the-editor#879368
is only working for English letters and dose not recognize the arabic letters can any one fix this for me
otherways the code wont work at my forum thanks


Last edited by Michael_vx on March 22nd 2014, 7:54 pm; edited 1 time in total (Reason for editing : Problem solved)
Michael_vx
Michael_vx
Forumember

Male Posts : 664
Reputation : 29
Language : Arabic and some English
Location : Egypt

Back to top Go down

Solved Re: Problem in Add a word counter to the editor

Post by SLGray March 22nd 2014, 6:31 am

Someone would need to translate the code into Arabic so it would recognize the Arabic letters.


Problem in Add a word counter to the editor Slgray10

When your topic has been solved, ensure you mark the topic solved.
Never post your email in public.
SLGray
SLGray
Administrator
Administrator

Male Posts : 51489
Reputation : 3519
Language : English
Location : United States

https://forumsclub.com/gc/128-link-directory/

Back to top Go down

Solved Re: Problem in Add a word counter to the editor

Post by Ange Tuteur March 22nd 2014, 6:35 am

I'll have a look when I have free time. The problem may be with the regular expression.
Ange Tuteur
Ange Tuteur
Forumaster

Male Posts : 13246
Reputation : 3000
Language : English & 日本語
Location : Pennsylvania

https://fmdesign.forumotion.com

Back to top Go down

Solved Re: Problem in Add a word counter to the editor

Post by Michael_vx March 22nd 2014, 6:45 am

Ange Tuteur wrote:I'll have a look when I have free time. The problem may be with the regular expression.
thats good news to i will be waiting for the fixed code that able to count Arabic letters
Michael_vx
Michael_vx
Forumember

Male Posts : 664
Reputation : 29
Language : Arabic and some English
Location : Egypt

Back to top Go down

Solved Re: Problem in Add a word counter to the editor

Post by Michael_vx March 22nd 2014, 5:56 pm

is there any good news about the code ?
Michael_vx
Michael_vx
Forumember

Male Posts : 664
Reputation : 29
Language : Arabic and some English
Location : Egypt

Back to top Go down

Solved Re: Problem in Add a word counter to the editor

Post by Ange Tuteur March 22nd 2014, 7:37 pm

I've converted it to a character counter, it is a bit difficult to count the Arabic words since they are not recognized as a word character.

Try this :
Code:
$(function(){$(function(){

           var MinNumberOfChars = 50;
           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 characters to send a message: " + MinNumberOfChars + " </div><div id='div_minchars_info'></div></div>");
              
              var sceditor = $("#text_editor_textarea").sceditor("instance");                  
              var str = sceditor.val();
              var str_len = str.length;
              
              if(str_len >= MinNumberOfChars) $("input[type='submit'][name='post']").attr("disabled", false).css("opacity", "1");
              
              sceditor.keyUp(function(e) {
                 str = sceditor.val();
                 str_len = str.length;
                 if(str_len >= MinNumberOfChars) {
                    $("#div_minchars_info").html("You've written <span style='color:green'>" + str_len + "</span> character(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> character(s). You need " + (MinNumberOfChars - str_len) + " character(s) to send this message <img src='" + ico_incompl  + "' />");
                    $("input[type='submit'][name='post']").attr("disabled", true).css("opacity", "0.5");
                 }
              });
           }
        })});

To change the minimum number of characters modify the value of MinNumberOfChars.
Ange Tuteur
Ange Tuteur
Forumaster

Male Posts : 13246
Reputation : 3000
Language : English & 日本語
Location : Pennsylvania

https://fmdesign.forumotion.com

Back to top Go down

Solved Re: Problem in Add a word counter to the editor

Post by Michael_vx March 22nd 2014, 7:53 pm

thanks so much its worked
Problem solved
thanks so much again
Michael_vx
Michael_vx
Forumember

Male Posts : 664
Reputation : 29
Language : Arabic and some English
Location : Egypt

Back to top Go down

Solved Re: Problem in Add a word counter to the editor

Post by Ange Tuteur March 22nd 2014, 8:11 pm

You're welcome :rose:

Topic solved and archived
Ange Tuteur
Ange Tuteur
Forumaster

Male Posts : 13246
Reputation : 3000
Language : English & 日本語
Location : Pennsylvania

https://fmdesign.forumotion.com

Back to top Go down

Back to top

- Similar topics

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