From e013d79e6e487eca9ad07d699df96aef53c2b2b4 Mon Sep 17 00:00:00 2001 From: iou1name Date: Sat, 16 Feb 2019 15:31:44 -0500 Subject: [PATCH] realized i don't need JS speedrate() --- static/aberrant.js | 16 +--------------- 1 file changed, 1 insertion(+), 15 deletions(-) diff --git a/static/aberrant.js b/static/aberrant.js index 487a824..832dacb 100644 --- a/static/aberrant.js +++ b/static/aberrant.js @@ -11,24 +11,10 @@ function get_active_torrents() { torrents = JSON.parse(httpRequest.responseText); let html_str = ''; for (let i = 0; i < torrents.length; i++) { - html_str += '' + torrents[i].name + '' + torrents[i].state + '' + speedrate(torrents[i].downrate) + '' + speedrate(torrents[i].uprate) + '' + torrents[i].tracker + ""; + html_str += '' + torrents[i].name + '' + torrents[i].state + '' + torrents[i].downrate_str + '' + torrents[i].uprate_str + '' + torrents[i].tracker + ""; } document.getElementById('torrents').children[1].innerHTML = html_str; }; httpRequest.open('GET', get_torrents_uri, true); httpRequest.send(); } - -function speedrate(rate) { - let unit = 'B/s'; - if (rate > 1024) { - rate /= 1024; - unit = 'KiB/s'; - } - if (rate > 1024) { - rate /= 1024; - unit = 'MiB/s'; - } - rate = Math.round(rate*10)/10; // different from Python's round() - return rate + unit; -}