|
Post by Wormopolis on Mar 17, 2009 18:14:08 GMT -8
Browser Tested: IE and FF placement: global footer Puts a "flag" button above each post for mods/admins that have modifypost access. flags the post to be unreadable by anyone without staff access, and creates a PM to the admins that a post has been flagged for review. creates a link in the PM to the offensive post. <script type="text/javascript"> <!-- // Post Flagging v1.5 // by Wormopolis - wormocodes.proboards.com // keep header intact - do not repost
// -------- USER VARIABLES var flagBtnImg="http://i197.photobucket.com/albums/aa250/WORMOPOLIS/flagbtn.gif"; var unflagBtnImg="http://i197.photobucket.com/albums/aa250/WORMOPOLIS/unflagbtn.gif";
var hideModifyBtn = true; // set true if you want to hide the modify btn if not flagged var hideDeleteBtn = true; // set true if you want to hide the delete btn if not flagged var hideModifyBtnUser = true; //set true to keep users from modifying flagged posts
var reportTo = "admin, wormopolis"; // list of ppl to report flagged post to var reportSub = "THIS POST HAS BEEN FLAGGED"; var reportBody = "Please review this post for violations:";
// -------- END USER VARIABLES
// No need to edit below unless for support
staffCheck=false; for (igs=document.images, g=0; g<igs.length; g++) { if (igs[g].parentNode.nodeName=="A" && igs[g].parentNode.href.match(/index.cgi\?action=admin/i)) { staffCheck=true; break; } }
// modify post with flag if (location.href.match(/&flaggum=(\d+?)/)) { pagenum=RegExp.$1; document.postForm.parentNode.style.display="none"; document.postForm.parentNode.nextSibling.nextSibling.nextSibling.style.display="none"; document.postForm.message.value="[§flag§]\n"+document.postForm.message.value; postthread=location.href.split('?')[1].split('&flaggum')[0].replace(/&post=/,(pagenum>0 ? '&page='+pagenum : '' )+'#');
postthread=postthread.replace(/=/g,'*'); document.cookie="flagpost="+postthread; document.postForm.submit(); }
// clear flag if (location.href.match(/&unflaggum=(\d+?)/)) { document.postForm.parentNode.style.display="none"; document.postForm.parentNode.nextSibling.nextSibling.nextSibling.style.display="none"; document.postForm.message.value=document.postForm.message.value.replace(/\[§flag§\]/,''); document.postForm.submit(); }
// setup PM to admins
function stripThings(text) { return escape(text).replace(/\s/g,'%20'); }
if (location.href.match(/display/) && document.cookie.match(/flagpost=(.*?)($|;)/) ) { postthread=RegExp.$1; postthread=postthread.replace(/\*/g,'=').replace(/modifypost/,'display'); nwtm=new Date(); document.cookie="flagpost=; expires="+nwtm; urltemp=location.href.split('?')[0]; reportBody+=escape("\n\n")+urltemp+'?'+stripThings(postthread); window.location = "/index.cgi?action=pmsend&to="+stripThings(reportTo)+"&subject="+stripThings(reportSub)+"&message="+reportBody; }
// check for flags
for (tds=document.getElementsByTagName('td'), i=0; i<tds.length; i++) { if (tds[i].colSpan==3 && tds[i].vAlign=="top" && tds[i].firstChild && tds[i].firstChild.nodeName.match(/hr/i) && tds[i].firstChild.className.match(/hr/i)) { msg=tds[i].getElementsByTagName('font')[0]; btnbar=tds[i].parentNode.previousSibling; auth=tds[i].parentNode.parentNode.parentNode.parentNode.previousSibling; auth=(auth.childNodes[(document.all?2:3)].nodeName.match(/^b$/i) ? auth.childNodes[(document.all ? 2 : 3)].firstChild.href.split('user=')[1] : auth.childNodes[2].nodeValue ); if (msg.innerHTML.match(/\[§flag§\]/)) { nwmsg=(staffCheck ? msg.innerHTML.replace(/\[§flag§\]/g,'') : ""); msg.innerHTML="<div align='center' style='background-color:FF0000'><font size=4 color='FFFFFF'>THIS POST HAS BEEN FLAGGED FOR THE ADMINS</font></div><br><br>"+nwmsg; tds[i].parentNode.nextSibling.style.display="none"; if (btnbar.innerHTML.match(/quote=/)) { btnbar.cells[2].getElementsByTagName('a')[0].style.display="none"; } for(modbtns=btnbar.cells[2].firstChild.getElementsByTagName('a'), aa=0;aa<modbtns.length; aa++) { if (modbtns[aa].href.match(/modifypost/)) { if (hideModifyBtnUser && auth==pb_username) modbtns[aa].style.display="none"; flagbtn=document.createElement('a'); flagbtn.href=modbtns[aa].href+"&unflaggum=1"; flagimg=flagbtn.appendChild(document.createElement('img')); flagimg.src=unflagBtnImg; flagimg.border=0; if (staffCheck) btnbar.cells[2].firstChild.appendChild(flagbtn); break; } }
} else { if (btnbar.innerHTML.match(/modifypost/)) { flagbtn=document.createElement('a'); for(modbtns=btnbar.cells[2].firstChild.getElementsByTagName('a'), aa=0;aa<modbtns.length; aa++) { if (modbtns[aa].href.match(/modifypost/)) { if (hideModifyBtn && auth!=pb_username) modbtns[aa].style.display="none"; pagekeep=tds[i].parentNode.nextSibling.firstChild.firstChild; pagekeep=pagekeep.getElementsByTagName('td')[1].getElementsByTagName('a')[0]; pagekeep=(pagekeep.href.match(/page=/) ? pagekeep.href.split('page=')[1].split('#')[0] : 0); flagbtn.href=modbtns[aa].href+"&flaggum="+pagekeep; } if (modbtns[aa].href.match(/deletepost/)) { if (hideDeleteBtn && auth!=pb_username) modbtns[aa].style.display="none"; } } flagimg=flagbtn.appendChild(document.createElement('img')); flagimg.src=flagBtnImg; flagimg.border=0; if (auth!=pb_username) btnbar.cells[2].firstChild.appendChild(flagbtn);
} } } else { if (tds[i].width=="100%" && tds[i].className.match(/windowbg/i) && tds[i].firstChild && tds[i].firstChild.nodeName.match(/font/i) && tds[i].firstChild.innerHTML.match(/\[§flag§\]/) && !tds[i].firstChild.innerHTML.match(/<textarea/i)) { msg=tds[i].firstChild; nwmsg=(staffCheck ? msg.innerHTML.replace(/\[§flag§\]/,'') : ""); msg.innerHTML="<div align='center' style='background-color:FF0000'><font size=4 color='FFFFFF'>THIS POST HAS BEEN FLAGGED FOR THE ADMINS</font></div><br><br>"+nwmsg;
} } } // --> </script>
Preview: What a user with an admin button would see: there are "flag" and "unflag" buttons at the top right of the posts. What user "test" would see: Mods with ability to modify posts, but do not have admin buttons would see the flag button, but posts would look like what user "test" would see.
|
|
|
Post by Wormopolis on Mar 22, 2009 21:21:37 GMT -8
updated with an "unflag" button and variable to hide delete button from flagged posts (except by author).
|
|
|
Post by Wormopolis on Apr 15, 2009 22:09:56 GMT -8
updated code to work with view recent replies.
|
|
|
Post by Dragon on Apr 10, 2011 10:26:20 GMT -8
So Worm this code could work so any old posts could be flagged too? Like we just now add it, and a mod sees a reason to flag a post.... Theyd be able to do that? And just so were clear, Im asking whether the code only works within the first couple days of a new post or if it could be used to flag a post at any time.
|
|
|
Post by Wormopolis on Apr 10, 2011 13:27:13 GMT -8
works on any post any time.
|
|
|
Post by Dragon on Apr 10, 2011 16:25:27 GMT -8
Cool thatll be good for me then
|
|
|
Post by Wormopolis on Apr 10, 2011 17:40:11 GMT -8
that was one of those codes that was rendered half-useless when PB added the report to mod feature.
|
|
|
Post by Dragon on Apr 16, 2011 14:02:45 GMT -8
Hmm well there seems to be a measure of error with it Worm. Apparently when I have it up, it makes it impossible for me to directly modify a post. It replaces the line where that is with flag and quote...... which does me little good since I need to directly modify it soemtimes
|
|
|
Post by Wormopolis on Apr 16, 2011 14:31:45 GMT -8
var hideModifyBtn = true;
what is that set to?
|
|
|
Post by Dragon on Apr 17, 2011 18:17:13 GMT -8
True I believe.
|
|
|
Post by Wormopolis on Apr 17, 2011 20:45:10 GMT -8
what hapens if you change it to false?
|
|