inherit
Handsome Devil
20992
0
Oct 26, 2012 20:34:21 GMT -8
ⓦ৹₪deⓡ
No animals were harmed in the feeding of this human.
925
March 2004
chickenturkeybacon
|
Post by ⓦ৹₪deⓡ on Oct 6, 2005 10:08:17 GMT -8
This code was modified Jan 13th, 2006 at 6:41am to be compatable with member groups that do not have any stars. This version will not work with any old warnings. | This script will add an extra option to member's profiles allowing you to give them a warning with a meter. You set a start date, a finish date, and a description for the warning and the meter will count down until the warning has expired. More complete instructions are shown on the profile page. The meter and warning will no longer show after the expiration date. The warning will start at 12:00:00am on the start date and end at 11:59:59pm on the end date. You may use a solid background or a gradient. Edit where instructed in the header. Do NOT PM me for support. That's what the support boards are for. Enjoy. ~Wonder |
TOP of Global Header<script> //Warning Meter v2.0 //Now with auto expiration
//Copyright 10-04-2005 by ~Wonder //May be reposted anywhere as long as this header remains in tact. Make sure you include instructions.
//Put at TOP of Global Header
//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="";
function getDate() { months=new Array("jan","feb","mar","apr","may","jun","jul","aug","sep","oct","nov","dec");te=0; curDate=document.getElementsByTagName("table")[0].innerHTML.match(/\.<br>.+ (\d{1,2}\:\d{2}(a|pm)?)/i)[0]; time=RegExp.$1; curDate=curDate.toLowerCase().replace(/\.<br>/i,"").replace(time,"").replace(/ at /i,"").replace(/,/g,"").replace(/\.|\-|\//g," ").split(" "); time=time.split(":"); if(time[1].match(/am/) && time[0].match(/12/)){time[0]=parseInt(time[0],10)-12;} if(time[1].match(/pm/) && !time[0].match(/12/)){time[0]=parseInt(time[0],10)+12;}time[1]=time[1].replace(/[^\d]/g,""); for(k=0;k<12;k++){if(curDate[0].match(months[k]) || curDate[1].match(months[k])){break;}} if((t=curDate[0].match(months[k]))!=null && t!=""){curDate[0]=(k+1)+"";te=1;}else if((t=curDate[1].match(months[k]))!=null && t!=""){curDate[1]=(k+1)+"";temp2=curDate[1];curDate[1]=curDate[0];curDate[0]=temp2;te=1;} curDate[0]=curDate[0].replace(/[^\d]/g,"");curDate[1]=curDate[1].replace(/[^\d]/g,""); if(parseInt(curDate[0],10)>12){temp2=curDate[1];curDate[1]=curDate[0];curDate[0]=temp2;} if(parseInt(curDate[1],10)<13 && te==0){now = new Date();if(parseInt(curDate[1],10)==(now.getMonth()+1)){temp2=curDate[1];curDate[1]=curDate[0];curDate[0]=temp2;}} if(curDate[2].length<=2){curDate[2]=parseInt(curDate[2],10)+2000;} return new Date(parseInt(curDate[2],10),parseInt(curDate[0],10)-1,parseInt(curDate[1],10),parseInt(time[0],10),parseInt(time[1],10)); } mainDate=getDate(); </script> TOP of Global Footer<script> //Warning Meter v2.0
//Copyright 10-04-2005 by ~Wonder //May be reposted anywhere as long as this header remains in tact. Make sure you include instructions.
//Put at top of Global Footer 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)/)) { curDate=mainDate; 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.match(/(\[W#(.+?)#(.+?)#(.+?)\](<br>)?)/i)) { temp=RegExp.$1; w=""; s=RegExp.$2; f=RegExp.$3; des=RegExp.$4; start=s.replace(/\.|\//g,"-").replace(/[^\-\d]/g,"").split("-"); finish=f.replace(/\.|\//g,"-").replace(/[^\-\d]/g,"").split("-"); if(start[2].length<=2){start[2]=parseInt(start[2],10)+2000;} if(finish[2].length<=2){finish[2]=parseInt(finish[2],10)+2000;} start=new Date(parseInt(start[2],10),parseInt(start[0],10)-1,parseInt(start[1],10)); finish=new Date(parseInt(finish[2],10),parseInt(finish[0],10)-1,parseInt(finish[1],10)+1); p=Math.round(((finish-curDate)/(finish-start))*100);if(p>100){p=0;} if(des.length>2){des+="<br>";} if(p>0){td[i].innerHTML=td[i].innerHTML.replace(temp,"<b>Warning:</b> "+p+"%"+"<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><table border=0 cellpadding=0 cellspacing=0 width=100%><tr><td><font size=1>S:"+s+"</font></td><td align=\"right\"><font size=1>E:"+f+"</font></td></tr></table>"+des);} else{td[i].innerHTML=td[i].innerHTML.replace(temp,"><br>");} } } } if("undefined" != typeof(document.modifyForm) && "undefined" != typeof(document.modifyForm.customtitle)) { curDate=mainDate; f=document.modifyForm; f.customtitle.onblur=wp; f.customtitle.onfocus=wr; sta="";fin="";des="";orig="";wc=""; if(f.customtitle.value.match(/(\[W#(.+?)#(.+?)#(.+?)\])/)) { orig=RegExp.$1;sta=RegExp.$2;fin=RegExp.$3;des=RegExp.$4; start=sta.replace(/\.|\//g,"-").replace(/[^\-\d]/g,"").split("-"); finish=fin.replace(/\.|\//g,"-").replace(/[^\-\d]/g,"").split("-"); if(start[2].length<=2){start[2]=parseInt(start[2],10)+2000;} if(finish[2].length<=2){finish[2]=parseInt(finish[2],10)+2000;} start=new Date(parseInt(start[2],10),parseInt(start[0],10)-1,parseInt(start[1],10)); finish=new Date(parseInt(finish[2],10),parseInt(finish[0],10)-1,parseInt(finish[1],10),23,59,59); if(curDate>finish) { f.customtitle.value=f.customtitle.value.replace(orig,""); sta="";fin="";des="";orig=""; } } if(sta==""){sta=(curDate.getMonth()+1)+"/"+curDate.getDate()+"/"+(curDate.getFullYear()+"").substring(2,4);} curDate=new Date((curDate-0)+(86400000*7)); if(fin==""){fin=(curDate.getMonth()+1)+"/"+curDate.getDate()+"/"+(curDate.getFullYear()+"").substring(2,4);} tabs=document.getElementsByTagName("table"); for(i=0;i<tabs.length;i++) { if(tabs[i].innerHTML.match(/Account Notes:/) && !tabs[i].innerHTML.match(/MSN:/)) { temprow=tabs[i].insertRow(-1); temp=temprow.insertCell(0); temp.innerHTML="<font size=\"-1\">Warning:</font>"; temp.width=160;temp.vAlign="top"; temp=temprow.insertCell(1); temp.colSpan=2; if(des==" "){des="";} temp.innerHTML="<table border=0 width=100%><tr><td>Start Date:</td><td><input name=startdate size=11 value=\""+sta+"\"></td><td>End Date:</td><td><input name=enddate size=11 value=\""+fin+"\"></td></tr><tr><td>Description:</td><td colSpan=3><input name=description size=40 value=\""+des+"\"> <input type=button value=\"Apply\" onClick=updateWarning()> <input type=button value=\"Reset\" onClick=resetWarning()></td></tr></table><font size=\"-2\">Enter the start date, expiration date, and description of a warning you want to give this member. Start and End dates must be in MM/DD/YYYY or MM/DD/YY formats (You can use - or . instead of /). You may use UBBC in the description. If you start a warning in the future, it will not start showing until that date. If you want to set a warning's start date for some time before 2000, use a 4 digit year. To remove a warning, set the end date to some time in the past. Click \"Apply\" when you are content. Then click \"Modify Profile\" to submit the information.</font>"; temp.width=245;temp.valign="top"; break; } } } function wr(){wc=f.customtitle.value.match(/(\[W#(.+?)#(.+?)#(.+?)\])/); wc=(wc.length>0)?wc[0]:""; f.customtitle.value=f.customtitle.value.replace(wc,"");} function wp(){if(wc!=null)f.customtitle.value=wc+f.customtitle.value;} function resetWarning() { curDate=mainDate; f.startdate.value=(curDate.getMonth()+1)+"/"+curDate.getDate()+"/"+(curDate.getFullYear()+"").substring(2,4); curDate=new Date((mainDate-0)+(86400000*7)); f.enddate.value=(curDate.getMonth()+1)+"/"+curDate.getDate()+"/"+(curDate.getFullYear()+"").substring(2,4); f.description.value=""; } function updateWarning() {if(f.description.value.length==0){f.description.value+=" ";} f.customtitle.value=f.customtitle.value.replace(f.customtitle.value.match(/\[W#(?:.+)#(?:.+)#(?:.+)\]/),"");f.customtitle.value="[W#"+f.startdate.value+"#"+f.enddate.value+"#"+f.description.value+"]"+f.customtitle.value;} </script> ~modifed Apr 19th, 2006 at 8:29am to fix greedy RegExp
|
|