From 52357ca666d07810240a785978b145f559259d18 Mon Sep 17 00:00:00 2001 From: Til Schmitter Date: Mon, 4 May 2026 12:41:30 +0200 Subject: [PATCH] grid gallery view --- copyparty/web/browser.css | 18 +++++++++++++++++- copyparty/web/browser.js | 39 ++++++++++++++++++++++++++++++--------- 2 files changed, 47 insertions(+), 10 deletions(-) diff --git a/copyparty/web/browser.css b/copyparty/web/browser.css index 13cd1354..19a7057a 100644 --- a/copyparty/web/browser.css +++ b/copyparty/web/browser.css @@ -1184,7 +1184,8 @@ html:not(.e) #ggrid>a.dir:before { height: 1.5em; padding: .1em; } -.btn.svgIcon.gb1 { +.btn.svgIcon.gb_grd, +.btn.svgIcon.gb_glr { width: 1.7em; height: 1.7em; padding: 0; @@ -2878,6 +2879,9 @@ html.c .modalcontent { .close { display: none; } + .splitsub { + margin-bottom: .5em; + } } @@ -3905,6 +3909,18 @@ html.e #wrap.thin { justify-content: center; gap: 1em; } + #ggrid.gallery { + gap: 1px 2px; + a::before { + padding: .1em 0; + margin: .3em; + } + a:not(.dir) { + span { + display: none; + } + } + } html.b #ggrid { padding: 0 0 2em 0; diff --git a/copyparty/web/browser.js b/copyparty/web/browser.js index b52242c1..2306e066 100644 --- a/copyparty/web/browser.js +++ b/copyparty/web/browser.js @@ -6046,8 +6046,9 @@ var thegrid = (function () { gfiles.style.display = 'none'; gfiles.innerHTML = ( '
' + - '' + - '' + + '' + + '' + + '' + '' + var svg_gallery = svg_box + '' var svg_list = svg_box + '' ebi('gridicon_template').innerHTML = svg_grid; + ebi('galleryicon_template').innerHTML = svg_gallery; ebi('listicon_template').innerHTML = svg_list; var ico1 = ebi('gridicon_template').cloneNode(true); - var ico2 = ebi('listicon_template').cloneNode(true); - clmod(ico1, 'on', 't'); - clmod(ico2, 'on', 't'); + //var ico2 = ebi('galleryicon_template').cloneNode(true); + var ico3 = ebi('listicon_template').cloneNode(true); + clmod(ico1, 'on', false); + //clmod(ico2, 'on', false); + clmod(ico3, 'on', true); // file list header ebi('wtc').innerHTML = ( ico1.outerHTML + - ico2.outerHTML + + //ico2.outerHTML + + ico3.outerHTML + '
' + '' + L.cl_hiddenc + '' + '
' + @@ -6155,6 +6161,7 @@ var thegrid = (function () { ebi('wtc').style.display = lfiles.style.display; clmod(ggrid, 'crop', r.crop); clmod(ggrid, 'nocrop', !r.crop); + clmod(ggrid, 'gallery', r.gallery); ebi('pro').style.display = ebi('epi').style.display = ebi('lazy').style.display = ebi('treeul').style.display = ebi('treepar').style.display = ''; ebi('bdoc').style.display = 'none'; clmod(ebi('wrap'), 'doc'); @@ -6604,9 +6611,23 @@ var thegrid = (function () { swrite('ga_thresh', r.gathr = (isNum(n) ? n : 0) || 70); }; - var gtgls = QSA('.grdbtn'); - for(var a = 0; a < gtgls.length; a++) - gtgls[a].onclick = ebi('griden').onclick; + var gbtn = QSA('.gb_grd'); + for(var a = 0; a < gbtn.length; a++) + gbtn[a].onclick = function(){ + if(!thegrid.en) + ebi('griden').click(); + } + + var lsbtn = QSA('.gb_lst'); + for(var a = 0; a < lsbtn.length; a++) + lsbtn[a].onclick = function(){ + if(thegrid.en) + ebi('griden').click(); + } + + bcfg_bind(r, 'gallery', 'galleryicon_template', false, function (v) { + clmod(ebi('ggrid'), 'gallery', v); + }); return r; })();