Post by Peter on Apr 29, 2006 13:26:34 GMT
This script will prevent people from double posting by disabling everything on the reply page. You have the option to allow certain members to double post, just include them into the array.
<script type="text/javascript">
<!--
/*
Prevent double posting - Global footers
Created by Peter
*/
// Change message here
var noDoubleMess = "You are not allowed to double post.";
// Array of usernames that can double post, ie...["admin", "peter"]
var canDouble = ["admin"];
function checkLast(curuser){
var iStaff = false;
for(c = 0; c < canDouble.length; c ++){
if(canDouble[c] == curuser){
iStaff = true;
break;
}
}
var re = new RegExp("user=" + curuser + "$");
var iTable = document.getElementsByTagName("table");
for(t = 0; t < iTable.length; t ++){
if(iTable.item(t).cellPadding == "4" && iTable.item(t).cellSpacing == "1" && iTable.item(t).innerHTML.match(/>Topic Summary<\//)){
var lastRow = iTable.item(t).rows.item(iTable.item(t).rows.length - 2).cells.item(0);
if(!iStaff && lastRow.getElementsByTagName("a").item(0).href.match(re)){
document.postForm.message.value = noDoubleMess;
for(e = 0; e < document.postForm.elements.length; e ++){
document.postForm.elements[e].disabled = true;
}
}
}
}
}
if(location.href.match(/=post/i) && document.postForm){
checkLast(document.cookie.match(/\buser=(\w+)/i)[1]);
}
//-->
</script>
Global footers
<script type="text/javascript">
<!--
/*
Prevent double posting - Global footers
Created by Peter
*/
// Change message here
var noDoubleMess = "You are not allowed to double post.";
// Array of usernames that can double post, ie...["admin", "peter"]
var canDouble = ["admin"];
function checkLast(curuser){
var iStaff = false;
for(c = 0; c < canDouble.length; c ++){
if(canDouble[c] == curuser){
iStaff = true;
break;
}
}
var re = new RegExp("user=" + curuser + "$");
var iTable = document.getElementsByTagName("table");
for(t = 0; t < iTable.length; t ++){
if(iTable.item(t).cellPadding == "4" && iTable.item(t).cellSpacing == "1" && iTable.item(t).innerHTML.match(/>Topic Summary<\//)){
var lastRow = iTable.item(t).rows.item(iTable.item(t).rows.length - 2).cells.item(0);
if(!iStaff && lastRow.getElementsByTagName("a").item(0).href.match(re)){
document.postForm.message.value = noDoubleMess;
for(e = 0; e < document.postForm.elements.length; e ++){
document.postForm.elements[e].disabled = true;
}
}
}
}
}
if(location.href.match(/=post/i) && document.postForm){
checkLast(document.cookie.match(/\buser=(\w+)/i)[1]);
}
//-->
</script>
Global footers