diff options
Diffstat (limited to 'src/features/messages.js')
| -rw-r--r-- | src/features/messages.js | 15 |
1 files changed, 13 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; } |
