Post by Bradley on Aug 31, 2005 17:38:40 GMT -5
This code adds a report to admin link to the bottom right corner of every post under the IP image.
Board Footers
You'll notice this towards the top of the code:
var reportLink = "Report to Admin";
var reportSubject = "Reporting User: ";
var reportBody = "I am reporting the following user for actions in the following thread.";
var reportTo = "admin";
The text to appear in the lower right of the post.
The subject of the PM to which the user's name will be appended.
The default message to include in the PM.
The username of the person to recieve the PM. To have the pm sent to two users (let's say "admin and "gmod") you would do this:
var reportTo = "admin,gmod";
It's just like sending a PM to multiple users.
Edit on Sept. 8, 2005: Added note for sending to multiple users and fixed bug causing "undefined" when user groups have custom colors.
Edit on Jan. 28, 2006: Fixed due to new bug from PB code update.
Board Footers
<script type="text/javascript">
<!--
/*
Report To Admin v1.1
Copyright © 2005-2006 Bradley Nelson a.k.a. CCWorld
All Rights Reserved
Do not repost without permission.
For use on Proboards Boards only.
This Header must remain intact at all times.
*/
var reportLink = "Report to Admin";
var reportSubject = "Reporting User: ";
var reportBody = "I am reporting the following user for actions in the following thread.";
var reportTo = "admin";
var tds = document.getElementsByTagName("td");
var i; var recentPostId; var recentName; var recentPro; var pageLink; var cRptLink;
function URLencode(sStr) {
return escape(sStr).replace(/\+/g, '%2B').replace(/\"/g,'%22').replace(/\'/g, '%27');
}
if(location.href.match(/action=display/i)){
pageLink = location.href.split(/#/i)[0]
for(i=0; i<tds.length; i++){
if(tds.item(i).align == "right" && tds.item(i).firstChild.nodeName.match(/font/i)){
if(tds.item(i).lastChild.firstChild.nodeName.match(/img/i) && tds.item(i).lastChild.firstChild.alt.match(/IP:/i)){
tds.item(i).firstChild.replaceChild(document.createTextNode(" - "), tds.item(i).firstChild.lastChild);
cRptLink = document.createElement("a");
cRptLink.href = "/index.cgi?action=pmsend&to="+reportTo+"&subject="+URLencode(reportSubject+recentName)+"&message="+URLencode(reportBody+"\n\n[ur"+"l="+recentPro+"]"+recentName+"[/ur"+"l] for [u"+"rl="+pageLink+"#"+recentPostId+"] this thread[/u"+"rl].")
cRptLink.appendChild(document.createTextNode(reportLink));
tds.item(i).firstChild.appendChild(cRptLink);
tds.item(i).firstChild.appendChild(document.createTextNode(" "));
}
}
else if(tds.item(i).width == "20%" && tds.item(i).firstChild.nodeName.match(/a/i)){
if(tds.item(i).firstChild.name.match(/^\d+$/i)){
recentPostId = tds.item(i).firstChild.name;
if(tds.item(i).firstChild.nextSibling.firstChild.firstChild.nodeName.match(/font/i)){
recentName = tds.item(i).firstChild.nextSibling.firstChild.firstChild.firstChild.data;
} else {
recentName = tds.item(i).firstChild.nextSibling.firstChild.firstChild.data;
}
recentPro = tds.item(i).firstChild.nextSibling.firstChild.href;
}
}
}
}
// -->
</script>
You'll notice this towards the top of the code:
var reportLink = "Report to Admin";
var reportSubject = "Reporting User: ";
var reportBody = "I am reporting the following user for actions in the following thread.";
var reportTo = "admin";
The text to appear in the lower right of the post.
The subject of the PM to which the user's name will be appended.
The default message to include in the PM.
The username of the person to recieve the PM. To have the pm sent to two users (let's say "admin and "gmod") you would do this:
var reportTo = "admin,gmod";
It's just like sending a PM to multiple users.
Edit on Sept. 8, 2005: Added note for sending to multiple users and fixed bug causing "undefined" when user groups have custom colors.
Edit on Jan. 28, 2006: Fixed due to new bug from PB code update.