Please login or register. Welcome to the Studio, guest!


Quick Links:


newBookmarkLockedFalling

crazynarutard

crazynarutard Avatar

*****
Senior Studio Member

1,470


August 2005
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.push( TD[t+3].getElementsByTagName('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.push( TD[t+3].getElementsByTagName('a')
);
         }
         if( TD[t].vAlign == "top" && TD[t].align == "left" && TD[t].firstChild.size == "1" && TD[t].innerHTML.match(/(\d+)\sStaff\sMember/) )
         {;
            this.onlinestats.staff = parseInt(RegExp.$1);
            this.onlinestats.members = TD[t].innerHTML.match(/\s(\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')
.href.match(/viewprofile/) )
                  this.online.push( TD[t].getElementsByTagName('a')
);
            }
         }
      }
   }
}
if( this.location.href.match(/\.com(\/(index\.cgi(#\w+|\?(action=home)?)?)?)?$/))
   Infocenter.Assembledata();



All the info center information has been put into this object. Here is the list of all of them and how to access them.


Infocenter.stats.categories = total categories
Infocenter.stats.boards = total boards
Infocenter.stats.subboards = total sub boards
Infocenter.stats.upboard = total today updates boards
Infocenter.stats.viewboard = total viewing the boards
Infocenter.stats.topics = total topics
Infocenter.stats.posts = total posts
Infocenter.stats.members = total members
Infocenter.stats.lastpost = last post + date
Infocenter.stats.newmember = link to newest member
Infocenter.onlinestats.staff = total staff online
Infocenter.onlinestats.members = total members online
Infocenter.onlinestats.guests = total guests online
Infocenter.onlinestats.total = total online
Infocenter.onlinestats.mostusers = most users ever online info
Infocenter.birthdays = array of all birthdays
Infocenter.events = array of all events
Infocenter.online = array of users online


Left side is how to access the information on the right side


Last Edit: Dec 10, 2005 17:39:28 GMT by crazynarutard

Chris

Chris Avatar

******
Head Coder

19,519


June 2005
Very nice CJ. :P One suggestion (as I said over MSN), use an if-else when looping through the cells. It'll make it slightly faster.

---

2000th post.

newBookmarkLockedFalling