aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--src/features/messages.js15
-rw-r--r--tools/feed-picture-pager-test.js5
2 files changed, 18 insertions, 2 deletions
diff --git a/src/features/messages.js b/src/features/messages.js
index a254295..245e1ce 100644
--- a/src/features/messages.js
+++ b/src/features/messages.js
@@ -7036,9 +7036,12 @@ export function messagesFeature(ctx) {
// make it): the server makes one
if (!got && (noCorsHost(url) || corsRefused.has(url) || typeof OffscreenCanvas === 'undefined')) got = await serverMediaThumb(url).catch(() => null);
if (got) {
+ // the grid tile made alongside it, for a post's run of pictures
+ // (see pictureRuns): looked up from disk when the copy was
+ await warmTileThumbs([url]).catch(() => {});
// no copy (small already, or a GIF): the original is what paints,
// so it's the one decoded ahead — the row mustn't decode it on sight
- await decodeAhead(got.thumb || url);
+ await Promise.all([decodeAhead(got.thumb || url), tileThumbs.has(url) ? decodeAhead(tileThumbs.get(url)) : null]);
mediaReady.set(url, got);
return;
}
@@ -10954,7 +10957,7 @@ export function messagesFeature(ctx) {
// height-capped: see .note-img)
const known = size || mediaReady.get(url);
return h('img', {
- src: mediaSrc(url, known), class: 'note-img clickable', loading: feedPaint || known ? 'eager' : 'lazy', alt: label || '',
+ src: mediaSrc(url, known), 'data-pic': url, class: 'note-img clickable', loading: feedPaint || known ? 'eager' : 'lazy', alt: label || '',
// a few-ms decode of the copy paints with the page; an original never holds the page for its decode
decoding: known && known.thumb ? 'sync' : 'async',
width: size?.width, height: size?.height,
@@ -11404,6 +11407,14 @@ export function messagesFeature(ctx) {
break;
}
if (run.length < 2) { out.push(nodes[i]); continue; }
+ // A tile is painted from the Images feed's tile copy (360px, cut with a
+ // proper resize), not the 1100px column copy: shrunk eight times by the
+ // browser, that came out grainy (Adam, 2026-11-18).
+ for (const img of run) {
+ const url = img.getAttribute('data-pic'), tile = url && tileThumbs.get(url);
+ if (tile) img.setAttribute(img.hasAttribute('data-lazy-src') ? 'data-lazy-src' : 'src', tile);
+ else if (url && /^https?:/i.test(url)) queueTileThumbs([url]);
+ }
out.push(h('div', { class: 'note-gallery' }, ...run));
i = last;
}
diff --git a/tools/feed-picture-pager-test.js b/tools/feed-picture-pager-test.js
index 7578e01..947c6aa 100644
--- a/tools/feed-picture-pager-test.js
+++ b/tools/feed-picture-pager-test.js
@@ -93,6 +93,11 @@ try {
});
check('two pictures in a post: one gallery, side by side, one height', gal.n === 2 && gal.sameRow && gal.h > 50 && gal.h < 300, JSON.stringify(gal));
check('a lone picture is not put in a gallery', gal.lone);
+ // painted from the tile copy (a proper resize), not the column copy shrunk by the browser
+ check('gallery tiles are painted from the tile copies', await waitFor(() => {
+ const g = document.querySelector('.notes-feed .note-gallery');
+ return !!g && [...g.querySelectorAll('img')].every((i) => /^blob:/.test(i.currentSrc || i.src) && i.naturalHeight > 0 && i.naturalHeight <= 360);
+ }, null, 5000));
console.log('\n[a tap on the picture that opened it shows its details; the next closes it]');
const y0 = await openPic('two pictures');