Skip to content

Instantly share code, notes, and snippets.

@XP1
Created January 8, 2012 09:31
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save XP1/1577840 to your computer and use it in GitHub Desktop.
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.
// ==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));
@XP1
Copy link
Author

XP1 commented Jan 8, 2012

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

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment