Revert "chrome is the shittiest browser ever made, fuck this!"
This reverts commit 6c926a2374.
This commit is contained in:
@@ -3068,18 +3068,12 @@ window.cancelAnimFrame = (function () {
|
|||||||
let tt = false;
|
let tt = false;
|
||||||
const stimeout = 500;
|
const stimeout = 500;
|
||||||
|
|
||||||
// Navbar scroll effect - throttled with rAF to avoid style recalc on every scroll tick
|
// Navbar scroll effect - make background black when scrolling
|
||||||
if (navbar) {
|
if (navbar) {
|
||||||
let _navScrollRafPending = false;
|
|
||||||
window.addEventListener('scroll', () => {
|
window.addEventListener('scroll', () => {
|
||||||
if (_navScrollRafPending) return;
|
|
||||||
_navScrollRafPending = true;
|
|
||||||
requestAnimationFrame(() => {
|
|
||||||
_navScrollRafPending = false;
|
|
||||||
const isScrolled = window.scrollY > 10;
|
const isScrolled = window.scrollY > 10;
|
||||||
navbar.classList.toggle('scrolled', isScrolled);
|
navbar.classList.toggle('scrolled', isScrolled);
|
||||||
});
|
});
|
||||||
}, { passive: true });
|
|
||||||
}
|
}
|
||||||
|
|
||||||
// Helper to immediately abort media downloads
|
// Helper to immediately abort media downloads
|
||||||
@@ -4805,19 +4799,9 @@ window.cancelAnimFrame = (function () {
|
|||||||
};
|
};
|
||||||
|
|
||||||
// Scroll detection - preload before reaching bottom
|
// Scroll detection - preload before reaching bottom
|
||||||
// Throttled with rAF: getBoundingClientRect() and offsetHeight reads trigger forced layout
|
|
||||||
// reflows. Without throttling, Chromium freezes on every scroll tick (desktop-specific
|
|
||||||
// because desktop Chromium doesn't async-scroll the way mobile Chrome does).
|
|
||||||
const PRELOAD_OFFSET = 500; // pixels before bottom to trigger load
|
const PRELOAD_OFFSET = 500; // pixels before bottom to trigger load
|
||||||
let _scrollRafPending = false;
|
|
||||||
|
|
||||||
const onScroll = () => {
|
const onScroll = () => {
|
||||||
if (_scrollRafPending) return; // already have a frame queued, skip
|
|
||||||
_scrollRafPending = true;
|
|
||||||
|
|
||||||
requestAnimationFrame(() => {
|
|
||||||
_scrollRafPending = false;
|
|
||||||
|
|
||||||
const currentContainer = postsContainer;
|
const currentContainer = postsContainer;
|
||||||
// Only run if THIS container is the active one and still in DOM
|
// Only run if THIS container is the active one and still in DOM
|
||||||
if (!currentContainer || !document.body.contains(currentContainer)) {
|
if (!currentContainer || !document.body.contains(currentContainer)) {
|
||||||
@@ -4839,17 +4823,17 @@ window.cancelAnimFrame = (function () {
|
|||||||
}
|
}
|
||||||
|
|
||||||
// Load previous when within PRELOAD_OFFSET pixels of top
|
// Load previous when within PRELOAD_OFFSET pixels of top
|
||||||
|
// Also ensure we aren't already at page 1
|
||||||
if (window.scrollY < PRELOAD_OFFSET && infiniteState.hasPrev && !infiniteState.loadingUp) {
|
if (window.scrollY < PRELOAD_OFFSET && infiniteState.hasPrev && !infiniteState.loadingUp) {
|
||||||
loadPreviousItems();
|
loadPreviousItems();
|
||||||
}
|
}
|
||||||
|
|
||||||
infiniteState.lastScrollY = window.scrollY;
|
infiniteState.lastScrollY = window.scrollY;
|
||||||
});
|
|
||||||
};
|
};
|
||||||
|
|
||||||
// Store scroll handler reference for cleanup
|
// Store scroll handler reference for cleanup
|
||||||
postsContainer._scrollHandler = onScroll;
|
postsContainer._scrollHandler = onScroll;
|
||||||
window.addEventListener('scroll', onScroll, { passive: true });
|
window.addEventListener("scroll", onScroll);
|
||||||
|
|
||||||
// Initial check (in case we loaded at top/bottom)
|
// Initial check (in case we loaded at top/bottom)
|
||||||
setTimeout(onScroll, 100);
|
setTimeout(onScroll, 100);
|
||||||
|
|||||||
Reference in New Issue
Block a user