From 6592e7b3471db1fdd1cc4f097b86afdb979d9a4d Mon Sep 17 00:00:00 2001 From: Til Schmitter Date: Tue, 14 Apr 2026 20:12:33 +0200 Subject: [PATCH] fix up2k modal on mobile --- contrib/plugins/up2k-hook-ytid.js | 2 +- copyparty/web/browser.css | 20 ++++++++++---------- copyparty/web/browser.html | 2 +- copyparty/web/browser.js | 22 +++++++++------------- copyparty/web/up2k.js | 8 ++++---- 5 files changed, 25 insertions(+), 29 deletions(-) diff --git a/contrib/plugins/up2k-hook-ytid.js b/contrib/plugins/up2k-hook-ytid.js index 90c5f74a..d74d9fb2 100644 --- a/contrib/plugins/up2k-hook-ytid.js +++ b/contrib/plugins/up2k-hook-ytid.js @@ -14,7 +14,7 @@ function up2k_namefilter(good_files, nil_files, bad_files, hooks) { a_up2k_namefilter(good_files, nil_files, bad_files, hooks).then(() => { }); } -// ebi('up_inner').appendChild(mknod('input','unick')); +// ebi('op_up2k').appendChild(mknod('input','unick')); function bstrpos(buf, ptn) { var ofs = 0, diff --git a/copyparty/web/browser.css b/copyparty/web/browser.css index 49bd6b01..fcfdfbc8 100644 --- a/copyparty/web/browser.css +++ b/copyparty/web/browser.css @@ -2548,7 +2548,7 @@ html.y #bbox-overlay figcaption a { } /* up2k */ -#up_inner { +#op_up2k { display: block; width: 100%; overflow-y: auto; @@ -2753,7 +2753,7 @@ html.y #bbox-overlay figcaption a { width: 16em; cursor: pointer; } -#up_inner.srch #u2btn { +#op_up2k.srch #u2btn { border-color: var(--u2-sbtn-b1); } #u2conf #u2btn { @@ -2801,7 +2801,7 @@ html.y #bbox-overlay figcaption a { max-width: 100em; margin: 0 auto; } -#up_inner.srch #u2tabf { +#op_up2k.srch #u2tabf { max-width: none; } #u2tab td { @@ -2834,7 +2834,7 @@ html.y #bbox-overlay figcaption a { width: 16em; } } -#up_inner.srch td.prog { +#op_up2k.srch td.prog { font-family: sans-serif; font-family: var(--font-main), sans-serif; font-size: 1em; @@ -3007,8 +3007,8 @@ html.b #u2conf a.b:hover { box-shadow: var(--btn-1h-bs); border-bottom: var(--btn-1h-bb); } -#up_inner.srch #u2conf td:nth-child(2)>*, -#up_inner.srch #u2conf td:nth-child(3)>* { +#op_up2k.srch #u2conf td:nth-child(2)>*, +#op_up2k.srch #u2conf td:nth-child(3)>* { background: #777; border-color: var(--fg); box-shadow: none; @@ -3201,8 +3201,8 @@ html.ay #u2btn { html.dz #u2btn { letter-spacing: -.033em; } -html.c #up_inner.srch #u2btn, -html.a #up_inner.srch #u2btn { +html.c #op_up2k.srch #u2btn, +html.a #op_up2k.srch #u2btn { background: linear-gradient(to bottom, #ca3 0%, #fd8 50%, #fc6 51%, #b92 100%); text-shadow: 1px 1px 1px #fc6; color: #333; @@ -3336,13 +3336,13 @@ html.b #files td { html.b .btn { top: -.1em; } -html.b #up_inner.srch sup { +html.b #op_up2k.srch sup { color: #fc0; } html.by #u2btn sup { color: #06b; } -html.by #up_inner.srch sup { +html.by #op_up2k.srch sup { color: #b70; } html.bz #u2cards a.act { diff --git a/copyparty/web/browser.html b/copyparty/web/browser.html index 5c8b3a88..20ef0b82 100644 --- a/copyparty/web/browser.html +++ b/copyparty/web/browser.html @@ -186,7 +186,7 @@
🚀 Upload -
+
✕
diff --git a/copyparty/web/browser.js b/copyparty/web/browser.js index f0271ceb..417ce853 100644 --- a/copyparty/web/browser.js +++ b/copyparty/web/browser.js @@ -889,7 +889,7 @@ ebi('widget').innerHTML = ( // up2k ui -ebi('up_inner').innerHTML = ( +ebi('op_up2k').innerHTML = ( '
\n' + '\n' + @@ -1311,18 +1311,9 @@ function goto(dest) { clmod(obj[a], 'vis'); if (dest) { - var rewritten = ['cfg', 'mkdir', 'new_md', 'up2k']; - if(rewritten.includes(dest)){ - switch(dest){ - case 'cfg': - case 'up2k': - clmod(ebi(dest), 'vis', true); - break; - default: - break; - } + var rewritten = ['mkdir', 'new_md']; + if(rewritten.includes(dest)) return; - } var lnk = QS('#ops>a[data-dest=' + dest + ']'), nps = lnk.getAttribute('data-perm'); @@ -1337,7 +1328,12 @@ function goto(dest) { if (!has(perms, 'read') && !has(perms, 'write') && (dest == 'up2k')) return; - clmod(ebi('op_' + dest), 'act', 1); + var modal = ebi(dest); + if(modal != null) + clmod(modal, 'vis', true); + + var page = ebi('op_' + dest) ?? QS('#' + dest + ' .opview') + clmod(page, 'act', 1); clmod(lnk, 'act', 1); var fn = window['goto_' + dest]; diff --git a/copyparty/web/up2k.js b/copyparty/web/up2k.js index 162893a0..369b00be 100644 --- a/copyparty/web/up2k.js +++ b/copyparty/web/up2k.js @@ -1188,7 +1188,7 @@ function up2k_init(subtle) { // if ((dz == 'up_dz' && uc.fsearch) || (dz == 'srch_dz' && !uc.fsearch)) // tgl_fsearch(); - //if (!QS('#up_inner.act')) + //if (!QS('#op_up2k.act')) if(!uc.fsearch) goto('up2k'); @@ -1644,7 +1644,7 @@ function up2k_init(subtle) { utw_minh = parseInt(ebi('u2tabw').style.minHeight || '0'); } - var minh = QS('#up_inner.act') && st.is_busy ? Math.max(utw_minh, ebi('u2tab').offsetHeight + 32) : 0; + 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'; @@ -3308,7 +3308,7 @@ function up2k_init(subtle) { var ico = uc.fsearch ? '🔎' : '🚀', desc = uc.fsearch ? L.ul_btns : L.ul_btnu; - clmod(ebi('up_inner'), 'srch', uc.fsearch); + clmod(ebi('op_up2k'), 'srch', uc.fsearch); ebi('u2bm').innerHTML = ico + '  ' + desc + ''; } catch (ex) { } @@ -3464,7 +3464,7 @@ ebi('ico1').onclick = function () { }; -if (QS('#up_inner.act')) +if (QS('#op_up2k.act')) goto_up2k(); apply_perms({ "perms": perms, "frand": frand, "u2ts": u2ts });