Post by Flawed_Perfectionist on Nov 25, 2007 14:00:39 GMT -8
Description: This code works perfectly fine when limiting the words per post, like it doesn't let a person make a post in a thread until they have entered 200 words or more, but it does the same thing for PMs also. PM a lot of the time dont consist of 200 words so it stops a person frm being able to send the message. On what part of the code do I need to ediit so that PM doesn't have a word count limit? Or is there a different code I can use that only limits the replies too threads?
Experienced By: Not sure
Code URL: support.proboards.com/index.cgi?board=codedatabase&action=display&n=1&thread=70705
Code:
Web Browser: Not sure
Forum URL: seventhheaven01.proboards55.com
Experienced By: Not sure
Code URL: support.proboards.com/index.cgi?board=codedatabase&action=display&n=1&thread=70705
Code:
<script type='text/javascript'>
<!--
/* Posting/PM Word Count - created by Eton Bones */
//set to minimum word count needed in order to make a post
//or set to 0 to disable word count enforcement.
var wordCountLimit=0;
if(document.postForm && document.postForm.message){
var __submitBtn,__wc,__msg
__msg=document.postForm.message;
__submitBtn=document.getElementsByTagName('input');
for(var count=0;count<__submitBtn.length;count++){
if(__submitBtn[count].accessKey && __submitBtn[count].accessKey=='s'){__submitBtn=__submitBtn[count];break;}
}
if(typeof(__submitBtn.length)=="undefined"){
__btnText=__submitBtn.value;
__wc=document.createElement('div'); __wc.id="wordcount";
__wc.appendChild(document.createTextNode('Word Count: '));
__wc.appendChild(document.createElement('span'));
__submitBtn.parentNode.appendChild(__wc);
count=__msg.value.match(/\b\w+\b/g);
count=(count)?count.length:0;
__wc.lastChild.innerHTML=count;
if(count<wordCountLimit){__submitBtn.disabled=true;}
if(document.addEventListener){
__msg.addEventListener("keyup",wordUp,false);
__msg.addEventListener("input",wordUp,false);
__msg.addEventListener("change",wordUp,false);
}else if(document.attachEvent){
__msg.attachEvent("onpropertychange",wordUp);
}else{
__msg.onkeyup=wordUp;
__msg.onmouseup=wordUp;
__msg.onchange=wordUp;
}
}
}
function wordUp(event){
if(this.document){var thiss=event.srcElement;}else{var thiss=this;}
var count=thiss.value.match(/\b\w+\b/g); count=(count)?count.length:0;
if(count>=wordCountLimit && wordCountLimit >0 && __submitBtn.disabled){
__submitBtn.disabled=false;
}
__wc.lastChild.innerHTML=count;
}
//-->
</script>
Web Browser: Not sure
Forum URL: seventhheaven01.proboards55.com