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; -}