Merge branch 'develop' of github.com:RiV-chain/RiV-mesh into develop

This commit is contained in:
vadym 2022-12-21 12:37:40 +02:00
commit 5abaab26b7
3 changed files with 14 additions and 10 deletions

View file

@ -1,4 +1,5 @@
"use strict";
console.log("IE load fix");
var $ = function $(id) {
return document.getElementById(id);
@ -231,8 +232,9 @@ function togglePrivKeyVisibility() {
}
function humanReadableSpeed(speed) {
var i = speed == 0 ? 0 : Math.floor(Math.log(speed) / Math.log(1024));
return (speed / Math.pow(1024, i)).toFixed(2) * 1 + ' ' + ['Bps', 'kBps', 'MBps', 'GBps', 'TBps'][i];
if (speed < 0) return "? B/s";
var i = speed < 1 ? 0 : Math.floor(Math.log(speed) / Math.log(1024));
return (speed / Math.pow(1024, i)).toFixed(2) * 1 + ' ' + ['bps', 'kbps', 'Mbps', 'Gbps', 'Tbps'][i];
}
var ui = ui || {
@ -347,8 +349,8 @@ ui.updateSpeed = function (peers) {
ui._rsbytes = rsbytes;
} else {
delete ui._rsbytes;
$("dn_speed").innerText = "? Bs";
$("up_speed").innerText = "? Bs";
$("dn_speed").innerText = humanReadableSpeed(-1);
$("up_speed").innerText = humanReadableSpeed(-1);
}
};

View file

@ -225,8 +225,9 @@ function togglePrivKeyVisibility() {
}
function humanReadableSpeed(speed) {
var i = speed == 0 ? 0 : Math.floor(Math.log(speed) / Math.log(1024));
return (speed / Math.pow(1024, i)).toFixed(2) * 1 + ' ' + ['Bps', 'kBps', 'MBps', 'GBps', 'TBps'][i];
if (speed < 0) return "? B/s";
var i = speed < 1 ? 0 : Math.floor(Math.log(speed) / Math.log(1024));
return (speed / Math.pow(1024, i)).toFixed(2) * 1 + ' ' + ['bps', 'kbps', 'Mbps', 'Gbps', 'Tbps'][i];
}
var ui = ui || {
@ -327,8 +328,8 @@ ui.updateSpeed = peers => {
ui._rsbytes = rsbytes;
} else {
delete ui._rsbytes;
$("dn_speed").innerText = "? Bs";
$("up_speed").innerText = "? Bs";
$("dn_speed").innerText = humanReadableSpeed(-1);
$("up_speed").innerText = humanReadableSpeed(-1);
}
}