From 262c2e36096ae0a2c66a620d01ee9132de746670 Mon Sep 17 00:00:00 2001 From: Adam Soltys Date: Tue, 17 Nov 2026 17:08:55 -0700 Subject: The scroll date chip blends between posts and goes the moment you stop. "I'm good with blending. Can you make the chip appear and disappear faster? I want it gone as soon as I'm stopped to look at something" (Adam, 2026-11-17). The time now moves between the post at the top of the screen and the next one, in step with how far through that post you've scrolled. The clock rolls with the scroll instead of jumping from post to post, and runs quickly through a gap between posts. The chip leaves 250 ms after the last scroll event (was 1.2 s); a coast keeps sending events, so it stays while the page is still moving. It fades in over 80 ms and out over 120 ms. feed-when-test (blended time between the two posts, rolls with a few px of scroll, gone half a second after stopping) and feed-new-posts pass. Co-Authored-By: Claude Opus 5.5 Claude-Session: https://claude.ai/code/session_01VMan6SwkivduFDDkMmnXjZ --- src/features/messages.js | 26 +++++++++++++++++++------- 1 file changed, 19 insertions(+), 7 deletions(-) (limited to 'src/features/messages.js') diff --git a/src/features/messages.js b/src/features/messages.js index 6b3ff4c..72707a5 100644 --- a/src/features/messages.js +++ b/src/features/messages.js @@ -5445,7 +5445,7 @@ export function messagesFeature(ctx) { } // How far back you've scrolled: while the feed (or a profile's posts) // moves, a small chip under the top bar says when the post at the top of - // the screen was written, and fades a moment after the scrolling stops + // the screen was written, and goes the moment the scrolling stops // ("some sort of little counter that shows the date and time of posts // where I'm in the timeline", Adam, 2026-11-17). Painted straight into the // DOM, outside render(): it changes every frame of a fling. @@ -5476,13 +5476,22 @@ export function messagesFeature(ctx) { const head = document.querySelector('.brand-header'); const top = head ? Math.max(0, head.getBoundingClientRect().bottom) : 0; // the post at the top of the screen, below the bar - let key = null, box = null; - for (const r of rows) { - const b = r.getBoundingClientRect(); - if (b.bottom > top + 12) { key = r.getAttribute('data-key'); box = r.parentElement.getBoundingClientRect(); break; } + let key = null, box = null, frac = 0, nextKey = null; + for (let i = 0; i < rows.length; i++) { + const b = rows[i].getBoundingClientRect(); + if (b.bottom <= top + 12) continue; + key = rows[i].getAttribute('data-key'); + box = rows[i].parentElement.getBoundingClientRect(); + // how far through this post the top of the screen is, to blend its + // time toward the next post's: the clock rolls with the scroll + // instead of jumping post to post ("I'm good with blending", Adam) + frac = b.height > 0 ? Math.min(1, Math.max(0, (top + 12 - b.top) / b.height)) : 0; + nextKey = rows[i + 1]?.getAttribute('data-key'); + break; } if (whenIdx.list !== list) whenIdx = { list, map: list ? new Map(list.map((e) => [e.id, e])) : null }; const ev = key && whenIdx.map?.get(key); + const next = nextKey && whenIdx.map?.get(nextKey); // only once you're past the first screenful: at the top the posts' own times say it if (!ev || (window.scrollY || 0) < window.innerHeight * 0.75) { if (whenEl) whenEl.classList.remove('on'); return; } if (!whenEl) { @@ -5491,13 +5500,16 @@ export function messagesFeature(ctx) { whenEl.setAttribute('aria-hidden', 'true'); document.body.appendChild(whenEl); } - const label = whenLabel(ev.created_at); + const label = whenLabel(next ? ev.created_at + (next.created_at - ev.created_at) * frac : ev.created_at); if (whenEl.textContent !== label) whenEl.textContent = label; whenEl.style.top = (top + 8) + 'px'; whenEl.style.left = (box.left + box.width / 2) + 'px'; whenEl.classList.add('on'); clearTimeout(whenHide); - whenHide = setTimeout(() => whenEl && whenEl.classList.remove('on'), 1200); + // gone as soon as you stop to read ("I want it gone as soon as I'm + // stopped to look at something", Adam): a coast keeps sending scroll + // events, so this only fires once the page is still + whenHide = setTimeout(() => whenEl && whenEl.classList.remove('on'), 250); }); } async function loadOlderNotes(pk) { -- cgit v1.2.3