From 40e6f0951269f2b68ff1493107a3881e550d584e Mon Sep 17 00:00:00 2001 From: Til Schmitter Date: Sat, 9 May 2026 01:45:47 +0200 Subject: [PATCH] make page load snappier --- copyparty/web/browser.html | 2 +- copyparty/web/browser.js | 16 +++++++++++----- copyparty/web/util.js | 3 +-- 3 files changed, 13 insertions(+), 8 deletions(-) diff --git a/copyparty/web/browser.html b/copyparty/web/browser.html index 2c6735ff..fcf107f4 100644 --- a/copyparty/web/browser.html +++ b/copyparty/web/browser.html @@ -254,8 +254,8 @@ {%- if lang != "eng" %} {%- endif %} - + {%- if js %} diff --git a/copyparty/web/browser.js b/copyparty/web/browser.js index f622fbb0..cbccb16e 100644 --- a/copyparty/web/browser.js +++ b/copyparty/web/browser.js @@ -7768,12 +7768,12 @@ var treectl = (function () { swrite('entreed', 'tree'); get_tree("", get_evpath(), true); - r.show(); + r.show(nostore); clmod(ebi('treeToggleBtn'), 'on', true) } - r.show = function () { + r.show = function (instant) { r.hidden = false; if (!entreed) { ebi('path').style.display = nonav ? 'none' : 'inline-block'; @@ -7786,11 +7786,17 @@ var treectl = (function () { window.addEventListener('scroll', onscroll); window.addEventListener('resize', onresize); - // makes animation work by waiting for next frame - setTimeout(function () { + if(!instant){ + // makes animation work by waiting for next frame + setTimeout(function () { + onresize(); + aligngriditems(); + }, 10); + } + else { onresize(); aligngriditems(); - }, 10); + } }; r.detree = function (e, nw) { diff --git a/copyparty/web/util.js b/copyparty/web/util.js index 34cb020c..0b28f17e 100644 --- a/copyparty/web/util.js +++ b/copyparty/web/util.js @@ -2318,8 +2318,7 @@ var favico = (function () { scfg_bind(r, 'bg', 'icob', bg, r.upd); r.upd(); }; - - r.to = setTimeout(r.init, 100); + r.init(); return r; })();