Post by ⓦ৹₪deⓡ on Sept 27, 2005 9:28:43 GMT -8
This code will add a meter to the mini profile displaying a warning meter if the user has a warning. This code will only work if in the custom title, you enter a warning with the following text in it "Warning: XX%" where XX can be any number between 0 and 100. If you use UBBC tags or additional text, make sure they go before and after this text, otherwise the code will not work. So for a bold warning of 47% with a description of Stop doing things, in the custom title enter [b]Warning: 47% Stop doing things[/b] Edit the code where instructed. Enjoy.~Wonder |
<script>
//Warning Meter v1.0
//Copyright 9-27-2005 by ~Wonder
//May be reposted anywhere as long as this header remains in tact. Make sure you include instructions.
//Put in Global Footer
//Edit these 3 variables to suit your color and height needs
meterBGColor="#CC0000";
meterBorderColor="#000000";
meterHeight=7;
//If you want to user a gradient instead of a solid background color, enter the URL here
meterGradientURL="";
if(meterGradientURL!=""){meterBGColor="";document.write("<style type=\"text/css\"><!--.warningmeter {background-image: url("+meterGradientURL+"); background-repeat: repeat;}--></style>")}
else{meterBGColor=" bgColor="+meterBGColor;}
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("Warning: ")!=-1)
{
p=td[i].innerHTML.substring(td[i].innerHTML.indexOf("Warning: ")+9,td[i].innerHTML.length);
p=parseInt(p.substring(0,p.indexOf("%")).replace(/,/ig,""));
a=td[i].innerHTML.match(/(Warning: \d*%(<\/.>)?(<br>)?)/i);
td[i].innerHTML=td[i].innerHTML.replace(a[0],a[0]+"<table style=\"border-width:1px; border-style: solid; border-color:"+meterBorderColor+"\" cellpadding=0 cellspacing=0 width=100%><tr><td"+meterBGColor+" width="+p+"% height="+meterHeight+" class=warningmeter></td><td width="+(100-p)+"%></td></tr></table>");
}
}
}
</script>
~Modified 9/28/05 at 21:46 and 22:33 to remove extra line beneath bar that sometimes occurs.
~Modified Oct 2nd, 2005 at 7:41pm to make code look better with gradients.
~Modified Oct 3rd, 2005 at 4:05am to make more compatible with other meters.