|
Post by Wormopolis on Jun 11, 2012 16:13:05 GMT -8
Browser tested: IE, FF, Chrome placement: global footer
This code allows you to mark certain accounts as being "flagged" from the modifyprofile. on certain users will see the flag, and upon clicking the flag, it takes you to the profile and alerts the reason why it was flagged.
<script type="text/javascript"> <!-- // Flagged Accounts v1.01 // By Wormopolis - [url]www.wormocodes.com[/url] // Keep header intact - do not repost // request by kylesw555
// staff member must have access to custom title and account notes in order to flag an account.
var flagIcon="http://i197.photobucket.com/albums/aa250/WORMOPOLIS/flagged.gif"; var mandatoryReason=true; //true if reason must be present to flag account var usersWhoSeeFlags="admin|user2|user3"; //seperate by |
if (pb_action=='modifyprofile' && document.modifyForm.customtitle && document.modifyForm.notes) { var ctrow=document.modifyForm.customtitle.parentNode.parentNode.parentNode; var flagrow=ctrow.cloneNode(true); flagrow.firstChild.firstChild.innerHTML='Flag Account:'; flagrow.firstChild.nextSibling.firstChild.innerHTML= '<select name="flaggdrop"><option>no</option><option>yes</option></select>'; flagrow.firstChild.nextSibling.nextSibling.firstChild.innerHTML='Flag this account (please put reason below)<br><textarea name="flaggreason" cols="40" rows="5">'; ctrow.parentNode.insertBefore(flagrow, ctrow.nextSibling); if (document.modifyForm.customtitle.value.match('[ß]')) { document.modifyForm.flaggdrop.selectedIndex=1; document.modifyForm.customtitle.value = document.modifyForm.customtitle.value.replace('[ß]',''); } if (document.modifyForm.notes.value.match(/\[flagreason\](.*?)\[\/flagreason\]/)) { document.modifyForm.flaggreason.value=RegExp.$1; document.modifyForm.notes.value = document.modifyForm.notes.value.replace(/\[flagreason\](.*?)\[\/flagreason\]/,''); }
if (document.modifyForm.addEventListener) { document.modifyForm.addEventListener('submit', function() {if (document.modifyForm.flaggdrop.value=='yes' && (!mandatoryReason || document.modifyForm.flaggreason.value!='')) { document.modifyForm.customtitle.value+='[ß]'; if (document.modifyForm.flaggreason.value!='') document.modifyForm.notes.value+='[flagreason]' + document.modifyForm.flaggreason.value + '[/flagreason]';}},true); } else { document.modifyForm.attachEvent('onsubmit', function() {if (document.modifyForm.flaggdrop.value=='yes' && (!mandatoryReason || document.modifyForm.flaggreason.value!='')) { document.modifyForm.customtitle.value+='[ß]'; if (document.modifyForm.flaggreason.value!='') document.modifyForm.notes.value+='[flagreason]' + document.modifyForm.flaggreason.value + '[/flagreason]';}}); } } if (pb_action.match(/display|viewprofile|recent|search2|pmview/)) { for (td=document.getElementsByTagName('td'), tt=0; tt<td.length; tt++) { if (td[tt].width=='20%' && td[tt].className.match(/windowbg/) && td[tt].vAlign=='top' && td[tt].innerHTML.match('[ß]')) { var dname=td[tt].getElementsByTagName('b')[0]; var nwlnk=document.createElement('a'); nwlnk.href=dname.firstChild.href+'&flagalert'; var nwflg=document.createElement('img'); nwflg.src=flagIcon; nwflg.border="0"; nwflg.title="This account has been flagged. click here to see why"; nwlnk.appendChild(nwflg); if (pb_username.match(new RegExp('^('+usersWhoSeeFlags+')$',''))) dname.appendChild(nwlnk); td[tt].innerHTML=td[tt].innerHTML.replace('[ß]',''); } } } if (pb_action=='viewprofile') { for (td=document.getElementsByTagName('td'), tt=0; tt<td.length; tt++) { if (td[tt].colSpan=='2' && td[tt].vAlign=='top' && td[tt].innerHTML.match(/Account Notes/)) { var notesCell=td[tt].parentNode.nextSibling.firstChild; if (notesCell.innerHTML.match(/\[flagreason\](.*?)\[\/flagreason\]/)) { var flagNote=RegExp.$1; notesCell.innerHTML=notesCell.innerHTML.replace(/\[flagreason\](.*?)\[\/flagreason\]/,''); var flagHeader=td[tt].parentNode.cloneNode(true); var flagNotesCell=notesCell.parentNode.cloneNode(true); flagHeader.firstChild.firstChild.firstChild.innerHTML="Account Flag Notes"; flagNotesCell.firstChild.firstChild.innerHTML=flagNote; td[tt].parentNode.parentNode.insertBefore(flagHeader, notesCell.parentNode.nextSibling); flagHeader.parentNode.insertBefore(flagNotesCell, flagHeader.nextSibling); if (location.href.match('&flagalert')) confirm("The account was flagged for:\n\n"+flagNote); } } } } // --> </script>
|
|