mirror of
https://github.com/qbittorrent/qBittorrent
synced 2025-08-20 13:23:34 -07:00
[Web UI] Fix friendlyUnit() implementation. Related to #2719
This commit is contained in:
parent
9f1bd86c47
commit
32ea862584
1 changed files with 9 additions and 2 deletions
|
@ -12,12 +12,19 @@ function friendlyUnit(value, isSpeed) {
|
|||
|
||||
if (value < 0)
|
||||
return "QBT_TR(Unknown)QBT_TR";
|
||||
|
||||
var i = 0;
|
||||
while (value >= 1024. && i++ < 6)
|
||||
while (value >= 1024. && i < 4) {
|
||||
value /= 1024.;
|
||||
++i;
|
||||
}
|
||||
var ret;
|
||||
if (i == 0)
|
||||
ret = value + " " + units[i];
|
||||
else
|
||||
ret = (Math.floor(10 * value) / 10).toFixed(1) //Don't round up
|
||||
+ " " + units[i];
|
||||
|
||||
if (isSpeed)
|
||||
ret += "QBT_TR(/s)QBT_TR";
|
||||
return ret;
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue