View previous topic :: View next topic |
Author |
Message |
webzn -
Joined: 01 Apr 2003 Posts: 27 Location: Canada
|
Posted: Thu Aug 05, 2004 4:13 pm Post subject: MOD: Bandwidth Meter |
|
|
Here is a little mod I wrote. If you would like to replace that boring Output (KB) with a meter that can display your bandwidth in a nice looking bar, or would you like to turn the kB into MB. Now you can....
Turn KB into MB...
//Abyss Server Control Panel Hack (C) Carl (Neogenisis.net)
// Files to edit: stats.chl
//Open /chl/stats.chl
Find:
Replace with...
Code: |
<script>
var stata = parseFloat(^@StatOutputKb^) / parseFloat(1024);
document.write(stata);
</script> MB
|
Find: Code: | <TD ALIGN="RIGHT"><b>Output (KB)</b>: |
Replace with...
Code: | <TD ALIGN="RIGHT"><b>Output (MB)</b>: |
Turn KB into Meter...
//Abyss Server Control Panel Hack (C) Carl (Neogenisis.net)
// Files to edit: stats.chl
//Open chl/stats.chl
Find:
Replace with...
Code: |
<table cellpadding=0 cellspacing=0 height=18 width=100 border=1>
<script>
var max = 10; //Change this to your maximum MB
var stata = parseFloat(^@StatOutputKb^) / parseFloat(1024);
statb = parseFloat(parseFloat(stata) / parseFloat(max)) ;
statc = parseFloat(statb) * parseFloat(100);
document.write("<tr><td bgcolor=#000066 width=");
document.write(statc);
</script>
%></td><td></td></tr>
</table> |
Find: Code: | <TD ALIGN="RIGHT"><b>Output (KB)</b>: |
Replace with...
Code: | <TD ALIGN="RIGHT"><b>Bandwidth</b>: |
Last edited by webzn on Tue Aug 10, 2004 5:40 pm; edited 1 time in total |
|
Back to top |
|
|
Nick889 -
Joined: 24 Jul 2004 Posts: 4
|
Posted: Tue Aug 10, 2004 4:27 pm Post subject: Re: MOD: Bandwidth Meter |
|
|
webzn wrote: |
//Open /chl/stats.chl
Find:
Replace with...
Code: |
<script>
var stata = parseFloat(^@StatOutputKb^) / parseFloat(1024);
document.write(statc);
</script> MB
|
|
small spelling mistake but it does mean the difference between this working and not...
document.write(statc);
is actually...
document.write(stata);
Just a simple mistype. I knew you ment to put that. Very nice script though, very nice. Using it on my server now! Another small thing.. is it possible to delete the trailing numbers after the megabytes?
I am getting like...
Output (MB): 87.3291015625
that on my server and I would like to get rid of the trailing numbers after the 87. |
|
Back to top |
|
|
webzn -
Joined: 01 Apr 2003 Posts: 27 Location: Canada
|
Posted: Tue Aug 10, 2004 5:47 pm Post subject: |
|
|
Thanks for pointing that out. I guess I hit the wrong button there. Too bad we can't use php in the chl files or else this would be a lot easier
As for the trailing decimals, use this code....
//Open /chl/stats.chl
Find:
Replace with...
Code: |
<script>
var stats = parseFloat(^@StatOutputKb^) / parseFloat(1024);
//document.write(stats);
var stata = Math.round(stats);
document.write(stata);
</script> MB
|
For my next major project, I want to make a full skin for the console. |
|
Back to top |
|
|
Nick889 -
Joined: 24 Jul 2004 Posts: 4
|
Posted: Wed Aug 11, 2004 7:27 am Post subject: |
|
|
$20 bucks says this isnt your fault and there isnt much you can do about it... but if you have sent less than 1 meg of data than the bandwidth meter is always 50% full no matter what until you send atleast 1 meg.
I even tried altering the script to read and calculate it by kilobytes instead of megabytes and even with that alteration, the bandwidth meter refuses to show kilobytes for some strange reason.
Thats ok... most of the time users will have sent more than 1 meg of data and who really needs a meter for such low numbers anyway.
Still a great script! 9/10 |
|
Back to top |
|
|
blast1102 -
Joined: 27 May 2004 Posts: 6 Location: England
|
Posted: Wed Aug 11, 2004 12:35 pm Post subject: |
|
|
Great code, I enjoyed playing with it.
I added Code: | <TR>
<TD ALIGN="RIGHT"><b>Output (Kb)</b>:
</TD>
<TD>
^@StatOutputKb^
</TD>
</TR>
<TR> |
3 times then left the first as kb and changed the second to MB then the third to a meter.
Ps Nick889 I did not have the 50% bar below 1M problem. _________________ Tom |
|
Back to top |
|
|
webzn -
Joined: 01 Apr 2003 Posts: 27 Location: Canada
|
Posted: Wed Aug 11, 2004 7:27 pm Post subject: |
|
|
That problem seems to vary between each browser. Its odd but if you are willing to live with it, it shouldn't be a problem. I'll keep tinkering as well. |
|
Back to top |
|
|
Xijar -
Joined: 10 Nov 2004 Posts: 3
|
Posted: Wed Nov 10, 2004 9:41 am Post subject: Eh |
|
|
So this meters a the whole server not just a certain folder, if I can meter a certain folder only. I need it right away C_C |
|
Back to top |
|
|
webzn -
Joined: 01 Apr 2003 Posts: 27 Location: Canada
|
Posted: Sat Nov 13, 2004 6:01 pm Post subject: |
|
|
Its just a cosmetic change. I can't meter a folder with this script _________________ Carl (Webzn)
http://Neogenisis.net |
|
Back to top |
|
|
|