|
This code can be useful for making info center hacks. Each one of these loops grab a certain info from the info center. You can use innerHTML to replace this info in the info center. <script type="text/javascript"> var td = document.getElementsByTagName('td');
//Total Topics for(t=0;t<td.length;t++){ if(td[t].className.match(/catbg/i) && td[t].innerHTML.match(/Forum Statistics/i)){ var totalTopics = (td[t+2].innerHTML.match(/Total Topics: (\d+)(,\d+)? &/i)) ? RegExp.$1+RegExp.$2: ''; }}
//Total Posts for(t=0;t<td.length;t++){ if(td[t].className.match(/catbg/i) && td[t].innerHTML.match(/Forum Statistics/i)){ var totalPosts = (td[t+2].innerHTML.match(/Total Posts: (\d+)(,\d+)?<br/i)) ? RegExp.$1+RegExp.$2: ''; }}
//Last Post for(h=0;h<td.length;h++){ if(td[h].align=="left" && td[h].vAlign=="top" && td[h].width=="60%" && td[h].innerHTML.match(/Total Topics:/)){ var splitLPost = td[h].innerHTML.split("Last Updated Topic: ")[1]; var splitLPost2 = splitLPost.split("<br>")[0]; var lastPost = splitLPost2.split("\(")[0]; }}
//Total Members for(t=0;t<td.length;t++){ if(td[t].className.match(/catbg/i) && td[t].innerHTML.match(/Forum Statistics/i)){ var totalMembers = (td[t+2].innerHTML.match(/Total Members: (.+?)<br/i)) ? RegExp.$1:''; var newMember = (td[t+2].innerHTML.match(/Newest Member: (.+?)<\/a>/i)) ? RegExp.$1:''; }}
//Newest Member for(t=0;t<td.length;t++){ if(td[t].className.match(/catbg/i) && td[t].innerHTML.match(/Forum Statistics/i)){ var newMember = (td[t+2].innerHTML.match(/Newest Member: (.+?)<\/a>/i)) ? RegExp.$1: ''; }}
//Users Online for(t=0;t<td.length;t++){ if(td[t].className.match(/catbg/i) && td[t].innerHTML.match(/Users Online/i)){ var SusersOn = td[t+2].innerHTML.split(/<br>/i)[1]; var usersOn = SusersOn.split(/<\/td>/i)[0]; var membersOn = (td[t+2].innerHTML.match(/(\d+) Member/i)) ? RegExp.$1: ''; var guestsOn = (td[t+2].innerHTML.match(/(\d+) Guest/i)) ? RegExp.$1: ''; var staffOn = (td[t+2].innerHTML.match(/(\d+) Staff/i)) ? RegExp.$1: ''; }} </script>Well I was making an info center code for nooki and I had some problems so hey helped out quite a bit. VariablestotalTopics - total topics totalPosts - total posts totalMembers - total members newMember - newest member lastPost - last post membersOn - # of members online guestsOn - # of guests online StaffOn - # of staff online usersOn - list of users online
Last Edit: Mar 12, 2006 23:52:59 GMT by hpmad
|
|
|
|
good job hp_mad
|
|
|
|
good job hp_mad I never thought you would say that.
|
|
|
|
Could be a lot simpler, but good job.
|
|
|
|
|
Well, don't those variables look familiar? I gave you and nooki those for an info center. There technically not yours.
Last Edit: Nov 6, 2005 4:19:50 GMT by hey
|
forums.talesrpg.com
|
|
|
|
I said that you helped me but if you really want to, I can take it out.
Last Edit: Nov 6, 2005 4:30:52 GMT by hpmad
|
|
|
|
Well, don't those variables look familiar? I gave you and nooki those for an info center. There technically not yours. They're*
|
|
|
|
I said that you helped me but if you really want to, I can take it out. Oops, didn't read that line. Never mind then.
|
forums.talesrpg.com
|
|
|
|
I said that you helped me but if you really want to, I can take it out. Oops, didn't read that line. Never mind then. lol That's okay
|
|
|
|
I have some updated variables: var lastPost = (innerHTML.match(/Last Updated Topic: (.+?)<br\s?\/?>/i)) ? RegExp.$1: 'n/a'; lastPost = lastPost.replace('\(','\(').replace('\)','\)').replace('\'','\''); This will grab the last post line and will allow paranthesis and apostrophes in topic names.
var usersOn = innerHTML.split(/<br\s?\/?>/i)[1].replace('\'','\''); Those will make it so users with apostrophes in their names are still able to show up in the info center.
Last Edit: Nov 12, 2005 21:03:00 GMT by hey
|
forums.talesrpg.com
|
|
|
|
Just what I needed! To code the Apollo Information Centre! I'll use those variables indefinately...but I won't start the coding until the test is over...or even so, I might not code at all..
|
|
|
|