Post by Peter on Oct 30, 2004 12:57:18 GMT
Created by Nadim
Important
This code will not work for the main administrator of the board.
This problem is caused by the main admin's register date being "Day One".
The code will simply add a '~' for unrecognisable data such as this.
Main Footer
Important
This code will not work for the main administrator of the board.
This problem is caused by the main admin's register date being "Day One".
The code will simply add a '~' for unrecognisable data such as this.
Main Footer
<script language="JavaScript" type="text/javascript">
/*
This script may not be redestributed outside Zanmato Design.
http://zdesign.proboards3.com
Leave this header intact at all times.
*/
if(window.location.href.match(/action=(viewprofile&username=\w*|profile2)/i)){
var TD = document.getElementsByTagName("TD");
var RegDate,AvPosts;
var CurDate = Math.floor((new Date().getMonth()+1)*30 + Math.floor((new Date().getFullYear()+'').substring(2,4))*365 + new Date().getDate());
for(i=0;i<TD.length;i++){
with(TD[i]){
if(width=="70%" && innerHTML.match(/>Name: </)){
if(getElementsByTagName("Table")[0].getElementsByTagName("TD")[7].firstChild.innerHTML.indexOf(/Day/i)==-1){
RegDate = getElementsByTagName("Table")[0].getElementsByTagName("TD")[7].firstChild.innerHTML.split(/ at/)[0];
}
else{
RegDate = "~";
}
}
else if(width=="30%" && innerHTML.match(/Posts: (\d+)/)){
AvPosts = Math.floor(RegExp.$1);
innerHTML = innerHTML.replace("Posts: "+RegExp.$1,"Posts: "+RegExp.$1+'<br/><br/><font id="DR"><!--></font><br/><font id="Av"><!--></font>');
}
}
}
var RegDays = (RegDate.match(/\d\/\d/))? CurDate - Math.floor(Math.floor(RegDate.split(/\//)[0])*30 + Math.floor(RegDate.split(/\//)[2])*365 + Math.floor(RegDate.split(/\//)[1])): '~';
RegDays += '';
if(RegDays.match(/^\d+$/)){
AvPosts = (Math.floor(RegDays) == 0 || Math.floor(RegDays) == 1)? AvPosts: Math.floor(AvPosts)/Math.floor(RegDays);
AvPosts = Math.floor(AvPosts*10)/10;
}
else{
AvPosts = '~';
}
document.getElementById("DR").innerHTML = 'Registered: '+RegDays+' days';
document.getElementById("Av").innerHTML = 'Av. Posts: '+AvPosts+' per day';}
</script>
[Cross browser]