|
Post by Wormopolis on Apr 4, 2009 19:06:07 GMT -8
Browsers Tested: IE and FF placement: global footers (the higher the better)
allows any mod/admin with ability to edit custom title to set avatar and signature permissions for a user. creates drop downs in the modify profile section under custom title.
<script type="text/javascript"> <!-- // av/sig permissions v 1.5 // by Wormopolis - wormocodes.proboards.com // Do not repost - keep header intact
var defaultAvDisplay = false; //set to true if you want avatar on by default var defaultSigDisplay = false; //set to true if you want signature on by default
tds=document.getElementsByTagName('td');
// board display if (location.href.match(/action=(display|recent)/)) { for (i=0; i<tds.length; i++) { if (tds[i].className.match(/windowbg/) && tds[i].width=="20%" && tds[i].vAlign=="top" && tds[i].getElementsByTagName('a').length>2) { if (tds[i].innerHTML.match(/×\[(a?s?)\]×/)) { res=RegExp.$1; tds[i].innerHTML=tds[i].innerHTML.replace(/×\[(a?s?)\]×/,''); if (!res.match(/a/)) { for (im=tds[i].getElementsByTagName('img'), a=0; a<im.length; a++) { if (im[a].alt=="[avatar]") { im[a].style.display="none"; break; } } } if (!res.match(/s/)) { chk=tds[i].nextSibling.getElementsByTagName('table')[0].rows; if (chk[chk.length-1].getElementsByTagName('hr').length) { chk[chk.length -1].getElementsByTagName('table')[0].nextSibling.style.display = "none"; } } } else { // display if default is true if (!defaultAvDisplay) { for (im=tds[i].getElementsByTagName('img'), a=0; a<im.length; a++) { if (im[a].alt=="[avatar]") { im[a].style.display="none"; break; } } } if (!defaultSigDisplay) { chk=tds[i].nextSibling.getElementsByTagName('table')[0].rows; if (chk[chk.length-1].getElementsByTagName('hr').length) { chk[chk.length -1].style.display = "none"; } } } } } } // profile display if (location.href.match(/action=viewprofile/)) { for (i=0; i<tds.length; i++) { if (tds[i].className.match(/windowbg/) && tds[i].width=="20%" && tds[i].vAlign=="top") { if (tds[i].innerHTML.match(/×\[(a?s?)\]×/)) { res=RegExp.$1; tds[i].innerHTML=tds[i].innerHTML.replace(/×\[(a?s?)\]×/,''); if (!res.match(/a/)) { for (im=tds[i].getElementsByTagName('img'), a=0; a<im.length; a++) { if (im[a].alt=="[avatar]") { im[a].style.display="none"; break; } } } if (!res.match(/s/)) { chk=tds[i].nextSibling.getElementsByTagName('table')[0].rows; if (chk[chk.length-2].getElementsByTagName('hr').length) { chk[chk.length -1].style.display = chk[chk.length -2].style.display = "none"; } } } else { // display if default is true if (!defaultAvDisplay) { for (im=tds[i].getElementsByTagName('img'), a=0; a<im.length; a++) { if (im[a].alt=="[avatar]") { im[a].style.display="none"; break; } } } if (!defaultSigDisplay) { chk=tds[i].nextSibling.getElementsByTagName('table')[0].rows; if (chk[chk.length-2].getElementsByTagName('hr').length) { chk[chk.length -1].style.display = chk[chk.length -2].style.display = "none"; } } } } } } // modify profile if (location.href.match(/action=modifyprofile/)) { for (ipt=document.getElementsByTagName('input'), e=0; e<ipt.length; e++) { if (ipt[e].name=="customtitle") { ipt[e].value=ipt[e].value.replace(/×\[(a?s?)\]×/,''); sigPerm=ipt[e].parentNode.parentNode.parentNode.cloneNode(true); avPerm=ipt[e].parentNode.parentNode.parentNode.cloneNode(true); sigPerm.firstChild.firstChild.innerHTML="Signature Permission"; sigPerm.firstChild.nextSibling.firstChild.innerHTML="<select name='sigperm'><option value='true'>Yes</option><option value='false'>No</option></select>"; sigPerm.firstChild.nextSibling.nextSibling.firstChild.innerHTML="Allow member to have a signtaure."; avPerm.firstChild.firstChild.innerHTML="Avatar Permission"; avPerm.firstChild.nextSibling.firstChild.innerHTML="<select name='avperm'><option value='true'>Yes</option><option value='false'>No</option></select>"; avPerm.firstChild.nextSibling.nextSibling.firstChild.innerHTML="Allow member to have an avatar."; tmp=ipt[e].parentNode.parentNode.parentNode; tmp.parentNode.insertBefore(sigPerm,tmp.nextSibling); tmp.parentNode.insertBefore(avPerm,tmp.nextSibling); chkm=RegExp.$1; if (!chkm.match(/a/)) modifyForm.avperm.selectedIndex=1; if (!chkm.match(/s/)) modifyForm.sigperm.selectedIndex=1;
function permCheck() { ct="×["; ct+=(document.modifyForm.avperm.value=='true' ? "a" : ""); ct+=(document.modifyForm.sigperm.value=='true' ? "s" : ""); ct+="]×"; document.modifyForm.customtitle.value+=ct; }
if(document.addEventListener){ document.modifyForm.addEventListener("submit", permCheck, false); } else { if (document.attachEvent){ document.modifyForm.attachEvent("onsubmit", permCheck); } else { document.modifyForm.onsubmit = permCheck; } } break; } } }
// --> </script>
version upgrade: 1.4 - seperated Avatar/Signature default display settings
preview: I can make a screenshot later if necessary
|
|
|
Post by Wormopolis on Nov 2, 2009 6:29:07 GMT -8
version upgrade: 1.5 - made to work on recent threads list
|
|
mikel
Not New Member
Posts: 2
mikel said 0 great things
|
Post by mikel on Jun 1, 2011 7:12:46 GMT -8
This code doesn't work. It gives EVERYONE not able to have sigs or avatars, not just one.
|
|
|
Post by Wormopolis on Jun 1, 2011 8:17:46 GMT -8
thats the point of it. then you have to go into their modifyprofile and give them permission to have an avatar/signature.
or you can set the 2 variables at the top to be true, and then take away permissions from someone you dont want to have avatar/signature.
|
|
busta
Not New Member
What are you looking at?
Posts: 6
busta said 0 great things
|
Post by busta on Jul 2, 2011 6:08:24 GMT -8
thanks...works good with my gaming community site
|
|
|
Post by Wormopolis on Jul 2, 2011 17:28:09 GMT -8
glad you like it!
|
|