Post by ⓦ৹₪deⓡ on Sept 27, 2005 8:58:42 GMT -8
This code will add a meter to the mini profile displaying a Karma meter. The meter can be a solid color or you can use gradients. Make sure you place this code above codes that modify Karma, especially ones that rename Karma. Edit the code where instructed. Enjoy. ~Wonder |
<script>
//Karma Meter v1.0
//Copyright 9-27-2005 by ~Wonder
//May be reposted anywhere as long as this header remains in tact
//Put in Global Footer
//Enter the maximum Karma
maxKarma=100;
//Edit these variables to suit your color and height needs
meterBGColorLeft="#EE0000";
meterBGColorRight="#00CC00";
meterColor="#FFFF00";
meterBorderColor="#000000";
meterHeight=8;
//true/false Do you want to center the links to Exalt and Smite? False is less likely to cause conflicts with other scripts
centerExaltSmite=true;
//If you want to user a gradient instead of a solid background/meter color, enter the URLs here
meterGradientURLLeft="";
meterGradientURLRight="";
meterColorGradient="";
if(meterGradientURLLeft!=""){meterBGColorLeft="";document.write("<style type=\"text/css\"><!--.karmameter1 {background-image: url("+meterGradientURLLeft+"); background-repeat: repeat;}--></style>")}
else{meterBGColorLeft=" bgColor="+meterBGColorLeft;}
if(meterGradientURLRight!=""){meterBGColorRight="";document.write("<style type=\"text/css\"><!--.karmameter2 {background-image: url("+meterGradientURLRight+"); background-repeat: repeat;}--></style>")}
else{meterBGColorRight=" bgColor="+meterBGColorRight;}
if(meterColorGradient!=""){meterColor="";document.write("<style type=\"text/css\"><!--.karmameter3 {background-image: url("+meterColorGradient+"); background-repeat: repeat;}--></style>")}
else{meterColor=" bgColor="+meterColor;}
if(location.href.match(/action=(display|goto|viewprofile|pmview|recent)/))
{
var td=document.getElementsByTagName("td");
for(i=0;i<td.length;i++)
{
if(td[i].width=="20%" && td[i].className.match(/windowbg/) && td[i].innerHTML.indexOf("Karma: ")!=-1)
{
p=td[i].innerHTML.substring(td[i].innerHTML.indexOf("Karma: ")+7,td[i].innerHTML.length)+"<";
p=parseInt(p.substring(0,p.indexOf("<")).replace(/,/ig,""));
pos=0;if(p>=0){pos=1;}
p=Math.abs(p);
//alert("#"+p+"#");
p=Math.round((p/maxKarma)*50);
if(p>50){p=50;}
td[i].innerHTML.match(/(Karma: -?\d+(<br>)?)/i);
if(pos==1)
{
temp="";if(centerExaltSmite==true){temp="<table border=0 cellpadding=0 cellspacing=0 width=100%><tr><td width=2%></td><td><center> ";}
td[i].innerHTML=td[i].innerHTML.replace(RegExp.$1,RegExp.$1+"<table style=\"border-width:1px; border-style: solid; border-color:"+meterBorderColor+"\" cellpadding=0 cellspacing=0 width=100%><tr><td"+meterBGColorLeft+" width=25% height="+meterHeight+" class=karmameter1></td><td"+meterBGColorLeft+" width=24% class=karmameter1></td><td"+meterBGColorRight+" width="+(p-1)+"% class=karmameter2></td><td"+meterColor+" width=1% class=karmameter3><td"+meterBGColorRight+" width="+(50-p)+"% class=karmameter2></td></tr></table><table width=100% cellpadding=0 cellspacing=0 border=0><tr><td align=left width=33%><font size=1><b>-"+maxKarma+"</b></font></td><td width=34%><center><font size=1><b>0</b></font></center></td><td align=right width=33%><font size=1><b>+"+maxKarma+"</b></font></td></tr></table>"+temp);
if(centerExaltSmite==true){td[i].innerHTML+="</center></td></td></table>";}
}
else
{
temp="";if(centerExaltSmite==true){temp="<table border=0 cellpadding=0 cellspacing=0 width=100%><tr><td width=2%></td><td><center> ";}
td[i].innerHTML=td[i].innerHTML.replace(RegExp.$1,RegExp.$1+"<table style=\"border-width:1px; border-style: solid; border-color:"+meterBorderColor+"\" cellpadding=0 cellspacing=0 width=100%><tr><td"+meterBGColorLeft+" width="+(50-p)+"% height="+meterHeight+" class=karmameter1></td><td"+meterColor+" width=1% class=karmameter3><td"+meterBGColorLeft+" width="+(p-1)+"% class=karmameter1></td><td"+meterBGColorRight+" width=24% class=karmameter2></td><td"+meterBGColorRight+" width=25% class=karmameter2></td></tr></table><table width=100% cellpadding=0 cellspacing=0 border=0><tr><td align=left width=33%><font size=1><b>-"+maxKarma+"</b></font></td><td width=34%><center><font size=1><b>0</b></font></center></td><td align=right width=33%><font size=1><b>+"+maxKarma+"</b></font></td></tr></table>"+temp);
if(centerExaltSmite==true){td[i].innerHTML+="</center></td></td></table>";}
}
}
}
}
</script>