From 540eed04cc380fdc2c0d74cabc2bced2dd2332ad Mon Sep 17 00:00:00 2001 From: qiqi Date: Sat, 21 Nov 2026 23:50:36 +0800 Subject: [PATCH] =?UTF-8?q?fix(plugins):=20gallery=201.6.9=20=E7=BC=A9?= =?UTF-8?q?=E7=95=A5=E5=9B=BE=E5=85=B1=E4=BA=AB/=E5=9D=8F=E5=9B=BE?= =?UTF-8?q?=E5=85=9C=E5=BA=95=EF=BC=9B=E9=A1=B6=E6=A0=8F=E6=9B=B4=E6=B5=85?= =?UTF-8?q?=20v3.26.19?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- plugins/gallery/main.js | 11 +++++++++++ plugins/gallery/manifest.json | 2 +- plugins/index.json | 2 +- 3 files changed, 13 insertions(+), 2 deletions(-) diff --git a/plugins/gallery/main.js b/plugins/gallery/main.js index a169768..2c22dcc 100644 --- a/plugins/gallery/main.js +++ b/plugins/gallery/main.js @@ -340,6 +340,7 @@ box.appendChild(holder) var tries = 0 function fail (text) { + tries = 999 holder.textContent = text || '缩略图加载失败(点击重试)' holder.style.cursor = 'pointer' holder.onclick = function () { failed[it.name] = 1; tries = 0; boot() } @@ -347,6 +348,7 @@ updateFail() } function boot () { + if (tries >= 999) return holder.style.cursor = '' holder.onclick = null holder.textContent = '加载中…' @@ -397,6 +399,15 @@ }) img.style.display = 'none' box.appendChild(img) + // v1.6.9:坏图/超时兜底 —— 某些坏字节既不触发 load 也不触发 error,700ms 后直接判定失败(可点击重试) + setTimeout(function () { + try { + if (!img.parentNode) return + if (img.naturalWidth > 0) return + if (img.parentNode === box) box.replaceChild(holder, img) + fail('缩略图加载失败(点击重试)') + } catch (e) { /* ignore */ } + }, 700) // 加载成功后再替换占位(避免破图标 + 长 title 占满格子) if (img.complete && img.naturalWidth > 0) { img.style.display = ''; if (holder.parentNode === box) box.replaceChild(img, holder) } else if (img.complete && !img.naturalWidth) { /* 立即失败(坏图)*/ tries++; if (tries <= 2) setTimeout(boot, 400 * tries); else { if (img.parentNode === box) box.replaceChild(holder, img); fail('缩略图加载失败(点击重试)') } } diff --git a/plugins/gallery/manifest.json b/plugins/gallery/manifest.json index 55f26b6..5f73921 100644 --- a/plugins/gallery/manifest.json +++ b/plugins/gallery/manifest.json @@ -13,7 +13,7 @@ "图库" ], "files": { - "main.js": "fd3ca4d42dcc9c74d311d9177606ff25fc7e38c1d6b40de4a0435edd30a08a6f", + "main.js": "891cf9d053339729437dfd973bbbfdce53e50b3c9ec4eee23d21166871057af7", "styles.css": "9d5b4ab1343761e51ef0c479cab96a94d3d6eaa27f0fdb500bff789ec81d70e0" } } diff --git a/plugins/index.json b/plugins/index.json index 456f080..31a4fc4 100644 --- a/plugins/index.json +++ b/plugins/index.json @@ -24,7 +24,7 @@ "style": "styles.css", "version": "1.6.9", "files": { - "main.js": "fd3ca4d42dcc9c74d311d9177606ff25fc7e38c1d6b40de4a0435edd30a08a6f", + "main.js": "891cf9d053339729437dfd973bbbfdce53e50b3c9ec4eee23d21166871057af7", "styles.css": "9d5b4ab1343761e51ef0c479cab96a94d3d6eaa27f0fdb500bff789ec81d70e0" } },