Hello! Please notify me if such topic is already created! Thank you in advance
1. I would like to add a word or character counter to specific categories of my forum.
Is that possible? Also, the code I found here in the archive is:
(from: https://help.forumotion.com/t137033-about-word-counter?highlight=counter )
2. But, user, who required it, asked for only english characters to be counted. I would like to be able to count international letters as well.
3. Also, is there a big difference between word counter and character counter? Maybe one of them is easier/ works faster? Just speculating what could be better for my forum.
1. I would like to add a word or character counter to specific categories of my forum.
Is that possible? Also, the code I found here in the archive is:
(from: https://help.forumotion.com/t137033-about-word-counter?highlight=counter )
- 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");
str = sceditor.val().replace(/\[quote.*[^]+\[\/quote\]|\[\/?[a-z][a-z0-9]*[^\[\]]*\]|(:.*?:|\W)/ig, "");
var str_len = str.length;
if (str_len >= MinNumberOfChars) $("input[type='submit'][name='post']").attr("disabled", false).css("opacity", "1");
$('.sceditor-container iframe').contents().on('input', function() {
getLen()
});
$('.sceditor-container textarea').on('input', function() {
getLen()
});
sceditor.keyUp(function() {
getLen()
});
}
function getLen() {
str = sceditor.val().replace(/\[quote.*[^]+\[\/quote\]|\[\/?[a-z][a-z0-9]*[^\[\]]*\]|(:.*?:|\W)/ig, "");
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");
}
}
})
});
2. But, user, who required it, asked for only english characters to be counted. I would like to be able to count international letters as well.
3. Also, is there a big difference between word counter and character counter? Maybe one of them is easier/ works faster? Just speculating what could be better for my forum.
Last edited by Kami-sama on September 30th 2015, 4:34 pm; edited 1 time in total