mirror of
https://github.com/vladmandic/automatic
synced 2026-09-19 09:14:35 +02:00
Toggle visibility from settings
This commit is contained in:
@@ -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;
|
||||
|
||||
@@ -533,6 +533,7 @@ options_templates.update(options_section(('saving-images', "Image Options"), {
|
||||
|
||||
"image_sep_browser": OptionInfo("<h2>Image Gallery</h2>", "", gr.HTML),
|
||||
"browser_cache": OptionInfo(True, "Use image gallery cache"),
|
||||
"browser_gallery_advanced": OptionInfo(False, "Show advanced features (below gallery)", gr.Checkbox),
|
||||
"browser_folders": OptionInfo("", "Additional image browser folders"),
|
||||
"browser_fixed_width": OptionInfo(False, "Use fixed width thumbnails"),
|
||||
"viewer_show_metadata": OptionInfo(True, "Show metadata in full screen image browser"),
|
||||
|
||||
Reference in New Issue
Block a user