Sept 20, 2011 16:45:06 GMT -5 |
Post by Hex on Sept 20, 2011 16:45:06 GMT -5
<script type="text/javascript">
<!--
/*
Info Center 102
created by Ross, Copyright - 2005-07
this code may not be reposted
support.proboards.com
keep this header intact at all times
*/
// Member of the month settings. Leave blank for none
var motm = [
"", // Member Username
"" //Display Name
];
// For the 'Forum Age'. Enter the forums start date in the form of 'DD','MM','YYYY' or leave blank to not use this feature.
var startDate = ['28','06','2005'];
// The titles used on each section of the Info Center.
var titles = [
"<font size=4><font face=georgia>Info Center</font></font>",
"Forum Stats",
"Birthdays & Events",
"Members Online",
"Active Users Today"
];
var style = [
"#876d50", // Color of the dividing lines
"double", // Style of the dividing lines
"Head Image URL", // Head image URL (Leave blank for none)
"Base Image URL" // base image URL (Leave blank for none)
];
//Edit the names of the staff groups, their corresponding group number(s) and an optional color for the group. Repeat the pattern for more groups.
var staff = []; var s = 0;
staff[s++] = ["Administrators","1","a165be"];
staff[s++] = ["Global Moderators","2","009498"];
staff[s++] = ["Moderators","3","4C83AB"];
//staff[s++] = ["Designer","5","89A7FF"];
//staff[s++] = [“Coder”,"6",”D393F0”];
//staff[s++] = [“Veteran”,"7",”00C4C7”];
//staff[s++] = [“Premium Member”,"8",”A57577”];
//staff[s++] = [“Banned Member”,"10",”333333”];
// Do not edit below this line unless you know what you're doing
if(location.href.match(/\.com\/?(index.cgi)?\??(&?action=home)?(&?page=affiliates)?(#\w+)?$/)) {
var td = document.getElementsByTagName('td');
var div = document.createElement('div');
// Forum Age
var sta = new Date();
sta.setDate(startDate[0]);
sta.setMonth(startDate[1]-1);
sta.setYear(startDate[2]);
var cur = new Date();
var dif = cur - sta;
var totalMonth = 0;
var totalYear = 0;
var totalDay = Math.floor(dif/(60 * 60 * 24 * 1000)) + 1;
while(totalDay > 365) {
totalDay -= 365;
totalYear++;
}
while(totalDay > 30) {
totalDay -= 30;
totalMonth++;
}
var age = totalDay+' days';
if(totalMonth > 0)
age += ', '+totalMonth+' months';
if(totalYear > 0)
age += ', '+totalYear+' year';
age += '.';
// Starting Totals
var updated = 0;
var boards = 0;
var categories = 0;
var subs = 0;
// Box Styles
var b = [];
b['r'] = 'border-right: '+style[0]+' '+style[1]+' 1px;';
b['l'] = 'border-left: '+style[0]+' '+style[1]+' 1px;';
b['b'] = 'border-bottom: '+style[0]+' '+style[1]+' 1px; padding-bottom: 5px;';
b['pad'] = 'padding-right: 10px; padding-left: 20px; padding-bottom: 5px; padding-top: -1px;';
b['sep'] = 'padding-right: 10px; padding-left: 10px;';
for (i=0; i<td.length; i++)
{
if(td.width == '66%' && td.className == 'windowbg2')
{
boards++;
if(td.innerHTML.match(/\((\d+) sub/))
subs += parseInt(RegExp.$1);
if(td[i-1].innerHTML.match(/\[\*\]/))
updated++;
}
else if(td.className=='catbg' && td.innerHTML.match(/a name/i))
categories++;
else if(td.innerHTML.match(/<b>Info Center<\/b>/i)
&& td.parentNode.parentNode.parentNode.className == 'bordercolor'
&& td.parentNode.parentNode.parentNode.width == '100%')
{
td.parentNode.parentNode.className = 'infocenter';
var iCell = td.getElementsByTagName('td');
var iHolder = '';
var posts = td.innerHTML.match(/Total Posts: (.+?)</)? parseInt(RegExp.$1.replace(/,/g,'')) : '';
var topics = td.innerHTML.match(/Total Topics: (.+?) &nb/)? parseInt(RegExp.$1.replace(/,/g,'')) : '';
var pb_date = td.item(2).getElementsByTagName('font').item(0).innerHTML.split(/<br>/i)[1];
if(pb_username == 'Guest')
var pms = 'Please <a href="?action=login">Login</a> to access this feature.';
else
var pms = 'You have <a href="?action=pm">'+ (td.item(2).innerHTML.match(/, (\d+) are new./)? +RegExp.$1+' Unread Messages</a>' : '1 Unread Message</a>');
var members = iCell[5].innerHTML.match(/Total Members: <a.+?>(.+?)<\/a>/i)? RegExp.$1 : 0;
var newmember = iCell[5].innerHTML.match(/Newest Member: (<a.+?>.+?<\/a>)/i)? RegExp.$1 : 'N/A';
var lastpost = iCell[4].innerHTML.match(/Last Updated Topic: (<a.+?>.+?<\/a>)( )?by /i)? RegExp.$1 : 'N/A';
var lastposter = iCell[4].innerHTML.match(/<\/a>\s?by (<a.+?>.+?<\/a>)\s?\(/i)? 'By the Member: '+RegExp.$1 : (iCell[4].innerHTML.match(/by\s(.+?)\s\(/)? 'By the Guest '+RegExp.$1 : 'N/A');
var lastdate = iCell[4].innerHTML.match(/(.+\)(.+)?)?\((.+?)\)<br\s?\/?>View/i)? RegExp.$3 : 'N/A';
var totals = [
(td.innerHTML.match(/(Total Posts: .+?)</)? RegExp.$1 : ''),
(td.innerHTML.match(/(Total Topics: .+?) &nb/)? RegExp.$1 : ''),
('Posts per Topic: '+ Math.round(posts / topics)),
('Posts per Board: '+ Math.round(posts / boards))
];
var stats = '<table width="100%"><tr><td width="100%" style="'+b['pad']+'">';
stats += '<div style="'+b['b']+'">';
for(t=0; t<totals.length; t++) {
stats += '<span style="'+b['sep']+'">'+totals[t]+'</span>';
if(totals[t+1])
stats += '-';
}
stats += '</div>';
stats += '<table width="100%"><tr><td width="40%" style="'+b['r']+'">';
stats += 'There are a total of '+members+' registered members.<br />';
stats += 'We would like to welcome '+newmember+' as the newest member to join '+document.title.split(/-/)[0];
stats += '</td><td width="30%" style="'+b['pad']+'">';
stats += 'The Last Post Made was: '+ lastpost+'<br />';
stats += 'Made On: '+lastdate+'<br />';
stats += lastposter;
stats += '</td></tr></table>';
stats += '</td></tr></table>';
iCell[0].getElementsByTagName('b').item(0).innerHTML = titles[0];
iCell[1].getElementsByTagName('b').item(0).innerHTML = titles[1];
iCell[3].innerHTML = stats;
iCell[3].colSpan = '2';
iCell[2].style.display = 'none';
// Head & Base Images
var infoTable = td.parentNode.parentNode.parentNode;
if(style[2].match(/^http:\/\//i)) {
var headCenter = document.createElement('center');
var headImg = document.createElement('img');
headImg.src = style[2];
headCenter.appendChild( headImg );
infoTable.parentNode.insertBefore(headCenter, infoTable)
}
if(style[3].match(/^http:\/\//i)) {
var baseCenter = document.createElement('center');
var baseImg = document.createElement('img');
baseImg.src = style[3];
baseCenter.appendChild( baseImg );
infoTable.parentNode.insertBefore(baseCenter, infoTable.nextSibling)
}
// Birthdays and Events
var events = '';
events += '<table width="100%"><tr><td width="100%" style="'+b['b']+'"><font size="1">';
var events_str = '';
var x = iCell.length - 5;
if(iCell[x].innerHTML.match(/action=calendarview/)) {
var totalEvents = iCell[x].getElementsByTagName('a').length;
var event_plural = (totalEvents == 1)? ['is',''] : ['are','s'];
events_str += '<tr><td width="100%" style="'+b['b']+'">';
events_str += 'There '+event_plural[0]+' '+totalEvents +' event'+event_plural[1]+' this month.';
events_str += '</td><tr><tr><td width="100%" style="'+b['pad']+'">';
events_str += iCell[x].innerHTML;
events_str += '</td><tr>';
iCell[x-2].style.display = 'none';
x-=4;
}
if(iCell[x].innerHTML.match(/((\d+) birthdays? today.)/)) {
var memberBirthdays = parseInt(RegExp.$1);
var allBirthdays = iCell[x].innerHTML.split(/<br>/i)[1];
if(iCell[x].innerHTML.match(/group\d+/)) {
var staffBirthdays = 0;
var a = iCell[x].getElementsByTagName('a');
for(l=0; l<a.length; l++) {
if(a.item(l).className) {
staffBirthdays++;
memberBirthdays--;
}
}
var staff_plural = (staffBirthdays == 1)? ['is',''] : ['are','s'];
events += 'There '+staff_plural[0]+' '+staffBirthdays+' staff member'+staff_plural[1]+' celebrating their birthday'+staff_plural[1]+' today. ';
}
if(memberBirthdays != 0) {
var member_plural = (memberBirthdays == 1)? ['is',''] : ['are','s'];
events += 'There '+member_plural[0]+' '+memberBirthdays+' member'+member_plural[1]+' celebrating their birthday'+member_plural[1]+' today. ';
}
if(memberBirthdays != 0 || staffBirthdays != 0) {
events += '</font></td></tr><tr><td width="100%" style="'+b['pad']+'">';
events += '<font size="1">'+allBirthdays;
}
iCell[x-2].style.display = 'none';
if(events_str.length > 0) {
iCell[x-1].parentNode.style.display = 'none';
iCell[x-3].parentNode.style.display = 'none';
}
else
x-=4;
}
if(events.length > 120 || events_str.length > 0) {
x+=4;
events += '</td></tr>'+ events_str +'</table>';
iCell[x-3].getElementsByTagName('b').item(0).innerHTML = titles[2];
iCell[x-1].colSpan = '2';
iCell[x-1].innerHTML = events;
}
// Users Online Today
var z = iCell.length - 1;
if(!iCell[z].innerHTML.match(/.\sMost users/)) {
var a = iCell[z].getElementsByTagName('a');
var onlineTotals = '';
for(j=0; j<a.length; j++) {
for(s=0; s<staff.length; s++) {
if(!staff
staff
groupCount = (staff
if(a[j].className && a[j].className.match(new RegExp('group'+staff
groupCount++;
}
staff
}
}
var totalOn = 0;
for(s=0; s<staff.length; s++) {
staff
onlineTotals += '<font color="'+staff
totalOn += parseInt(staff
}
iCell[z].innerHTML.match(/((\d+) Member(s)?),/)
onlineTotals += RegExp.$1 +'<br />';
totalOn += parseInt(RegExp.$2);
if(iCell[z].innerHTML.match(/((<a.+?>)?(\d+) Guest(s)?(<\/a>)?)</i)) {
onlineTotals += RegExp.$1 +'<br />';
totalOn += parseInt(RegExp.$3);
}
var usersOnline = '<table width="100%"><tr><td vAlign"top" width="28%" rowSpan="3" style="'+b['r']+'">';
usersOnline += onlineTotals;
usersOnline += '</td><td width="72%" style="'+b['pad']+b['b']+'">';
usersOnline += 'There have been '+totalOn+' members online today';
usersOnline += '</td></tr><tr><td vAlign="top" width="82%" style="'+b['pad']+'">';
usersOnline += iCell[z].innerHTML.split(/<br>/i)[1];
usersOnline += '</td></tr></table>';
iCell[z-4].getElementsByTagName('b').item(0).innerHTML = titles[4];
iCell[z-2].style.display = 'none';
iCell[z-1].colSpan = '2';
iCell[z-1].innerHTML = usersOnline;
z -= 6;
}
// Users Online
var a = iCell[z].getElementsByTagName('a');
var onlineTotals = '';
for(j=0; j<a.length; j++) {
for(s=0; s<staff.length; s++) {
if(!staff
staff
if(!staff
staff
groupCount = (staff
if(a[j].className && a[j].className.match(new RegExp('group'+staff
groupCount++;
}
staff
}
}
var mostOn = iCell[z].innerHTML.match(/(M.{15}e was .+<br>)/i)? RegExp.$1 : '';
var totalOn = 0;
for(s=0; s<staff.length; s++) {
staff
onlineTotals += '<font color="'+staff
totalOn += parseInt(staff
}
iCell[z].innerHTML.match(/((\d+) Member(s)?),/)
onlineTotals += RegExp.$1 +'<br />';
totalOn += parseInt(RegExp.$2);
if(iCell[z].innerHTML.match(/ ((\d+) Invisible) User(s)?./)) {
onlineTotals += RegExp.$1 + ' Member' + RegExp.$3 +'<br />';
totalOn += parseInt(RegExp.$2);
}
if(iCell[z].innerHTML.match(/((<a.+?>)?(\d+) Guest(s)?(<\/a>)?)(\.|\,)/i)) {
onlineTotals += RegExp.$1 +'<br />';
totalOn += parseInt(RegExp.$3);
}
var usersOnline = '<table width="100%"><tr><td vAlign"top" width="28%" rowSpan="3" style="'+b['r']+'">';
usersOnline += onlineTotals;
usersOnline += '</td><td width="72%" style="'+b['pad']+b['b']+'">';
usersOnline += 'There are currently '+totalOn+' members online. '+mostOn;
usersOnline += '</td></tr><tr><td vAlign="top" width="82%" style="'+b['pad']+b['b']+'">';
usersOnline += iCell[z].innerHTML.split(/<br>/i)[1];
usersOnline += '</td></tr><tr><td style="'+b['pad']+'">';
usersOnline += pms;
if(startDate[0] && startDate[0].match(/\d+/))
usersOnline += ' &nb'+'sp; - &nb'+'sp; Forum Age: '+age;
if(motm[0].match(/\w+/))
usersOnline += ' &nb'+'sp; - &nb'+'sp; The member of the month is <a href="?action=viewprofile&user='+motm[0]+'">'+motm[1]+'</a>';
usersOnline += '</td></tr></table>';
iCell[z-4].getElementsByTagName('b').item(0).innerHTML = titles[3];
iCell[z-2].style.display = 'none';
iCell[z-1].colSpan = '2';
iCell[z-1].innerHTML = usersOnline;
}
}
}
//-->
</script>