Agent Moose
|
|
« on: November 07, 2008, 06:56:15 pm » |
|
Footers: <script> function Activity(){ $("td.titlebg:contains(Forum Stats)").parent().next().each(function(){ if(this.innerHTML.match(/(\d+) Posts/i)){ var bPosts = RegExp.$1 + RegExp.$2; $("tr").each(function(){ if(this.innerHTML.match(/(\d+) Posts/i)){ var fPosts = RegExp.$1; var Activity = Math.round(100 * fPosts / bPosts); $(this).find("td.windowbg[valign='middle'] span.smalltext").append("<br>" + Activity + "% Activity"); };});};});}; Activity(); </script> Here is the code alot of people wanted! The Activity Code, straight from the SMCodes Footers! There is one problem with it though. If you look at your board stats, find (number) Posts. If that number doesn't have a comma for you, it will work perfectly right when you put it on your forums, but, if you do have a comma, you will need to edit a part of the code. You will need to add ,(\d+) to the code in this line: if(this.innerHTML.match(/(\d+) Posts/i)){ Example, if you have 10,000 posts, that line of code would look like this: if(this.innerHTML.match(/(\d+),(\d+) Posts/i)){ There ya go, might be alittle comfusion for some of you, but you can try to get it Enjoy
|
|
|
|
|
Lyle
MeTube
Member
Offline
Gender:
Posts: 69
Badges: (View All)
|
|
« Reply #1 on: June 09, 2009, 07:35:08 am » |
|
would this work in Global Headers and Footers?
|
|
|
|
|
|
xboi209
|
|
« Reply #3 on: June 10, 2009, 04:33:23 pm » |
|
what does this code do?
|
|
|
|
Andrew
|
|
« Reply #4 on: June 10, 2009, 05:38:52 pm » |
|
It basically tells you how much activity there is for a certain board.
|
|
|
|
xboi209
|
|
« Reply #5 on: June 10, 2009, 05:54:13 pm » |
|
which board?I dont see any place to edit
|
|
|
|
Andrew
|
|
« Reply #6 on: June 10, 2009, 06:36:56 pm » |
|
It adds it for all boards. Ive used this one before, just got rid of it cause I went code crazy after adding it
|
|
|
|
Mojobojo82
MVP
Offline
Gender:
Posts: 838
Badges: (View All)
|
|
« Reply #7 on: June 13, 2009, 09:37:56 am » |
|
Lol! Andrew?? Thx for telling me what it does aswell... Great code Moose but it's useless for me And my name is Andrew too
|
|
|
|
Agent Moose
|
|
« Reply #8 on: June 13, 2009, 12:04:55 pm » |
|
Glad you like the code, even though your not using it
|
|
|
|
Mojobojo82
MVP
Offline
Gender:
Posts: 838
Badges: (View All)
|
|
« Reply #9 on: June 14, 2009, 02:01:58 am » |
|
Don't take me wrong it's a good code but just no need to use it with my forum
|
|
|
|
slayer766
PHP > JS
Member
Offline
Posts: 147
Badges: (View All)
|
|
« Reply #10 on: October 18, 2009, 06:33:53 pm » |
|
Moose, why don't you just split out the commas in the RegEx?
|
|
|
|
Exilis
Optimistic & Creative
Global Moderator
Offline
Posts: 929
Badges: (View All)
|
|
« Reply #11 on: October 18, 2009, 08:04:39 pm » |
|
I wondered that too XD
|
|
|
|
Agent Moose
|
|
« Reply #12 on: October 18, 2009, 10:00:44 pm » |
|
heh, never thought of that. Back when I wrote this code, I didn't know how to use the split/join functions I haven't messed with a code in awhile, lets hope I can still do it xD EDIT: Yep, totally didn't work right: <script type="text/javascript"> var bPosts = "", fPosts = ""; $("td.titlebg:contains(Forum Stats)").parent().next().each(function(){ if(this.innerHTML.match(/(\d+) Posts/i)){ if(RegExp.$1.match(/,/i)){ bPosts = RegExp.$1.split(",").join(""); }else{ bPosts = RegExp.$1; } $("tr").each(function(){ if(this.innerHTML.match(/(\d+) Posts/i)){ if(RegExp.$1.match(/,/i)){ fPosts = RegExp.$1.split(",").join(""); }else{ fPosts = RegExp.$1; } var Activity = Math.round(100 * fPosts / bPosts); $(this).find("td.windowbg[valign='middle'] span.smalltext").append("<br>" + Activity + "% Activity"); };});};}); </script>
|
|
« Last Edit: October 18, 2009, 10:14:50 pm by Agent Moose »
|
Report Spam
Logged
|
|
|
|
|
|