mirror of
https://github.com/d47081/qBittorrent.git
synced 2025-01-11 07:18:08 +00:00
[Web UI] Fix friendlyUnit() implementation. Related to #2719
This commit is contained in:
parent
2132704e1d
commit
e33570625f
@ -12,12 +12,19 @@ function friendlyUnit(value, isSpeed) {
|
|||||||
|
|
||||||
if (value < 0)
|
if (value < 0)
|
||||||
return "QBT_TR(Unknown)QBT_TR";
|
return "QBT_TR(Unknown)QBT_TR";
|
||||||
|
|
||||||
var i = 0;
|
var i = 0;
|
||||||
while (value >= 1024. && i++ < 6)
|
while (value >= 1024. && i < 4) {
|
||||||
value /= 1024.;
|
value /= 1024.;
|
||||||
|
++i;
|
||||||
|
}
|
||||||
var ret;
|
var ret;
|
||||||
ret = (Math.floor(10 * value) / 10).toFixed(1) //Don't round up
|
if (i == 0)
|
||||||
|
ret = value + " " + units[i];
|
||||||
|
else
|
||||||
|
ret = (Math.floor(10 * value) / 10).toFixed(1) //Don't round up
|
||||||
+ " " + units[i];
|
+ " " + units[i];
|
||||||
|
|
||||||
if (isSpeed)
|
if (isSpeed)
|
||||||
ret += "QBT_TR(/s)QBT_TR";
|
ret += "QBT_TR(/s)QBT_TR";
|
||||||
return ret;
|
return ret;
|
||||||
|
Loading…
Reference in New Issue
Block a user