Created
January 8, 2012 09:31
-
-
Save XP1/1577840 to your computer and use it in GitHub Desktop.
Enhance DD-WRT: Uses bytes as the default unit for the realtime graphs on DD-WRT's bandwidth status webpage.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// ==UserScript== | |
// @name Enhance DD-WRT | |
// @version 1.01 | |
// @description Uses bytes as the default unit for the realtime graphs on DD-WRT's bandwidth status webpage. | |
// @author XP1 (https://github.com/XP1/) | |
// @namespace https://gist.github.com/1577840/ | |
// @include http*://192.168.*.*/graph_if.svg?* | |
// ==/UserScript== | |
/*jslint browser: true, vars: true, white: true, maxerr: 50, indent: 4 */ | |
(function (window) | |
{ | |
"use strict"; | |
function removeEventListenerAfterFiring(numberOfTimes, callback) | |
{ | |
var remaining = numberOfTimes; | |
return function listener(event) | |
{ | |
remaining -= 1; | |
if (remaining <= 0) | |
{ | |
var target = event.target; | |
var type = event.type; | |
target.removeEventListener(type, listener, false); | |
target.removeEventListener(type, listener, true); | |
} | |
callback(); | |
}; | |
} | |
function switchToBytes() | |
{ | |
window.unit = "bits"; | |
} | |
window.addEventListener("DOMContentLoaded", removeEventListenerAfterFiring(1, switchToBytes), false); | |
}(this)); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
I posted this user JS in this thread:
Bytes by default for the realtime graphs on bandwidth status:
http://www.dd-wrt.com/phpBB2/viewtopic.php?t=149372