From 3f30c2e2006718788cfb504dbe17b670abb8e4ba Mon Sep 17 00:00:00 2001 From: Til Schmitter Date: Sat, 9 May 2026 00:31:32 +0200 Subject: [PATCH] alternative way to detect thumbnails --- copyparty/web/browser.css | 6 +++--- copyparty/web/browser.js | 12 ++++++++---- 2 files changed, 11 insertions(+), 7 deletions(-) diff --git a/copyparty/web/browser.css b/copyparty/web/browser.css index 5ae64554..7cfeeafe 100644 --- a/copyparty/web/browser.css +++ b/copyparty/web/browser.css @@ -1058,7 +1058,7 @@ tr.play td:nth-child(1) a { animation: rotate 10s linear infinite; } } -html:not(.e) #ggrid>a:not(.nothumb).dir:before { +html:not(.e) #ggrid>a.thumbed.dir:before { content: '📂'; } #ggrid>a.dir>span { @@ -3978,7 +3978,7 @@ html.e #wrap.thin { padding: .1em 0; margin: .3em; } - a.img:not(.nothumb) { + a.img.thumbed { max-height: none; span:not(.th_ext) { display: none; @@ -4005,7 +4005,7 @@ html.e #wrap.thin { height: calc(var(--grid-sz) - 1.5em); } } - a.img:not(.nothumb) { + a.img.thumbed { min-width: calc(var(--grid-sz) / 2); width: auto; .thumb { diff --git a/copyparty/web/browser.js b/copyparty/web/browser.js index 7661c1ff..f622fbb0 100644 --- a/copyparty/web/browser.js +++ b/copyparty/web/browser.js @@ -6459,7 +6459,7 @@ var thegrid = (function () { (isdir || ext == 'unk' || ext.startsWith('/') ? '' : '' + ext + '') + - '' + ao.innerHTML + ''); } ggrid.innerHTML = html.join('\n'); @@ -6479,6 +6479,12 @@ var thegrid = (function () { ths[a].onclick = gclick1; } + var imgs = QSA('#ggrid>a img'); + for (var a = 0, aa = imgs.length; a < aa; a++) { + if(imgs[a].complete) + clmod(imgs[a].parentElement.parentElement, 'thumbed', true) + } + var chks = QSA('.gselchk'); for (var a = 0, aa = chks.length; a < aa; a++) { chks[a].onclick = function (e) { @@ -6659,6 +6665,7 @@ var thegrid = (function () { function th_onload(el) { + clmod(el.parentElement.parentElement, 'thumbed', true) el.style.position = 'static' el.style.opacity = '1' el.style.height = ''; @@ -6666,9 +6673,6 @@ function th_onload(el) { el.previousSibling.previousSibling.style.display = 'none' } -function th_onerror(el) { - clmod(el.parentElement.parentElement, 'nothumb', true) -} function tree_scrollto(e) {