mirror of
https://github.com/yggdrasil-network/yggdrasil-go.git
synced 2025-08-25 08:25:07 +03:00
RIVM-16
This commit is contained in:
parent
3903fb6113
commit
4042cf3118
2 changed files with 10 additions and 8 deletions
|
@ -232,8 +232,9 @@ function togglePrivKeyVisibility() {
|
||||||
}
|
}
|
||||||
|
|
||||||
function humanReadableSpeed(speed) {
|
function humanReadableSpeed(speed) {
|
||||||
var i = speed == 0 ? 0 : Math.floor(Math.log(speed) / Math.log(1024));
|
if (speed < 0) return "? B/s";
|
||||||
return (speed / Math.pow(1024, i)).toFixed(2) * 1 + ' ' + ['Bps', 'kBps', 'MBps', 'GBps', 'TBps'][i];
|
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 || {
|
var ui = ui || {
|
||||||
|
@ -348,8 +349,8 @@ ui.updateSpeed = function (peers) {
|
||||||
ui._rsbytes = rsbytes;
|
ui._rsbytes = rsbytes;
|
||||||
} else {
|
} else {
|
||||||
delete ui._rsbytes;
|
delete ui._rsbytes;
|
||||||
$("dn_speed").innerText = "? Bs";
|
$("dn_speed").innerText = humanReadableSpeed(-1);
|
||||||
$("up_speed").innerText = "? Bs";
|
$("up_speed").innerText = humanReadableSpeed(-1);
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
|
@ -225,8 +225,9 @@ function togglePrivKeyVisibility() {
|
||||||
}
|
}
|
||||||
|
|
||||||
function humanReadableSpeed(speed) {
|
function humanReadableSpeed(speed) {
|
||||||
var i = speed == 0 ? 0 : Math.floor(Math.log(speed) / Math.log(1024));
|
if (speed < 0) return "? B/s";
|
||||||
return (speed / Math.pow(1024, i)).toFixed(2) * 1 + ' ' + ['Bps', 'kBps', 'MBps', 'GBps', 'TBps'][i];
|
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 || {
|
var ui = ui || {
|
||||||
|
@ -327,8 +328,8 @@ ui.updateSpeed = peers => {
|
||||||
ui._rsbytes = rsbytes;
|
ui._rsbytes = rsbytes;
|
||||||
} else {
|
} else {
|
||||||
delete ui._rsbytes;
|
delete ui._rsbytes;
|
||||||
$("dn_speed").innerText = "? Bs";
|
$("dn_speed").innerText = humanReadableSpeed(-1);
|
||||||
$("up_speed").innerText = "? Bs";
|
$("up_speed").innerText = humanReadableSpeed(-1);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue