simplify/improve up2k ui debounce

This commit is contained in:
ed 2021-11-20 00:03:15 +01:00
parent 315bd71adf
commit 7e82aaf843
3 changed files with 15 additions and 16 deletions

View file

@ -1666,8 +1666,6 @@ html.light #bbox-overlay figcaption a {
#op_up2k {
padding: 0 1em 1em 1em;
min-height: 0;
transition: min-height .2s;
}
#drops {
display: none;
@ -1832,13 +1830,17 @@ html.light #u2err.err {
#u2notbtn * {
line-height: 1.3em;
}
#u2tabw {
min-height: 0;
transition: min-height .2s;
margin: 3em auto;
}
#u2tab {
border-collapse: collapse;
margin: 3em auto;
width: calc(100% - 2em);
max-width: 100em;
}
#op_up2k.srch #u2tab {
#op_up2k.srch #u2tabf {
max-width: none;
}
#u2tab td {

View file

@ -117,7 +117,7 @@ ebi('op_up2k').innerHTML = (
'</div>\n' +
'<table id="u2tab">\n' +
'<div id="u2tabw"><table id="u2tab">\n' +
' <thead>\n' +
' <tr>\n' +
' <td>filename</td>\n' +
@ -126,7 +126,7 @@ ebi('op_up2k').innerHTML = (
' </tr>\n' +
' </thead>\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="u2foot"></p>\n' +

View file

@ -1069,7 +1069,7 @@ function up2k_init(subtle) {
}
more_one_file();
var etaref = 0, etaskip = 0, op_minh = 0;
var etaref = 0, etaskip = 0, utw_minh = 0;
function etafun() {
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,
@ -1082,13 +1082,10 @@ function up2k_init(subtle) {
//ebi('acc_info').innerHTML = humantime(st.time.busy) + ' ' + f2f(now / 1000, 1);
var op = ebi('op_up2k'),
uff = ebi('u2footfoot'),
minh = QS('#op_up2k.act') ? Math.max(op_minh, uff.offsetTop + uff.offsetHeight - op.offsetTop + 32) : 0;
if (minh > op_minh || !op_minh) {
op_minh = minh;
op.style.minHeight = op_minh + 'px';
var minh = QS('#op_up2k.act') && st.is_busy ? Math.max(utw_minh, ebi('u2tab').offsetHeight + 32) : 0;
if (utw_minh < minh || !utw_minh) {
utw_minh = minh;
ebi('u2tabw').style.minHeight = utw_minh + 'px';
}
if (!nhash)
@ -1240,7 +1237,7 @@ function up2k_init(subtle) {
}
if (was_busy != is_busy) {
was_busy = is_busy;
st.is_busy = was_busy = is_busy;
window[(is_busy ? "add" : "remove") +
"EventListener"]("beforeunload", warn_uploader_busy);
@ -1269,7 +1266,7 @@ function up2k_init(subtle) {
timer.rm(etafun);
timer.rm(donut.do);
op_minh = 0;
utw_minh = 0;
}
else {
timer.add(donut.do);