Post by Wormopolis on May 25, 2009 6:06:03 GMT -8
Browser tested: IE and FF
placement: Global footer
Makes Karma invisible to any user with less than set post count. also gives ability to rename karma, and remove smite privs for non-selected users. also has variable to have selected users without restriction, and also to hide karma numbers from guests.
code:
preview: not really needed.. it just makes it hidden
UPDATES TO THIS CODE FOUND ON wormocodes.proboards.com
placement: Global footer
Makes Karma invisible to any user with less than set post count. also gives ability to rename karma, and remove smite privs for non-selected users. also has variable to have selected users without restriction, and also to hide karma numbers from guests.
code:
<script language="JavaScript">
<!--
// Post requirements for Karma use - version 1.6
// by Wormopolis - wormocodes.proboards.com
// Do not repost - keep header intact
var postsRequiredToUseKarma=100;
// if you want to rename karma:
var useNewKarmaWords=true;
var newKarmaWord="Mojo";
var newSmiteWord="Ice";
var newExaltWord="Work";
// if you want only certain people to use smite:
var restrictSmite=true;
var smiteAllowed=/^(admin|user1|wormopolis)$/; //seperate by |
// if you want certain users to use karma regardless of postcount
var alwaysKarma=/^(admin|user1|wormopolis)$/; //seperate by |
// if you want Karma hidden to Guests
var guestHideKarma=false;
// no need to edit below, unless you know what you are doing
if(location.href.match('board=') || location.href.match(/action=viewprofile/)) {
pstcnt=0;
if (document.cookie.match(/postcount=(\d+)/)) {
pstcnt=RegExp.$1;
}
for (lnks=document.getElementsByTagName('a'), i=0; i<lnks.length; i++) {
if (lnks[i].href.match(/action=karma/)) {
if (pstcnt<postsRequiredToUseKarma && !pb_username.match(alwaysKarma)) {
lnks[i].style.display="none";
lnks[i].previousSibling.nodeValue="";
lnks[i].nextSibling.nodeValue="";
lnks[i].parentNode.innerHTML=lnks[i].parentNode.innerHTML.replace(/karma:\s(-?)(\d+)/i,'');
if (location.href.match(/action=viewprofile/)) {
for (tds=lnks[i].parentNode.nextSibling.getElementsByTagName('td'), j=0; j<tds.length; j++) {
if (tds[j].innerHTML.match(/karma:/i)) {
tds[j].parentNode.style.display="none";
}
}
}
} else {
if (restrictSmite && lnks[i].innerHTML.match(/Smite/) && !pb_username.match(smiteAllowed)) {
lnks[i].style.display="none";
lnks[i].previousSibling.nodeValue=" ]";
lnks[i].nextSibling.nodeValue="";
}
if (useNewKarmaWords && lnks[i].innerHTML.match(/Smite/)) lnks[i].innerHTML=lnks[i].innerHTML.replace(/Smite/,newSmiteWord);
if (useNewKarmaWords && lnks[i].innerHTML.match(/Exalt/)) lnks[i].innerHTML=lnks[i].innerHTML.replace(/Exalt/,newExaltWord);
if (useNewKarmaWords && lnks[i].parentNode.innerHTML.match(/Karma/)) lnks[i].parentNode.innerHTML=lnks[i].parentNode.innerHTML.replace(/Karma/,newKarmaWord);
if (location.href.match(/action=viewprofile/) && useNewKarmaWords && lnks[i].parentNode.nextSibling.innerHTML.match(/Karma/)) lnks[i].parentNode.nextSibling.innerHTML = lnks[i].parentNode.nextSibling.innerHTML.replace(/Karma/,newKarmaWord);
}
}
}
}
if (pb_username=="Guest") {
for (tds=document.getElementsByTagName('td'), k=0; k<tds.length; k++) {
if (tds[k].innerHTML.match(/karma:\s(-?)(\d+)/gi)) {
if (guestHideKarma) tds[k].innerHTML=tds[k].innerHTML.replace(/karma:\s(-?)(\d+)/gi,'');
tds[k].innerHTML=tds[k].innerHTML.replace(/karma/gi,newKarmaWord);
}
}
}
if(location.href.match('action=viewprofile') || (location.href.match('thread=') && !location.href.match(/action=post/i))){
var ahh=document.getElementsByTagName('a')
for(q=0;q<ahh.length;q++){
if(ahh[q].href.match('viewprofile&user='+pb_username)){
postcount=ahh[q].parentNode.parentNode.innerHTML.split('Posts: ')[1].split(/</)[0];
postcount=postcount.replace(",","");
expDate=new Date();
expDate.setYear(expDate.getFullYear()+1);
document.cookie="postcount="+postcount+"; expires="+expDate;
break;
}
}
}
// -->
</script>
preview: not really needed.. it just makes it hidden
UPDATES TO THIS CODE FOUND ON wormocodes.proboards.com