mirror of
https://github.com/9001/copyparty.git
synced 2025-08-17 09:02:15 -06:00
ui: improve some eta/idle fields
cpanel db-idle-time indicator would glitch on 0.0s upload windowtitle was %.2f seconds, but the value is int
This commit is contained in:
parent
73f7249c5f
commit
01a3eb29cb
|
@ -695,8 +695,9 @@ function Donut(uc, st) {
|
||||||
}
|
}
|
||||||
|
|
||||||
if (++r.tc >= 10) {
|
if (++r.tc >= 10) {
|
||||||
|
var s = r.eta === null ? 'paused' : r.eta > 60 ? shumantime(r.eta) : (r.eta + 's');
|
||||||
wintitle("{0}%, {1}, #{2}, ".format(
|
wintitle("{0}%, {1}, #{2}, ".format(
|
||||||
f2f(v * 100 / t, 1), shumantime(r.eta), st.files.length - st.nfile.upload), true);
|
f2f(v * 100 / t, 1), s, st.files.length - st.nfile.upload), true);
|
||||||
r.tc = 0;
|
r.tc = 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -886,8 +886,11 @@ if (window.Number && Number.isFinite)
|
||||||
|
|
||||||
function f2f(val, nd) {
|
function f2f(val, nd) {
|
||||||
// 10.toFixed(1) returns 10.00 for certain values of 10
|
// 10.toFixed(1) returns 10.00 for certain values of 10
|
||||||
if (!isNum(val))
|
if (!isNum(val)) {
|
||||||
val = 999;
|
val = parseFloat(val);
|
||||||
|
if (!isNum(val))
|
||||||
|
val = 999;
|
||||||
|
}
|
||||||
val = (val * Math.pow(10, nd)).toFixed(0).split('.')[0];
|
val = (val * Math.pow(10, nd)).toFixed(0).split('.')[0];
|
||||||
return nd ? (val.slice(0, -nd) || '0') + '.' + val.slice(-nd) : val;
|
return nd ? (val.slice(0, -nd) || '0') + '.' + val.slice(-nd) : val;
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in a new issue