Ross
eCreations Staff
Posts: 1,768
|
Post by Ross on Feb 14, 2006 21:37:54 GMT
Global FooterThis code ensures all messages are a certain length before they are posted. It is useful in stopping people who give one word replies. Just edit the bold number with the minimum number of characters <script type="text/javascript"> <!-- /* minimum message length - ross support.proboards.com do not redistribute without permission */
// Minimum number of characters var MinLength = 30;
// no need to edit below function checkLen() { if(document.postForm.message.value.length > MinLength) { input.item(z-3).removeAttribute('disabled'); input.item(z-4).removeAttribute('disabled'); } else { input.item(z-3).setAttribute('disabled','true'); input.item(z-4).setAttribute('disabled','true'); } }
function quick_checkLen() { if(document.getElementsByName('message').item(0).value.length > MinLength) { input.item(z-1).removeAttribute('disabled'); } else { input.item(z-1).setAttribute('disabled','true'); } }
var input = document.getElementsByTagName('input'); var z = input.length;
if(document.postForm) { document.postForm.message.onkeyup = function() { checkLen(); } while(input[z-1].value != 'Reset') { z--; } checkLen(); }
var mes = document.getElementsByName('message'); else if(mes.item(0)){ mes.item(0).setAttribute('onkeyup', 'quick_checkLen()'); while(input[z-1].value != 'Post Reply') { z--; } quick_checkLen(); } //--> </script>
|
|
Richie
Veteran
^ Yes, That's me V_V
Posts: 624
|
Post by Richie on Feb 14, 2006 23:44:53 GMT
cool, but is there a way to make it so it will do that in all boards except for certain ones i can specify? reason is i have like a lot of boards (about 50) & would like it to work in all but a few specific ones & don't wanna have to put in the footer of each board i want it to work in.
also will this work in quick reply or can you make it to work in quick reply as well?
|
|
Ross
eCreations Staff
Posts: 1,768
|
Post by Ross on Feb 17, 2006 11:37:22 GMT
It works with Quick Reply <script type="text/javascript"> <!-- /* minimum message length - ross support.proboards.com do not redistribute without permission */
// Minimum number of characters var MinLength = 30;
// no need to edit below function checkLen() { if(document.postForm.message.value.length > MinLength) { input.item(z-3).removeAttribute('disabled'); input.item(z-4).removeAttribute('disabled'); } else { input.item(z-3).setAttribute('disabled','true'); input.item(z-4).setAttribute('disabled','true'); } }
function quick_checkLen() { if(document.getElementsByName('message').item(0).value.length > MinLength) { input.item(z-1).removeAttribute('disabled'); } else { input.item(z-1).setAttribute('disabled','true'); } }
var input = document.getElementsByTagName('input'); var z = input.length; if(!location.href.match(/board=(boardID1|boardID2)/)) { if(document.postForm) { document.postForm.message.onkeyup = function() { checkLen(); } while(input[z-1].value != 'Reset') { z--; } checkLen(); }
var mes = document.getElementsByName('message'); else if(mes.item(0)){ mes.item(0).setAttribute('onkeyup', 'quick_checkLen()'); while(input[z-1].value != 'Post Reply') { z--; } quick_checkLen(); } } //--> </script>Edit the bold with the board IDs of where it shouldn't work. Seperating each with a '|' line.
|
|