fix(plugins): gallery 1.6.9 缩略图共享/坏图兜底;顶栏更浅 v3.26.19
Verify (Gitea) / gate (build · unit · facts) (push) Failing after 1m33s

This commit is contained in:
qiqi committed 2026-11-21 23:50:36 +08:00
1 parent 96e8cc2d7d
commit 540eed04cc
3 files changed
+13 -2

No files matched your search

+11
View File
@@ -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('缩略图加载失败(点击重试)') } }
+1 -1
View File
@@ -13,7 +13,7 @@
"图库"
],
"files": {
"main.js": "fd3ca4d42dcc9c74d311d9177606ff25fc7e38c1d6b40de4a0435edd30a08a6f",
"main.js": "891cf9d053339729437dfd973bbbfdce53e50b3c9ec4eee23d21166871057af7",
"styles.css": "9d5b4ab1343761e51ef0c479cab96a94d3d6eaa27f0fdb500bff789ec81d70e0"
}
}
+1 -1
View File
@@ -24,7 +24,7 @@
"style": "styles.css",
"version": "1.6.9",
"files": {
"main.js": "fd3ca4d42dcc9c74d311d9177606ff25fc7e38c1d6b40de4a0435edd30a08a6f",
"main.js": "891cf9d053339729437dfd973bbbfdce53e50b3c9ec4eee23d21166871057af7",
"styles.css": "9d5b4ab1343761e51ef0c479cab96a94d3d6eaa27f0fdb500bff789ec81d70e0"
}
},