pathetic sein father

This commit is contained in:
2026-07-16 22:56:07 +02:00
parent 8d9fa3fafd
commit f6e9e13f4e

View File

@@ -665,11 +665,15 @@
// still need a re-check after load (handled by attachMediaLoadListeners). // still need a re-check after load (handled by attachMediaLoadListeners).
// 2. Any mis-estimates: content that the heuristic got wrong is corrected // 2. Any mis-estimates: content that the heuristic got wrong is corrected
// after layout so measurements are accurate. // after layout so measurements are accurate.
requestAnimationFrame(() => { // Run checkOverflow synchronously immediately after setting innerHTML.
// This forces a synchronous layout (reflow) but guarantees the browser
// will not paint the intermediate state, completely eliminating any "flash"
// of the button popping in or out.
checkOverflow(); checkOverflow();
// After 1s, re-check everything — by then even slow ctrl+F5 images will
// have loaded and been laid out, so scrollHeight is accurate for all // checkOverflow still runs deferred to handle image loads (attachMediaLoadListeners)
// image comments. // and a fallback 1s timeout for any incredibly slow layout edge cases.
requestAnimationFrame(() => {
setTimeout(checkOverflow, 1000); setTimeout(checkOverflow, 1000);
}); });
fetchSidebarYoutubeTitles(container); fetchSidebarYoutubeTitles(container);
@@ -795,8 +799,8 @@
playSidebarEmojiVideos(node); playSidebarEmojiVideos(node);
}); });
// Defer overflow checks to after layout so measurements are accurate. // Defer overflow checks to after layout so measurements are accurate.
requestAnimationFrame(() => {
addedNodes.forEach(node => checkOverflow(node)); addedNodes.forEach(node => checkOverflow(node));
requestAnimationFrame(() => {
// Deferred re-check for image comments — mirrors renderFromCache behaviour. // Deferred re-check for image comments — mirrors renderFromCache behaviour.
// Images in newly appended nodes may not be laid out yet at append time. // Images in newly appended nodes may not be laid out yet at append time.
setTimeout(() => addedNodes.forEach(node => checkOverflow(node)), 1000); setTimeout(() => addedNodes.forEach(node => checkOverflow(node)), 1000);
@@ -869,7 +873,7 @@
node.classList.add('new-item-fade'); node.classList.add('new-item-fade');
container.prepend(node); container.prepend(node);
attachMediaLoadListeners(node); attachMediaLoadListeners(node);
requestAnimationFrame(() => checkOverflow(node)); checkOverflow(node);
fetchSidebarYoutubeTitles(container); fetchSidebarYoutubeTitles(container);
playSidebarEmojiVideos(node); playSidebarEmojiVideos(node);
} }