Post by Marc on Sept 18, 2006 18:12:48 GMT -8
Compatibility: Crossbrowser.
Placement: Top of main footer.
Preview: Click
Updates
Placement: Top of main footer.
Preview: Click
Updates
- Fixed alignment issue in Firefox
- Added forum age
- Added Recent Posts
- Added Member Of The Month
- Admin can choose to show either recent posts or member of the month
- Added staff legend
- Swap links to show Stats/Legend
- Added Head/Base Images
- Easier to change floating Info Center box colors
- Fixed Users Online Bug When no Staff Online - Ross
<script type="text/javascript">
<!--
/*
Xtreme Info Center v1.0 by Cr0w
Copyright 2006
Do not repost without permission
Head/Base by DregondRahl
*/
// Edit Below...
//Titles
var ForumName="CT Graphics" //Your forum name
var ICtitle="Forum Information" //Info center title
var UOtitle="Users Online" //Users Online title
var ZeroOnline="There are no users currently online." //Message shown when no one is online
//Staff
var Staff=[]
Staff[0]=["Administrator","FFFF00"];
Staff[1]=["Global Mod","0000FF"];
Staff[2]=["Moderator","00FF00"];
Staff[3]=["Gfx Designer","00FFFF"];
//Head And Base - leave blank for none
var HeadImg="http://img145.imageshack.us/img145/8113/head1ld6.gif" //URL to head image
var BaseImg="http://img145.imageshack.us/img145/5844/base1vx5.gif" //URL to base image
//MotM
var MotMon="no" //Do you want to have Member Of The Month displayed?
var MotM=["admin","Cr0w"] //Username and display name of the MotM
//Info Center Boxes
var BoxBg="F9F9F9" //Hex color for info center box background
var BoxBrdr="000000" //Hex color for info center box border
//Forum Age
var ForumAge=['15','04','2006'] //Your forum's age in the format of ['Day','Month','Year']
//Edit Above...
//No Edit Below...
if(window.navigator.appName=='Netscape'){
document.write('<style>.bPad{ border: 1px solid #'+BoxBrdr+'; width: 97%; }');
document.write('.uSbox { background-color: '+BoxBg+'; padding: 6px; height:50px }');
document.write('.iBox { background-color: '+BoxBg+'; }');
document.write('.uBox { background-color: '+BoxBg+'; }</style>');
}
else
{
document.write('<style>.bPad{ border: 1px solid #'+BoxBrdr+'; width: 100%; }');
document.write('.uSbox { background-color: '+BoxBg+'; padding: 8px }');
document.write('.iBox { background-color: '+BoxBg+'; }');
document.write('.uBox { background-color: '+BoxBg+'; }</style>');
}
if(HeadImg!="" && BaseImg!=""){
var table = document.getElementsByTagName('table');
for(i=0; i<table.length; i++) {
if(table[i].innerHTML.match(/>Info\sCenter</i) && table[i].className == 'bordercolor' ) {
Head=document.createElement('center');
Base=document.createElement('center');
Head.innerHTML="<img src='"+HeadImg+"'/>";
Base.innerHTML="<img src='"+BaseImg+"'/>";
table[i].parentNode.insertBefore(Head, table[i]);
table[i].parentNode.insertBefore(Base, table[i].nextSibling);
}
}
}
var table= document.getElementsByTagName('td');
var td=document.getElementsByTagName('td');
var Infocenter = new function()
{
this.stats = { categories:0, boards:0, subboards:0, upboard:0, viewboard:0, topics:0, posts:0, members:0, lastpost:'', newmember:'' };
this.onlinestats = { staff:0,members:0,guests:0,total:0,mostusers:'' };
this.birthdays = [];
this.events = [];
this.online = [];
this.Assembledata = function()
{
var TD = document.body.getElementsByTagName('td');
for( t = 0 ; t < TD.length ; t ++ )
{
if( TD[t].colSpan == "5" && TD[t].className == "catbg" && TD[t].align != "right" )
this.stats.categories ++;
if( TD[t].className == "windowbg2" && TD[t].width == "66%" && TD[t].align == "left" )
{
this.stats.boards ++;
this.stats.subboards += (TD[t].innerHTML.match(/\((\d+)\ssub-/))? parseInt(RegExp.$1):0;
this.stats.viewboard += (TD[t].innerHTML.match(/\s(\d+)\sViewing/))? parseInt(RegExp.$1):0;
if( TD[t+3].innerHTML.match(/<b>Today<\/b>/) )
this.stats.upboard ++;
}
if( TD[t].align == "left" && TD[t].width == "60%" && TD[t].innerHTML.match(/Total\sTopics/) )
{
this.stats.topics = parseInt( ( TD[t].innerHTML.split(/Total\sTopics:\s/)[1].split(/\s&nb/)[0]).replace(/,/g,'') );
this.stats.posts = parseInt( (TD[t].innerHTML.split(/Total\sPosts:\s/)[1].split(/<b/i)[0]).replace(/,/g,'') );
this.stats.members = TD[t+1].innerHTML.match(/Total\sMembers:\s<.+?>(\d+)<\//)? parseInt(RegExp.$1):0;
this.stats.lastpost = TD[t].innerHTML.split(/Updated\sTopic:\s/)[1].split(/<br/i)[0];
this.stats.newmember = TD[t+1].innerHTML.split(/Newest\sMember:\s/)[1].split(/<b/i)[0];
}
if( TD[t].className == "catbg" && TD[t].colSpan == "2" && TD[t].innerHTML.match(/Today's\sBir/) )
{
for( a = 0 ; a < TD[t+3].getElementsByTagName('a').length ; a ++ )
this.birthdays=TD[t+3].getElementsByTagName('a')[a];
}
if( TD[t].className == "catbg" && TD[t].colSpan == "2" && TD[t].innerHTML.match(/Events\sThis/) )
{
for( a = 0 ; a < TD[t+3].getElementsByTagName('a').length ; a ++ )
this.events= TD[t+3].getElementsByTagName('a')[a];
}
if( TD[t].vAlign == "top" && TD[t].align == "left" && TD[t].firstChild.size == "1" && TD[t].innerHTML.match(/(\d+)\sMember/))
{
this.onlinestats.staff = TD[t].innerHTML.match(/(\d+)\sStaff\sMember/)? parseInt(RegExp.$1) : 0;
this.onlinestats.members = TD[t].innerHTML.match(/(\d+)\sMember/)? parseInt(RegExp.$1):0;
this.onlinestats.guests = TD[t].innerHTML.match(/>?(\d+)\sGuest/)? parseInt(RegExp.$1):0;
this.onlinestats.total = Math.floor( this.onlinestats.staff + this.onlinestats.members + this.onlinestats.guests );
this.onlinestats.mostusers = TD[t].innerHTML.split(/Most\susers\sonline\swas\s/)[1].split(/<br/i)[0];
for( a = 0 ; a < TD[t].getElementsByTagName('a').length ; a ++ )
{
if( TD[t].getElementsByTagName('a')[a].href.match(/viewprofile/) )
this.online.push( TD[t].getElementsByTagName( 'a' )[a] )
}
}
}
}
}
if( this.location.href.match(/\.com(\/(index\.cgi(#\w+|\?(action=home)?)?)?)?$/)){
Infocenter.Assembledata();
}
totalPMs = (td.item(2).innerHTML.match(/have <(.+)>(.+?) message/i))? '<a href="index.cgi?action=pm">'+RegExp.$2+'</a>' : '<a href="index.cgi?action=login">?</a>';
newPMs = (td.item(2).innerHTML.match(/>, (.+) (are|is) new./i))? '<a href="index.cgi?action=pm">'+RegExp.$1+'</a>' : '<a href="index.cgi?action=login">?</a>';
for(t=0;t<td.length;t++){
if(td[t].className.match(/catbg/i) && td[t].innerHTML.match(/Users Online/i)){
var MembersOnline = td[t+2].innerHTML.split(/<br\s?\/?>/i)[1];
}
}
for(t=0;t<td.length;t++){
if(td[t].className.match(/windowbg/) && td[t].innerHTML.match(/(\d+) most recent/)){
var RecPosts=RegExp.$1
}
}
var td=document.getElementsByTagName('td');
XtremeIC='<table width="92%" cellpadding="4" cellspacing="1" align="center" class="bordercolor">';
XtremeIC+='<tr>';
XtremeIC+='<td class="titlebg" width="100%" colspan="2" align="center">';
XtremeIC+=ICtitle;
XtremeIC+='</td>';
XtremeIC+='</tr>';
XtremeIC+='<tr>';
XtremeIC+='<td width="50%" class="windowbg" vAlign="top" align="left">';
XtremeIC+='<div class="padding" style="padding: 4px">';
XtremeIC+='<div class="bPad" style="padding: 4px">';
XtremeIC+='<div class="iBox" style="padding: 4px">';
XtremeIC+='<b>Total PMs</b>: '+totalPMs+'<br />';
XtremeIC+='<b>New PMs</b>: '+newPMs+'<br />';
XtremeIC+='<b>Total Users In Boards</b>: '+Infocenter.stats.viewboard+'<br />';
XtremeIC+='<b>Total Users Online</b>: '+Infocenter.onlinestats.total;
XtremeIC+='</div>';
XtremeIC+='</div>';
XtremeIC+='</div>';
XtremeIC+='</td>';
XtremeIC+='<td width="50%" class="windowbg" vAlign="top" align="left">';
XtremeIC+='<div class="padding" style="padding: 4px">';
XtremeIC+='<div class="bPad" style="padding: 4px">';
XtremeIC+='<div class="iBox" style="padding: 4px">';
for(t=0;t<td.length;t++){
if(td[t].className.match(/catbg/i) && td[t].innerHTML.match(/Forum Statistics/i)){
var LastPost = (td[t+2].innerHTML.match(/Last Updated Topic: (.+?) by/i)) ? RegExp.$1: '';
var LastPostUser = (td[t+2].innerHTML.match(/by (.+?) \(/i)) ? RegExp.$1: '';
var LastPostDate = (td[t+2].innerHTML.match(/<\/a> \((.+?)\)<br\s?\/?>/i)) ? RegExp.$1: '';
}
}
XtremeIC+='<b>Last Post</b>: '+LastPost+'<br />';
XtremeIC+='<b>Made By</b>: '+LastPostUser+'<br />';
XtremeIC+='<b>Made On</b>: '+LastPostDate+'<br />';
XtremeIC+='<b>Newest Member</b>: '+Infocenter.stats.newmember;
XtremeIC+='</div>';
XtremeIC+='</div>';
XtremeIC+='</div>';
XtremeIC+='</td>';
XtremeIC+='</tr>';
XtremeIC+='<tr>';
XtremeIC+='<td width="100%" class="windowbg" vAlign="middle" align="center" colspan="2" height="25">';
XtremeIC+='<div class="padding" style="padding: 4px">';
XtremeIC+='<div class="bPad" style="padding: 4px">';
XtremeIC+='<div class="iBox" align="center" style="padding: 4px">';
XtremeIC+='<b>[-| <font size="1">Topics</b>: '+Infocenter.stats.topics+' | <b>Posts</b>: '+Infocenter.stats.posts+' | <b>Members</b>: '+Infocenter.stats.members+' | <b>Updated Boards</b>: '+Infocenter.stats.upboard+' | <b>Categories</b>: '+Infocenter.stats.categories+' | <b>Boards</b>: '+Infocenter.stats.boards+' </font><b>|-]</b>';
XtremeIC+='</div>';
XtremeIC+='</div>';
XtremeIC+='</div>';
XtremeIC+='</td>';
XtremeIC+='</tr>';
XtremeIC+='<tr>';
XtremeIC+='<td width="50%" class="windowbg" vAlign="middle" align="center" height="25">';
XtremeIC+='<div class="padding" style="padding: 4px">';
XtremeIC+='<div class="bPad" style="padding: 4px">';
XtremeIC+='<div class="iBox" style="padding: 4px">';
var Opened = new Date()
Opened.setDate(ForumAge[0]);
Opened.setMonth(ForumAge[1]-1);
Opened.setYear(ForumAge[2]);
var TheDateNow = new Date()
var days=TheDateNow-Opened
var Age=Math.floor(days/(60 * 60 * 24 * 1000));
XtremeIC+='Forum Age: '+Age+' Days';
XtremeIC+='</div>';
XtremeIC+='</div>';
XtremeIC+='</div>';
XtremeIC+='</td>';
XtremeIC+='<td width="50%" class="windowbg" vAlign="middle" align="center" height="25">';
XtremeIC+='<div class="padding" style="padding: 4px">';
XtremeIC+='<div class="bPad" style="padding: 4px">';
XtremeIC+='<div class="iBox" style="padding: 4px">';
if(MotMon=="yes"){
XtremeIC+='Member Of The Month: <a href="/index.cgi?action=viewprofile&user='+MotM[0]+'">'+MotM[1]+'</a>';
}
else
{
XtremeIC+='View the <a href="/index.cgi?action=recent">'+RecPosts+'</a> most recent posts';
}
XtremeIC+='</div>';
XtremeIC+='</div>';
XtremeIC+='</div>';
XtremeIC+='</td>';
XtremeIC+='</tr>';
XtremeIC+='</table>';
XtremeIC+='<table width="92%" cellpadding="4" cellspacing="1" align="center" class="bordercolor">';
XtremeIC+='<tr>';
XtremeIC+='<td class="titlebg" width="20%" colspan="1" align="center">';
XtremeIC+='<div id="slLinks">(Stats/<a href="javascript:void()" onclick="UOlegendBox()">Legend</a>)</div>';
XtremeIC+='</td>';
XtremeIC+='<td class="titlebg" width="80%" colspan="1" align="center">';
XtremeIC+=UOtitle;
XtremeIC+='</td>';
XtremeIC+='</tr>';
XtremeIC+='<tr>';
XtremeIC+='<td width="20%" class="windowbg" vAlign="middle" align="left">';
XtremeIC+='<div class="padding" style="padding: 4px">';
XtremeIC+='<div class="bPad" style="padding: 2px">';
XtremeIC+='<div class="uSbox" vAlign="middle" id="UOtBox">';
XUOstats='<div id="StaffHide">Staff: '+Infocenter.onlinestats.staff+'<br />';
XUOstats+='Members: '+Infocenter.onlinestats.members+'<br />';
if(pb_username=="admin"){
XUOstats+='Guests: <a href="javascript:popWindow(\'viewguests\')">'+Infocenter.onlinestats.guests+'</a></div>';
}
else{
XUOstats+='Guests: '+Infocenter.onlinestats.guests+'</div>';
}
XtremeIC+=XUOstats;
XtremeIC+='</div>';
XtremeIC+='</div>';
XtremeIC+='</div>';
XtremeIC+='</td>';
XtremeIC+='<td width="80%" class="windowbg" vAlign="top" align="left">';
XtremeIC+='<div class="padding" style="padding: 4px">';
XtremeIC+='<div class="bPad" style="padding: 4px">';
XtremeIC+='<div class="uBox" style="padding: 4px">';
if(pb_username=="Guest"){
XtremeIC+='Welcome to '+ForumName+'! Please <a href="/index.cgi?action=login">Login</a> or <a href="/index.cgi?action=register">Register</a>.';
}
else{
XtremeIC+='Most users ever online was '+Infocenter.onlinestats.mostusers;
}
XtremeIC+='</div>';
XtremeIC+='</div>';
XtremeIC+='</div>';
XtremeIC+='<div class="padding" style="padding: 4px">';
XtremeIC+='<div class="bPad" style="padding: 4px">';
XtremeIC+='<div class="uBox" style="padding: 4px">';
if(Infocenter.onlinestats.total==0){
XtremeIC+=ZeroOnline;
}
else{
XtremeIC+=MembersOnline;
}
XtremeIC+='</div>';
XtremeIC+='</div>';
XtremeIC+='</div>';
XtremeIC+='</td>';
XtremeIC+='</tr>';
XtremeIC+='</table>';
function UOstatsBox(){
Sbox=document.getElementById('UOtBox');
var slLinks=document.getElementById('slLinks');
Sbox.innerHTML=XUOstats;
slLinks.innerHTML='(Stats/<a href="javascript:void()" onclick="UOlegendBox()">Legend</a>)';
}
function UOlegendBox(){
var Sbox=document.getElementById('UOtBox');
var slLinks=document.getElementById('slLinks');
for(t=0;t<Staff.length;t++){
document.getElementById('StaffHide').style.display="none";
Sbox.innerHTML=Sbox.innerHTML.replace('zql79','');
Sbox.innerHTML+='<font color="'+Staff[t][1]+'">'+Staff[t][0]+'</font><br />';
slLinks.innerHTML='(<a href="javascript:void()" onclick="UOstatsBox()">Stats</a>/Legend)';
}
}
if( this.location.href.match(/\.com(\/(index\.cgi(#\w+|\?(action=home)?)?)?)?$/)){
var tablity=document.getElementsByTagName('table');
for(u=0;u<tablity.length;u++){
if(tablity[u].width=="100%" && tablity[u].innerHTML.match(/<b>Info Center/i) && tablity[u].cellPadding=="4"){
tablity[u].parentNode.innerHTML=XtremeIC;
}
}
for(v=0;v<td.length;v++){
if(td[v].innerHTML.match(/Forum Jump/) && td[v].align=="right"){
td[v].style.display="none";
}}
}
//-->
</script>