|
Post by Wormopolis on Dec 9, 2009 15:15:23 GMT -8
Browser Tested: IE and FF placement: Global footer, or board footer for tighter control
This code will let you control who can use which icons in the posting form, as well as changing the name displayed in the drop down.
additional variables included if you want topic icons shut off on certain boards for everyone except a list of users.
code:
<script type="text/javascript"> <!-- // topic icon manager v1.02 // by Wormopolis - www.wormocodes.com // keep header intact
/* This is the list of topic icon names: Standard Thumbs Up Thumbs Down Exclamation Point Question Mark Lamp Smiley Angry Cheesy Laugh Sad Wink */
var ControlArray = [ ['Thumbs Up','admin|danger|user3|user4','Done'], ['Thumbs Down','admin|danger|user3|user4','Denied'], ['Exclamation Point','admin|danger|user3|user4','In Progress'], ['Wink','ALL','Flirt'], ['Cheesy','admin|user2|user3'] ]; //[topic icon name from list, users allowed to use seperated by | (use ALL for everyone), optional new name]
// this is a list of boards: var specialBoards="codereq|graphreq|codeother"; // that only these users: var specialUsers="admin|user2|danger"; // can access the topic icons at all
if (document.postForm && document.postForm.icon) { for (a=0; a<document.postForm.icon.options.length; a++) { if (location.href.match(new RegExp('board=('+specialBoards+')','')) && !pb_username.match(new RegExp('('+specialUsers+')'))) document.postForm.icon.parentNode.parentNode.style.display='none'; for (b=0; b<ControlArray.length; b++ ) { if (document.postForm.icon.options[a].innerHTML.match(ControlArray[b][0])) { if (ControlArray[b][1]!='ALL' && !pb_username.match(new RegExp('('+ControlArray[b][1]+')',''))) { document.postForm.icon.remove(a); --a; break; } else { if (ControlArray[b][2]) { document.postForm.icon.options[a].innerHTML=ControlArray[b][2]; } } } } } }
// --> </script>
Preview: self-explanatory
|
|
|
Post by Wormopolis on Dec 8, 2011 17:46:01 GMT -8
version update 1.02: fixed a logic error
|
|