About the number of words to reply

Go down

In progress About the number of words to reply

Post by Winging Sun Jul 18, 2021 6:33 am

Forum version : #phpBB2
Position : Founder
Concerned browser(s) : Google Chrome
Who the problem concerns : Yourself
Forum link : https://ekin-ek.666forum.com/

- - - - - - - -
I hope that the reply can be at least 10 words before posting.
But I don’t know why.
If you are using Chinese Pinyin, you can successfully pronounce it without 10 words.
This is what confuses me.

JS(In all the pages):

Code:
$(function(){$(function(){
     
      var MinNumberOfWords = 10;
      var LetterCountPerWord = 3;
      var ico_compl = "https://i.servimg.com/u/f73/18/10/89/49/ok-gre10.png";
      var ico_incompl = "https://i.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'> 回 帖 最 少 字 数: " + 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 = /[^\x00-\xff]/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");
            }
          });
      }
    })});

Thank you very much.
Winging
Winging
Forumember

Posts : 44
Reputation : 2
Language : chinese

View user profile https://ekin-ek.666forum.com/

Back to top Go down

In progress Re: About the number of words to reply

Post by skouliki Sun Jul 18, 2021 7:20 am

hello

try this instead JS(In the topics)

Code:

$(function() {
var x=document.forms['post'];
$(x.post).click(function(e) {
 if (x.message.value.length < 10) {
  e.preventDefault();
  alert('Your post must contain at least 10 character');
 }
});
});
skouliki
skouliki
Manager
Manager

Female Posts : 11171
Reputation : 1399
Language : English,Greek
Location : Greece

View user profile http://iconskouliki.forumgreek.com

Back to top Go down

In progress Re: About the number of words to reply

Post by Winging Sun Jul 18, 2021 7:26 am

hello,@skouliki

This new code has no effect.
And even the part of [counting total words] disappeared. About the number of words to reply 1f602
Winging
Winging
Forumember

Posts : 44
Reputation : 2
Language : chinese

View user profile https://ekin-ek.666forum.com/

Back to top Go down

In progress Re: About the number of words to reply

Post by skouliki Sun Jul 18, 2021 3:05 pm

i tested the code and it is working

About the number of words to reply Scree697

see if your other javascript is causing you conflicts
skouliki
skouliki
Manager
Manager

Female Posts : 11171
Reputation : 1399
Language : English,Greek
Location : Greece

View user profile http://iconskouliki.forumgreek.com

Back to top Go down

In progress Re: About the number of words to reply

Post by Winging Mon Jul 19, 2021 3:06 am

Thanks,@skouliki

I found that it was changed to(In all the pages),and a warning will appear from above
After I tested it, there were more than the number of words (I set 10 words), but I could not successfully post a reply.

About the number of words to reply O11


And the part of [Count the total number of words],how can I add it to the code?

Original code diagram:
About the number of words to reply Yz10

PS:I'm not sure, how to see if there is a conflicting part in JS
Winging
Winging
Forumember

Posts : 44
Reputation : 2
Language : chinese

View user profile https://ekin-ek.666forum.com/

Back to top Go down

In progress Re: About the number of words to reply

Post by skouliki Mon Jul 19, 2021 2:23 pm

yes you are right it is an old code

so lets go to the first code everything it is working unless you write Chinese ?
skouliki
skouliki
Manager
Manager

Female Posts : 11171
Reputation : 1399
Language : English,Greek
Location : Greece

View user profile http://iconskouliki.forumgreek.com

Back to top Go down

In progress Re: About the number of words to reply

Post by Winging Tue Jul 20, 2021 4:30 pm

yes,@skouliki

I found that when using Chinese Pinyin (not Taiwanese Pinyin), there is no way to successfully limit the [minimum number of characters] and publish directly.
This is not what i hope.

And I am not sure how to fix my JS.

Thanks your help!
Winging
Winging
Forumember

Posts : 44
Reputation : 2
Language : chinese

View user profile https://ekin-ek.666forum.com/

Back to top Go down

In progress Re: About the number of words to reply

Post by Winging Yesterday at 5:28 am

@skouliki wrote:yes you are right it is an old code

so lets go to the first code everything it is working unless you write Chinese ?
Thanks @skouliki

I found that the part I need to change is,
In the mobile device, the [I want limit] will not be reached, but the computer version can successfully limit
So it is the mobile device code issue?
Winging
Winging
Forumember

Posts : 44
Reputation : 2
Language : chinese

View user profile https://ekin-ek.666forum.com/

Back to top Go down

In progress Re: About the number of words to reply

Post by SLGray Yesterday at 7:10 am

That code was created before the mobile version was released.


About the number of words to reply 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 : 49285
Reputation : 3432
Language : English
Location : United States

View user profile https://forumsclub.com/gc/128-link-directory/

Back to top Go down

In progress Re: About the number of words to reply

Post by skouliki Yesterday at 8:00 am

iam thinking that the issue is not the version but the language
i can not help any further iam sorry
maybe you can contact the creator of that code
skouliki
skouliki
Manager
Manager

Female Posts : 11171
Reputation : 1399
Language : English,Greek
Location : Greece

View user profile http://iconskouliki.forumgreek.com

Back to top Go down

Back to top


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