From 9a94563bc408ac3f5195305e79e7ca950ae04f8a Mon Sep 17 00:00:00 2001 From: qiqi Date: Tue, 24 Nov 2026 07:09:27 +0800 Subject: [PATCH] =?UTF-8?q?chore(plugins):=20gallery=201.6.11=20=E5=B8=82?= =?UTF-8?q?=E5=9C=BA=E5=90=8C=E6=AD=A5?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- plugins/gallery/main.js | 13 +++++++++---- plugins/gallery/manifest.json | 4 ++-- plugins/index.json | 4 ++-- 3 files changed, 13 insertions(+), 8 deletions(-) diff --git a/plugins/gallery/main.js b/plugins/gallery/main.js index ee56dc9..8e5fafe 100644 --- a/plugins/gallery/main.js +++ b/plugins/gallery/main.js @@ -300,6 +300,11 @@ function renderGrid () { clear(grid) var gap = 6 + // 每次重排都重新量一次宽度:面板显隐/停靠栏展开时 gridW 可能是旧值, + // 只靠 ResizeObserver 会在「变成 0 再回来」期间漏掉,导致必须拖宽度才出图。 + var liveW = availableW() + if (liveW > 0 && Math.abs(liveW - gridW) > 1) gridW = liveW + if (!gridW) gridW = 320 var tileW = Math.max(40, Number(cfg.tile) || 110) var n = Math.max(1, Math.floor((gridW + gap) / (tileW + gap))) // v1.6.6:列宽 = 均分宽度(铺满面板),图幅只决定「列数」—— @@ -368,7 +373,7 @@ function paint (url) { if (!url || typeof url !== 'string') { fail('图片已丢失'); return } if (!box.isConnected) return - var img = el('img', { src: url, alt: '', loading: 'lazy', draggable: 'true' }) + var img = el('img', { src: url, alt: '', loading: 'eager', draggable: 'true' }) if (it.w && it.h) img.setAttribute('style', 'aspect-ratio:' + it.w + ' / ' + it.h) img.addEventListener('load', function () { // naturalWidth=0 说明拿到的是坏图(空 data URL / 截断文件):按失败处理,别留白块 @@ -407,7 +412,7 @@ if (img.parentNode === box) box.replaceChild(holder, img) fail('缩略图加载失败(点击重试)') } catch (e) { /* ignore */ } - }, 700) + }, 2000) // 加载成功后再替换占位(避免破图标 + 长 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('缩略图加载失败(点击重试)') } } @@ -447,7 +452,7 @@ render() } - function render () { renderHead(); renderGrid() } + function render () { renderHead(); renderGrid(); global.requestAnimationFrame(function () { try { measure() } catch (e) {} }); setTimeout(function () { try { measure() } catch (e) {} }, 150) } function load (force) { if (force) setStatus('刷新中…') @@ -538,7 +543,7 @@ global.IWBPluginHost.register({ id: 'gallery', name: '图库', - version: '1.6.10', + version: '1.6.11', apiVersion: 1, capabilities: ['panels', 'gallery'], data: { schemaVersion: 1, maxBytes: 65536 }, diff --git a/plugins/gallery/manifest.json b/plugins/gallery/manifest.json index d4e3ba3..be59d11 100644 --- a/plugins/gallery/manifest.json +++ b/plugins/gallery/manifest.json @@ -1,7 +1,7 @@ { "id": "gallery", "name": "图库", - "version": "1.6.10", + "version": "1.6.11", "apiVersion": 1, "main": "main.js", "style": "styles.css", @@ -13,7 +13,7 @@ "图库" ], "files": { - "main.js": "8693ae90799e7dd2f1f6bbea745aa0d74efd98a30489a2f750653d4be30e51f9", + "main.js": "cf456629b21f9001d7cc8016a6af0d2b065aae110ef822b7946e6279ec822f11", "styles.css": "35ae17de8b0f3bddab9cbef6270cd8bbf5153c9ecf6ed2b4f06216f6fef45b8b" } } diff --git a/plugins/index.json b/plugins/index.json index 2375958..223ff6f 100644 --- a/plugins/index.json +++ b/plugins/index.json @@ -22,9 +22,9 @@ "dir": "gallery", "main": "main.js", "style": "styles.css", - "version": "1.6.10", + "version": "1.6.11", "files": { - "main.js": "8693ae90799e7dd2f1f6bbea745aa0d74efd98a30489a2f750653d4be30e51f9", + "main.js": "cf456629b21f9001d7cc8016a6af0d2b065aae110ef822b7946e6279ec822f11", "styles.css": "35ae17de8b0f3bddab9cbef6270cd8bbf5153c9ecf6ed2b4f06216f6fef45b8b" } },