Sinisterly
Post Checker Script - Printable Version

+- Sinisterly (https://sinister.ly)
+-- Forum: General (https://sinister.ly/Forum-General)
+--- Forum: The Lounge (https://sinister.ly/Forum-The-Lounge)
+--- Thread: Post Checker Script (/Thread-Post-Checker-Script)



Post Checker Script - Auth - 10-15-2013

Hey,

Hey, this checks if your post is long enough.

It will tell you if the post has enough characters.

You will need greasemonkey for firefox, or tampermonkey for chrome.

Code;

Quote:// ==UserScript==
// @name ForumFreebies Post Checker
// @namespace ForumFreebies Post Checker
// @description Checks if post is ok, made by Anonymous.
// @include http://forumfreebies.net/*
// @include http://www.forumfreebies.net/*
// @version 2.0
// ==/UserScript==


regex = /here.*?>/;
revised = "here.<br /> <div id='letscount'>0<br /><span style='color:red'>Too Low!</span></div>";
document.getElementById('quickreply_e').innerHTML= document.getElementById('quickreply_e').innerHTML.replace(regex,revised);
addButtonListener();

function addButtonListener(){
var texts = document.getElementById("message");
texts.addEventListener('keyup',doCountNow,true);
texts.addEventListener('keydown',doCountNow,true);
}

function doCountNow(){

var field = parseInt(document.getElementById('message').value.length);
var minlimit = 10;
var maxlimit = 16777215;
// if (field > maxlimit) {
// document.getElementById('message').value = document.getElementById('message').value.substring(0, maxlimit);
// } else {
// document.getElementById('letscount').innerHTML = maxlimit - document.getElementById('message').value.length;
// }
if (field < minlimit) {
document.getElementById('letscount').innerHTML = field+'<br /><span style="color:red">Not long enough.</span>'
}
else if (field > maxlimit) {
document.getElementById('letscount').innerHTML = field+'<br /><span style="color:red">Too long.</span>'
}
else {
document.getElementById('letscount').innerHTML = field+'<br /><span style="color:green">Yes, you can post this.</span>'
}

}

Screenshots;


[Image: 3r4a.png]
[Image: I67RpWB.png]


RE: Forum Freebies | Post checker script. - Banadmin - 10-15-2013

Nice userscript, Anonymous. Cheers!

I've moved this to The Lounge as it suits this section better. Smile


RE: Forum Freebies | Post checker script. - Auth - 10-15-2013

(10-15-2013, 02:44 PM)Sinister Wrote: Nice userscript, Anonymous. Cheers!

I've moved this to The Lounge as it suits this section better. Smile

Thanks, hope you like it!


RE: Post Checker Script - Banadmin - 10-16-2013

Just tested this. Works nicely. Thanks again, Anonymous. Appreciated.


RE: Post Checker Script - Auth - 10-16-2013

Glad you like it Sinister!


RE: Post Checker Script - Rose - 10-17-2013

Thanks, just added it and it works great!