Danny Full Member
Posts: 180 Status: Offline Gender: Male Location: Durham Age: 33 Joined:
pmmsnxfire | Average Posts Per Member in Info Center (31st Dec 07 at 2:12am UTC) | | Main Footer
Preview:
This adds the average posts per member into the info center
Code: - <script type="text/javascript">
- <!--
- /*Average Posts Per Member in Info Center by Danny*/
-
- var getID = document.getElementById("info_center_stats");
- var posts = getID.innerHTML.match(/Posts:s(.+?)<br ?/?>/i) ? RegExp.$1.replace(/,/,''): ''1
- var members = getID.innerHTML.match(/Members:s(.+?)<br ?/?>/i) ? RegExp.$1.replace(/,/,''): ''
-
- getID.innerHTML += 'Posts Per Member: ' + (posts/members);
-
- //-->
- </script>
| |
|
|
Michael Moderator
Recoding the future Posts: 4,043 Status: Offline Gender: Male Location: UK Joined:
Additional Groups: Coding Team
pmvForum | Re: Average Posts Per Member in Info Center (31st Dec 07 at 2:13am UTC) | | I would suggest you do the following:
replace the commas (,) in the numbers, and parse the number (result)
once you have done those, your code will be added! | |
|
Danny Full Member
Posts: 180 Status: Offline Gender: Male Location: Durham Age: 33 Joined:
pmmsnxfire | Re: Average Posts Per Member in Info Center (31st Dec 07 at 3:10am UTC) | | I think ive done what you want | |
|
|
Michael Moderator
Recoding the future Posts: 4,043 Status: Offline Gender: Male Location: UK Joined:
Additional Groups: Coding Team
pmvForum | Re: Average Posts Per Member in Info Center (31st Dec 07 at 9:41am UTC) | | no...
var members = getID.innerHTML.match(/Members:\s(.+?)<br ?\/?>/i) ? RegExp.$1.replace(/,/,''): ''
that's it!
now alter the other one | |
|
Danny Full Member
Posts: 180 Status: Offline Gender: Male Location: Durham Age: 33 Joined:
pmmsnxfire | Re: Average Posts Per Member in Info Center (31st Dec 07 at 11:34am UTC) | | cr0w told me to put that and that the second one was unneeded | |
|
|
Michael Moderator
Recoding the future Posts: 4,043 Status: Offline Gender: Male Location: UK Joined:
Additional Groups: Coding Team
pmvForum | Re: Average Posts Per Member in Info Center (31st Dec 07 at 11:46am UTC) | | did he? I wouldn't have put it... oh well!
| |
|
Danny Full Member
Posts: 180 Status: Offline Gender: Male Location: Durham Age: 33 Joined:
pmmsnxfire | Re: Average Posts Per Member in Info Center (31st Dec 07 at 11:47am UTC) | | either way it still works so meh | |
|
|
Michael Moderator
Recoding the future Posts: 4,043 Status: Offline Gender: Male Location: UK Joined:
Additional Groups: Coding Team
pmvForum | Re: Average Posts Per Member in Info Center (31st Dec 07 at 11:52am UTC) | | ok I'll add this later if cr0w hasn't already! | |
|
Marc vChat Developer
I <3 Rossy
Posts: 3,388 Status: Offline Gender: Male Location: Ontario, Canada Age: 32 Joined:
Additional Groups: Coding Team
pmwww | Re: Average Posts Per Member in Info Center (31st Dec 07 at 3:55pm UTC) | | ok I'll add this later if cr0w hasn't already!
parseInt() is rarely needed. The only real time it's needed is if you're adding, as older browsers may think you're trying to combine two strings. | |
rroll.to— Shorten a link, rickroll your friends. |
|
Michael Moderator
Recoding the future Posts: 4,043 Status: Offline Gender: Male Location: UK Joined:
Additional Groups: Coding Team
pmvForum | Re: Average Posts Per Member in Info Center (31st Dec 07 at 3:57pm UTC) | | ya, I forgot he was dividing!
So yeah, it can be ignored !;) | |
|
Marc vChat Developer
I <3 Rossy
Posts: 3,388 Status: Offline Gender: Male Location: Ontario, Canada Age: 32 Joined:
Additional Groups: Coding Team
pmwww | Re: Average Posts Per Member in Info Center (31st Dec 07 at 4:01pm UTC) | | Hmm, actually Danny, the RegExp.$1 isn't needed; you should leave it as this:
var members = getID.innerHTML.match(/Members:\s(.+?)<br ?\/?>/i) ? RegExp.$1.replace(/,/,''): ''
That's why it's not smart to ask me these things at 1am. | |
rroll.to— Shorten a link, rickroll your friends. |
|
Michael Moderator
Recoding the future Posts: 4,043 Status: Offline Gender: Male Location: UK Joined:
Additional Groups: Coding Team
pmvForum | Re: Average Posts Per Member in Info Center (31st Dec 07 at 4:02pm UTC) | | +1 to Wrighty!
(but Cr0w is still winning! ) | |
|
Marc vChat Developer
I <3 Rossy
Posts: 3,388 Status: Offline Gender: Male Location: Ontario, Canada Age: 32 Joined:
Additional Groups: Coding Team
pmwww | Re: Average Posts Per Member in Info Center (31st Dec 07 at 4:12pm UTC) | | +1 to Wrighty! (but Cr0w is still winning! )
| |
rroll.to— Shorten a link, rickroll your friends. |
|