From 6971f3438ca6c5e6a305d69571cc2e2c9809dffc Mon Sep 17 00:00:00 2001 From: awsr <43862868+awsr@users.noreply.github.com> Date: Thu, 12 Feb 2026 03:16:07 -0800 Subject: [PATCH] Implement error method for gallery progress Handle instances when Web Crypto API is not available. --- javascript/gallery.js | 10 ++++++++++ 1 file changed, 10 insertions(+) diff --git a/javascript/gallery.js b/javascript/gallery.js index 9fd49e9d2..73b033757 100644 --- a/javascript/gallery.js +++ b/javascript/gallery.js @@ -223,6 +223,15 @@ class SimpleProgressBar { this.#text.textContent = ''; } + error(message) { + this.#stop(); + clearTimeout(this.#hideTimeout); + this.#text.textContent = message; + this.#hideTimeout = setTimeout(() => { + this.clear(); + }, 2000); + } + #update(loaded, max) { if (this.#hideTimeout) { this.#hideTimeout = null; @@ -655,6 +664,7 @@ async function getHash(str) { return hex; } catch (err) { error('getHash:', err); + galleryProgressBar.error('File hash error'); return undefined; } }