mirror of
https://github.com/qbittorrent/qBittorrent
synced 2025-07-30 11:38:50 -07:00
Merge pull request #6751 from thalieht/webuiUnitPrecision
WebUI: Increase the number of digits after the decimal point
This commit is contained in:
commit
d80abeb10f
1 changed files with 8 additions and 1 deletions
|
@ -20,11 +20,18 @@ function friendlyUnit(value, isSpeed) {
|
|||
value /= 1024.;
|
||||
++i;
|
||||
}
|
||||
|
||||
function friendlyUnitPrecision(sizeUnit) {
|
||||
if (sizeUnit <= 2) return 1; // KiB, MiB
|
||||
else if (sizeUnit === 3) return 2; // GiB
|
||||
else return 3; // TiB, PiB, EiB
|
||||
}
|
||||
|
||||
var ret;
|
||||
if (i == 0)
|
||||
ret = value + " " + units[i];
|
||||
else
|
||||
ret = (Math.floor(10 * value) / 10).toFixed(1) //Don't round up
|
||||
ret = (Math.floor(10 * value) / 10).toFixed(friendlyUnitPrecision(i)) //Don't round up
|
||||
+ " " + units[i];
|
||||
|
||||
if (isSpeed)
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue