mirror of
https://github.com/9001/copyparty.git
synced 2025-08-17 17:12:13 -06:00
simplify/improve up2k ui debounce
This commit is contained in:
parent
315bd71adf
commit
7e82aaf843
|
@ -1666,8 +1666,6 @@ html.light #bbox-overlay figcaption a {
|
||||||
|
|
||||||
#op_up2k {
|
#op_up2k {
|
||||||
padding: 0 1em 1em 1em;
|
padding: 0 1em 1em 1em;
|
||||||
min-height: 0;
|
|
||||||
transition: min-height .2s;
|
|
||||||
}
|
}
|
||||||
#drops {
|
#drops {
|
||||||
display: none;
|
display: none;
|
||||||
|
@ -1832,13 +1830,17 @@ html.light #u2err.err {
|
||||||
#u2notbtn * {
|
#u2notbtn * {
|
||||||
line-height: 1.3em;
|
line-height: 1.3em;
|
||||||
}
|
}
|
||||||
|
#u2tabw {
|
||||||
|
min-height: 0;
|
||||||
|
transition: min-height .2s;
|
||||||
|
margin: 3em auto;
|
||||||
|
}
|
||||||
#u2tab {
|
#u2tab {
|
||||||
border-collapse: collapse;
|
border-collapse: collapse;
|
||||||
margin: 3em auto;
|
|
||||||
width: calc(100% - 2em);
|
width: calc(100% - 2em);
|
||||||
max-width: 100em;
|
max-width: 100em;
|
||||||
}
|
}
|
||||||
#op_up2k.srch #u2tab {
|
#op_up2k.srch #u2tabf {
|
||||||
max-width: none;
|
max-width: none;
|
||||||
}
|
}
|
||||||
#u2tab td {
|
#u2tab td {
|
||||||
|
|
|
@ -117,7 +117,7 @@ ebi('op_up2k').innerHTML = (
|
||||||
|
|
||||||
'</div>\n' +
|
'</div>\n' +
|
||||||
|
|
||||||
'<table id="u2tab">\n' +
|
'<div id="u2tabw"><table id="u2tab">\n' +
|
||||||
' <thead>\n' +
|
' <thead>\n' +
|
||||||
' <tr>\n' +
|
' <tr>\n' +
|
||||||
' <td>filename</td>\n' +
|
' <td>filename</td>\n' +
|
||||||
|
@ -126,7 +126,7 @@ ebi('op_up2k').innerHTML = (
|
||||||
' </tr>\n' +
|
' </tr>\n' +
|
||||||
' </thead>\n' +
|
' </thead>\n' +
|
||||||
' <tbody></tbody>\n' +
|
' <tbody></tbody>\n' +
|
||||||
'</table>\n' +
|
'</table></div>\n' +
|
||||||
|
|
||||||
'<p id="u2flagblock"><b>the files were added to the queue</b><br />however there is a busy up2k in another browser tab,<br />so waiting for that to finish first</p>\n' +
|
'<p id="u2flagblock"><b>the files were added to the queue</b><br />however there is a busy up2k in another browser tab,<br />so waiting for that to finish first</p>\n' +
|
||||||
'<p id="u2foot"></p>\n' +
|
'<p id="u2foot"></p>\n' +
|
||||||
|
|
|
@ -1069,7 +1069,7 @@ function up2k_init(subtle) {
|
||||||
}
|
}
|
||||||
more_one_file();
|
more_one_file();
|
||||||
|
|
||||||
var etaref = 0, etaskip = 0, op_minh = 0;
|
var etaref = 0, etaskip = 0, utw_minh = 0;
|
||||||
function etafun() {
|
function etafun() {
|
||||||
var nhash = st.busy.head.length + st.busy.hash.length + st.todo.head.length + st.todo.hash.length,
|
var nhash = st.busy.head.length + st.busy.hash.length + st.todo.head.length + st.todo.hash.length,
|
||||||
nsend = st.busy.upload.length + st.todo.upload.length,
|
nsend = st.busy.upload.length + st.todo.upload.length,
|
||||||
|
@ -1082,13 +1082,10 @@ function up2k_init(subtle) {
|
||||||
|
|
||||||
//ebi('acc_info').innerHTML = humantime(st.time.busy) + ' ' + f2f(now / 1000, 1);
|
//ebi('acc_info').innerHTML = humantime(st.time.busy) + ' ' + f2f(now / 1000, 1);
|
||||||
|
|
||||||
var op = ebi('op_up2k'),
|
var minh = QS('#op_up2k.act') && st.is_busy ? Math.max(utw_minh, ebi('u2tab').offsetHeight + 32) : 0;
|
||||||
uff = ebi('u2footfoot'),
|
if (utw_minh < minh || !utw_minh) {
|
||||||
minh = QS('#op_up2k.act') ? Math.max(op_minh, uff.offsetTop + uff.offsetHeight - op.offsetTop + 32) : 0;
|
utw_minh = minh;
|
||||||
|
ebi('u2tabw').style.minHeight = utw_minh + 'px';
|
||||||
if (minh > op_minh || !op_minh) {
|
|
||||||
op_minh = minh;
|
|
||||||
op.style.minHeight = op_minh + 'px';
|
|
||||||
}
|
}
|
||||||
|
|
||||||
if (!nhash)
|
if (!nhash)
|
||||||
|
@ -1240,7 +1237,7 @@ function up2k_init(subtle) {
|
||||||
}
|
}
|
||||||
|
|
||||||
if (was_busy != is_busy) {
|
if (was_busy != is_busy) {
|
||||||
was_busy = is_busy;
|
st.is_busy = was_busy = is_busy;
|
||||||
|
|
||||||
window[(is_busy ? "add" : "remove") +
|
window[(is_busy ? "add" : "remove") +
|
||||||
"EventListener"]("beforeunload", warn_uploader_busy);
|
"EventListener"]("beforeunload", warn_uploader_busy);
|
||||||
|
@ -1269,7 +1266,7 @@ function up2k_init(subtle) {
|
||||||
|
|
||||||
timer.rm(etafun);
|
timer.rm(etafun);
|
||||||
timer.rm(donut.do);
|
timer.rm(donut.do);
|
||||||
op_minh = 0;
|
utw_minh = 0;
|
||||||
}
|
}
|
||||||
else {
|
else {
|
||||||
timer.add(donut.do);
|
timer.add(donut.do);
|
||||||
|
|
Loading…
Reference in a new issue