From 60c96f990a36e7c6f27b702c8b90944852513d27 Mon Sep 17 00:00:00 2001 From: ed Date: Sat, 1 Jun 2024 00:35:44 +0000 Subject: [PATCH] ux: hide video ui + floor seekbar text * hide lightbox buttons when a video is playing * move audio seekbar text to the bottom, so it hides less of the waveform and minute-markers --- copyparty/web/baguettebox.js | 14 ++++++++++---- copyparty/web/browser.js | 6 +++--- 2 files changed, 13 insertions(+), 7 deletions(-) diff --git a/copyparty/web/baguettebox.js b/copyparty/web/baguettebox.js index 9acb15b6..1af118de 100644 --- a/copyparty/web/baguettebox.js +++ b/copyparty/web/baguettebox.js @@ -743,6 +743,8 @@ window.baguetteBox = (function () { image.volume = clamp(fcfg_get('vol', dvol / 100), 0, 1); image.setAttribute('controls', 'controls'); image.onended = vidEnd; + image.onplay = function () { show_buttons(1); }; + image.onpause = function () { show_buttons(); }; } image.alt = thumbnailElement ? thumbnailElement.alt || '' : ''; if (options.titleTag && imageCaption) @@ -988,6 +990,12 @@ window.baguetteBox = (function () { } } + function show_buttons(v) { + clmod(ebi('bbox-btns'), 'off', v); + clmod(btnPrev, 'off', v); + clmod(btnNext, 'off', v); + } + function bounceAnimation(direction) { slider.className = options.animation == 'slideIn' ? 'bounce-from-' + direction : 'eog'; setTimeout(function () { @@ -1051,10 +1059,8 @@ window.baguetteBox = (function () { if (fx > 0.7) return showNextImage(); - clmod(ebi('bbox-btns'), 'off', 't'); - clmod(btnPrev, 'off', 't'); - clmod(btnNext, 'off', 't'); - + show_buttons('t'); + if (Date.now() - ctime <= 500 && !IPHONE) tglfull(); diff --git a/copyparty/web/browser.js b/copyparty/web/browser.js index 5c888d32..d84937fa 100644 --- a/copyparty/web/browser.js +++ b/copyparty/web/browser.js @@ -2047,8 +2047,8 @@ var pbar = (function () { r.buf = canvas_cfg(ebi('barbuf')); r.pos = canvas_cfg(ebi('barpos')); r.buf.ctx.font = '.5em sans-serif'; - r.pos.ctx.font = '1em sans-serif'; - r.pos.ctx.strokeStyle = 'rgba(24,56,0,0.4)'; + r.pos.ctx.font = '.9em sans-serif'; + r.pos.ctx.strokeStyle = 'rgba(24,56,0,0.5)'; r.drawbuf(); r.drawpos(); if (!r.pos.can.onmouseleave) @@ -2214,7 +2214,7 @@ var pbar = (function () { var m1 = pctx.measureText(t1), m1b = pctx.measureText(t1 + ":88"), m2 = pctx.measureText(t2), - yt = pc.h / 3 * 2.1, + yt = pc.h * 0.94, xt1 = pc.w - (m1.width + 12), xt2 = x < m1.width * 1.4 ? (x + 12) : (Math.min(pc.w - m1b.width, x - 12) - m2.width);