From 7bb7f30961ae1e2371c95527d4828a2371c006ca Mon Sep 17 00:00:00 2001 From: Til Schmitter Date: Sat, 9 May 2026 13:10:33 +0200 Subject: [PATCH] fix href image view not preventing default when init order wrong --- copyparty/web/baguettebox.js | 2 +- copyparty/web/browser.js | 21 +++++++++++++++------ 2 files changed, 16 insertions(+), 7 deletions(-) diff --git a/copyparty/web/baguettebox.js b/copyparty/web/baguettebox.js index 7d6a417a..1937d9c1 100644 --- a/copyparty/web/baguettebox.js +++ b/copyparty/web/baguettebox.js @@ -1380,7 +1380,7 @@ function init(){ thegrid.bagit(); } else{ - console.log('loop'); + console.log('wait for grid init'); setTimeout(init, 100) } } diff --git a/copyparty/web/browser.js b/copyparty/web/browser.js index 6da535f7..3a358ecc 100644 --- a/copyparty/web/browser.js +++ b/copyparty/web/browser.js @@ -6295,8 +6295,11 @@ window.thegrid = (function () { window.open(qhref, '_blank'); else { - if (!dbl) + if (!dbl){ + if(r.bbox && e.preventDefault) + e.preventDefault(); return true; + } setTimeout(function () { r.sel = true; @@ -6511,7 +6514,6 @@ window.thegrid = (function () { } r.dirty = false; - //r.bagit('#ggrid'); r.loadsel(); aligngriditems(); setTimeout(r.tippen, 20); @@ -6539,6 +6541,7 @@ window.thegrid = (function () { if(!isrc) isrc = thegrid.en ? '#ggrid' : '#files' + var br = baguetteBox.run(isrc, { noScrollbars: true, duringHide: r.onhide, @@ -6558,8 +6561,8 @@ window.thegrid = (function () { } } }); - r.bbox = true; r.bbox_opts = br[1]; + r.bbox = true; }; r.onhide = function () { @@ -10986,9 +10989,15 @@ function reload_browser() { } function sel_start(e) { - if (e.button !== 0 && e.type !== 'touchstart') return; - if (!thegrid.en || !treectl.dsel) return; - if (e.target.closest('#widget,#ops,.opview,.doc,#ggrid>a')) return; + try{ + if (e.button !== 0 && e.type !== 'touchstart') return; + if (!thegrid.en || !treectl.dsel) return; + if (e.target.closest('#widget,#ops,.opview,.doc,#ggrid>a')) return; + } + catch(ex){ + console.log(ex); + return; + } if (e.target.closest('#gfiles')) ebi('gfiles').style.userSelect = "none"