How to make word counter to work for just not in all categories.
3 posters
Page 1 of 1
How to make word counter to work for just not in all categories.
Hey!
So I need to help on the problem what is stated in the title.
I have the code but I don't want it to be everywhere, just few of them i wanna take out.
Is there any way I can do it?
http://themagicwithin.forumotion.com/ - (I wanna take Welcome Center and Character Creation out, there we don't need it)
EDIT: Okay I know now you need to add this:
if ($('a.nav[href^="/c3-"]').length == 0) return;
But It doesn't seem to work for me for some reason.
So I need to help on the problem what is stated in the title.
I have the code but I don't want it to be everywhere, just few of them i wanna take out.
Is there any way I can do it?
http://themagicwithin.forumotion.com/ - (I wanna take Welcome Center and Character Creation out, there we don't need it)
EDIT: Okay I know now you need to add this:
if ($('a.nav[href^="/c3-"]').length == 0) return;
But It doesn't seem to work for me for some reason.
Re: How to make word counter to work for just not in all categories.
You're talking about this character counter?
https://help.forumotion.com/t141556-character-counter
I'm kinda confused on what you actually want
https://help.forumotion.com/t141556-character-counter
I'm kinda confused on what you actually want
Re: How to make word counter to work for just not in all categories.
https://help.forumotion.com/t131191-add-a-word-counter-to-the-editor - i was talking about this.
Just i wonder how to make it work only some categories. I wound somewhere the code what you need add but it didn't seem to work there for me.
Just i wonder how to make it work only some categories. I wound somewhere the code what you need add but it didn't seem to work there for me.
Re: How to make word counter to work for just not in all categories.
Omg @KrissuKissu I've been wanting to do this for a while and you just gave me inspiration. It doesn't matter what version you're running, this should work
Replace the counter code with this:
And if you look at line 3, the
is the forum id of the forum where you want the code to work.
Replace the counter code with this:
- Code:
$(function() {
var fmpath = url_newposts.split('where=').pop();
if ( fmpath == 'f1')
wordCounter();
});
function wordCounter(){
$(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 if you look at line 3, the
|
Re: How to make word counter to work for just not in all categories.
The topic was posted in the wrong section, so I have moved it to the correct section.
|
Lost Founder's Password |Forum's Utilities |Report a Forum |General Rules |FAQ |Tricks & Tips
You need one post to send a PM.
You need one post to send a PM.
When your topic has been solved, ensure you mark the topic solved.
Never post your email in public.
Re: How to make word counter to work for just not in all categories.
The point is I don't want it to be just in one forum. On this site: http://themagicwithin.forumotion.com/ - I want this code to work from Hogwarts category to Other Location of the World. (We don't need it for Character Creation category, Imprtant Information and OOC one)
Re: How to make word counter to work for just not in all categories.
Ohh @KrissuKissu so you don't want it to work for certain forums. In that case just change line 3 of my code up there to this:
If you have more than one forum you don't want it to appear in then use this:
and
are the forum ids where you don't want the counter to work.
- Code:
if ( fmpath != 'f1' )
If you have more than one forum you don't want it to appear in then use this:
- Code:
if ( fmpath != 'f1' || fmpath != 'f2' )
|
|
Similar topics
» about word counter
» Word counter for int language and in selected categories
» A word counter
» Help with word counter?
» Word Counter Box
» Word counter for int language and in selected categories
» A word counter
» Help with word counter?
» Word Counter Box
Page 1 of 1
Permissions in this forum:
You cannot reply to topics in this forum