Problem in Add a word counter to the editor Hitskin_logo Hitskin.com

This is a Hitskin.com skin preview
Install the skinReturn to the skin page

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.
3 posters

    Problem in Add a word counter to the editor

    Michael_vx
    Michael_vx
    Forumember


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

    Solved Problem in Add a word counter to the editor

    Post by Michael_vx Sat Mar 22, 2014 5: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 Sat Mar 22, 2014 6:54 pm; edited 1 time in total (Reason for editing : Problem solved)
    SLGray
    SLGray
    Administrator
    Administrator


    Male Posts : 51552
    Reputation : 3523
    Language : English
    Location : United States

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

    Post by SLGray Sat Mar 22, 2014 5: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.
    Ange Tuteur
    Ange Tuteur
    Forumaster


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

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

    Post by Ange Tuteur Sat Mar 22, 2014 5:35 am

    I'll have a look when I have free time. The problem may be with the regular expression.
    Michael_vx
    Michael_vx
    Forumember


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

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

    Post by Michael_vx Sat Mar 22, 2014 5: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 : 659
    Reputation : 29
    Language : Arabic and some English
    Location : Egypt

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

    Post by Michael_vx Sat Mar 22, 2014 4:56 pm

    is there any good news about the code ?
    Ange Tuteur
    Ange Tuteur
    Forumaster


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

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

    Post by Ange Tuteur Sat Mar 22, 2014 6: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.
    Michael_vx
    Michael_vx
    Forumember


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

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

    Post by Michael_vx Sat Mar 22, 2014 6:53 pm

    thanks so much its worked
    Problem solved
    thanks so much again
    Ange Tuteur
    Ange Tuteur
    Forumaster


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

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

    Post by Ange Tuteur Sat Mar 22, 2014 7:11 pm

    You're welcome :rose:

    Topic solved and archived