diff options
author | Jelle van der Waa <jelle@vdwaa.nl> | 2018-08-11 19:40:06 +0200 |
---|---|---|
committer | Jelle van der Waa <jelle@vdwaa.nl> | 2018-11-18 22:49:25 +0100 |
commit | 6451de66862b843742d1c712a150ea8aa49aec0d (patch) | |
tree | 1fc77a7db085336f8be3bf4dcc2cc2928ca379f5 /sitestatic | |
parent | afff4eea77a64f53a9bd1138b2724a431a0ea457 (diff) | |
download | archweb-6451de66862b843742d1c712a150ea8aa49aec0d.tar.gz archweb-6451de66862b843742d1c712a150ea8aa49aec0d.zip |
Move format_filesize to the visualize.js
The only user of format_filesize is visualize.js, move the code there to
reduce archewb.js which is loaded on multiple pages.
Diffstat (limited to 'sitestatic')
-rw-r--r-- | sitestatic/archweb.js | 17 |
1 files changed, 0 insertions, 17 deletions
diff --git a/sitestatic/archweb.js b/sitestatic/archweb.js index ffdd30e6..b8ad6817 100644 --- a/sitestatic/archweb.js +++ b/sitestatic/archweb.js @@ -474,23 +474,6 @@ function collapseNotes(elements) { }); } -/* visualizations */ -function format_filesize(size, decimals) { - /*var labels = ['B', 'KiB', 'MiB', 'GiB', 'TiB', 'PiB', 'EiB', 'ZiB', 'YiB'];*/ - var labels = ['B', 'KB', 'MB', 'GB', 'TB', 'PB', 'EB', 'ZB', 'YB'], - label = 0; - - while (size > 2048.0 && label < labels.length - 1) { - label++; - size /= 1024.0; - } - if (decimals === undefined) { - decimals = 2; - } - - return size.toFixed(decimals) + ' ' + labels[label]; -} - /* HTML5 input type and attribute enhancements */ function modify_attributes(to_change) { /* jQuery doesn't let us change the 'type' attribute directly due to IE |