From 5e8ea5217728b129e329716bc5d115045f12ecbe Mon Sep 17 00:00:00 2001 From: awsr <43862868+awsr@users.noreply.github.com> Date: Sat, 24 Jan 2026 16:10:26 -0800 Subject: [PATCH] Toggle visibility from settings --- javascript/gallery.js | 9 ++++++++- modules/shared.py | 1 + 2 files changed, 9 insertions(+), 1 deletion(-) diff --git a/javascript/gallery.js b/javascript/gallery.js index ceef2a570..266ce8f0d 100644 --- a/javascript/gallery.js +++ b/javascript/gallery.js @@ -1022,7 +1022,7 @@ async function thumbCacheCleanup(folder, imgCount, controller, force = false) { }); } -async function addCacheClearButton() { +function addCacheClearButton() { // Don't use async const div = document.createElement('div'); div.style.cssText = 'margin-top: 1.5rem; margin-bottom: 0.5rem;'; const btn = document.createElement('button'); @@ -1042,6 +1042,12 @@ async function addCacheClearButton() { el.clearCache = div; } +async function updateGalleryAdvDisplay(newval, oldval = undefined) { + if (el.clearCache) { + el.clearCache.style.display = newval ? 'block' : 'none'; + } +} + async function fetchFilesHT(evt, controller) { const t0 = performance.now(); const fragment = document.createDocumentFragment(); @@ -1101,6 +1107,7 @@ async function fetchFilesWS(evt) { // fetch file-by-file list over websockets if (!el.clearCache) { addCacheClearButton(); } + updateGalleryAdvDisplay(opts.browser_gallery_advanced); if (!wsConnected) { await fetchFilesHT(evt, controller); // fallback to http return; diff --git a/modules/shared.py b/modules/shared.py index 0ac6511a1..c851f5b7c 100644 --- a/modules/shared.py +++ b/modules/shared.py @@ -533,6 +533,7 @@ options_templates.update(options_section(('saving-images', "Image Options"), { "image_sep_browser": OptionInfo("