Post by CFP wolf on Sept 19, 2009 10:23:13 GMT -5
This will put an activity thermometer in the profile of your members showing their recent activity over the past month. Depending on how long ago they last logged on will depend on how high the thermometer will be, if they haven't logged in for over a month then it will be at the bottom. Put this in the global footer of your forum:
<script type="text/javascript">
<!--
/*
'Activity Thermometer by Todge.
Main Footer
Copyright © 2008
Please keep this header intact
*/
if(location.href.match('action=viewprofile&use') && pb_username == 'admin')
{
// Edit below...
var thermoImage = 'http://images.sodahead.com/images/profiles/0/0/0/9/3/4/3/7/9/profiles_Dragon_0006_634073_media_square.gif';
// Edit above...
function getDays(){
var daysAgo;
var today = document.getElementsByTagName('font')[2].innerHTML.split(/br>/i)[1].split(' at')[0].split(/\D/);
var lastLogin = document.getElementsByTagName('font');
for(l=0; l<lastLogin.length; l++)
{
if(lastLogin[l].innerHTML == 'Last Login Date:')
{
lastLogin = lastLogin[l+1];
break;
}}
if(lastLogin.innerHTML.match('Today'))
{
daysAgo = 0;
}
else if(lastLogin.innerHTML.match('Yesterday'))
{
daysAgo = 1;
}
else
{
lastLogin = lastLogin.innerHTML.split(' at')[0].split(/\D/);
if(parseFloat(lastLogin[2]) < parseFloat(today[2])-1)
{
daysAgo = 30;
}
else if(parseFloat(lastLogin[2]) == parseFloat(today[2])-1)
{
if(lastLogin[1] == 12)
{
lastLogin[1] = 13;
}
else
{
daysAgo = 30;
}}
if(daysAgo != 0 && daysAgo != 1 && daysAgo != 30)
{
lastLogin = (parseInt(lastLogin[1])*31)+parseInt(lastLogin[0]);
today = (parseInt(today[1])*31)+parseInt(today[0]);
daysAgo = today-lastLogin;
}}
return daysAgo;
}
function createThermometer(howLong)
{
var space = '&nb'+'sp;';
var thermo = '<br><br><center>Activity<br>Thermometer<br>';
thermo += '<table width="100px"><tbody>';
thermo += '<tr><td width="100%" height="100px" style="background-image: URL('+thermoImage+'); background-position: top center; background-repeat: no-repeat;">';
thermo += '<table width="100%" height="100px" cellspacing="0" cellpadding="0"><tbody>';
thermo += '<tr><td height="6px" width="45px"></td><td width="5px"></td><td></td></tr>';
if(howLong == 0)
{
thermo += '<tr><td></td><td style="background-color: #ff0000;"></td><td style="font-size: 5pt;">'+space+'- Active</td></tr>';
}
else
{
thermo += '<tr><td></td><td></td><td style="font-size: 5pt;">'+space+'- Active</td></tr>';
}
for(t=0; t<29; t++)
{
if(t<howLong)
{
thermo += '<tr><td height="2px"></td><td></td><td></td></tr>';
}
else
{
thermo += '<tr><td height="2px"></td><td style="background-color: #ff0000;"></td><td></td></tr>';
}}
if(howLong == 30)
{
thermo += '<tr><td></td><td></td><td style="font-size: 5pt;">'+space+'- In-active</td></tr>';
}
else
{
thermo += '<tr><td></td><td style="background-color: #ff0000;"></td><td style="font-size: 5pt;">'+space+'- In-active</td></tr>';
}
thermo += '<tr><td height="25px"></td><td></td><td></td></tr>';
thermo += '</tbody></table>';
thermo += '</td></tr>';
thermo += '</tbody></table></center>';
return thermo;
}
var lastTimeHere = getDays();
var thermometer = createThermometer(lastTimeHere);
var profile = document.getElementsByTagName('td');
for(p=0; p<profile.length; p++)
{
if(profile
<script type="text/javascript">
<!--
/*
'Activity Thermometer by Todge.
Main Footer
Copyright © 2008
Please keep this header intact
*/
if(location.href.match('action=viewprofile&use') && pb_username == 'admin')
{
// Edit below...
var thermoImage = 'http://images.sodahead.com/images/profiles/0/0/0/9/3/4/3/7/9/profiles_Dragon_0006_634073_media_square.gif';
// Edit above...
function getDays(){
var daysAgo;
var today = document.getElementsByTagName('font')[2].innerHTML.split(/br>/i)[1].split(' at')[0].split(/\D/);
var lastLogin = document.getElementsByTagName('font');
for(l=0; l<lastLogin.length; l++)
{
if(lastLogin[l].innerHTML == 'Last Login Date:')
{
lastLogin = lastLogin[l+1];
break;
}}
if(lastLogin.innerHTML.match('Today'))
{
daysAgo = 0;
}
else if(lastLogin.innerHTML.match('Yesterday'))
{
daysAgo = 1;
}
else
{
lastLogin = lastLogin.innerHTML.split(' at')[0].split(/\D/);
if(parseFloat(lastLogin[2]) < parseFloat(today[2])-1)
{
daysAgo = 30;
}
else if(parseFloat(lastLogin[2]) == parseFloat(today[2])-1)
{
if(lastLogin[1] == 12)
{
lastLogin[1] = 13;
}
else
{
daysAgo = 30;
}}
if(daysAgo != 0 && daysAgo != 1 && daysAgo != 30)
{
lastLogin = (parseInt(lastLogin[1])*31)+parseInt(lastLogin[0]);
today = (parseInt(today[1])*31)+parseInt(today[0]);
daysAgo = today-lastLogin;
}}
return daysAgo;
}
function createThermometer(howLong)
{
var space = '&nb'+'sp;';
var thermo = '<br><br><center>Activity<br>Thermometer<br>';
thermo += '<table width="100px"><tbody>';
thermo += '<tr><td width="100%" height="100px" style="background-image: URL('+thermoImage+'); background-position: top center; background-repeat: no-repeat;">';
thermo += '<table width="100%" height="100px" cellspacing="0" cellpadding="0"><tbody>';
thermo += '<tr><td height="6px" width="45px"></td><td width="5px"></td><td></td></tr>';
if(howLong == 0)
{
thermo += '<tr><td></td><td style="background-color: #ff0000;"></td><td style="font-size: 5pt;">'+space+'- Active</td></tr>';
}
else
{
thermo += '<tr><td></td><td></td><td style="font-size: 5pt;">'+space+'- Active</td></tr>';
}
for(t=0; t<29; t++)
{
if(t<howLong)
{
thermo += '<tr><td height="2px"></td><td></td><td></td></tr>';
}
else
{
thermo += '<tr><td height="2px"></td><td style="background-color: #ff0000;"></td><td></td></tr>';
}}
if(howLong == 30)
{
thermo += '<tr><td></td><td></td><td style="font-size: 5pt;">'+space+'- In-active</td></tr>';
}
else
{
thermo += '<tr><td></td><td style="background-color: #ff0000;"></td><td style="font-size: 5pt;">'+space+'- In-active</td></tr>';
}
thermo += '<tr><td height="25px"></td><td></td><td></td></tr>';
thermo += '</tbody></table>';
thermo += '</td></tr>';
thermo += '</tbody></table></center>';
return thermo;
}
var lastTimeHere = getDays();
var thermometer = createThermometer(lastTimeHere);
var profile = document.getElementsByTagName('td');
for(p=0; p<profile.length; p++)
{
if(profile
.width == '20%' && profile
.className == 'windowbg' && profile
.vAlign == 'top')
{
profile
.innerHTML += thermometer;
break;
}}}
// -->
</script>
For this code to work, you need to have your date as all numbers (3-3-08 not Mar 3, 2008), and in the order of DD/MM/YY. These can be modified in the general settings. Any questions? Post your question in the code support board for help