From d75e5fb218a3a90d6c166f63631d397fc92d09cc Mon Sep 17 00:00:00 2001 From: Kibi Kelburton Date: Sun, 12 Jul 2026 21:15:21 +0200 Subject: [PATCH] Reapply "jhfg" This reverts commit 9898a0704bc389fb580c1c65ace89321dc9f88ea. --- public/s/js/user_comments.js | 15 +++++++++++---- 1 file changed, 11 insertions(+), 4 deletions(-) diff --git a/public/s/js/user_comments.js b/public/s/js/user_comments.js index 8758c13..dc3fb9a 100644 --- a/public/s/js/user_comments.js +++ b/public/s/js/user_comments.js @@ -71,12 +71,19 @@ if (!window.UserCommentSystem) { } bindEvents() { + let _rafPending = false; window.addEventListener('scroll', () => { if (this.loading || this.finished) return; - if ((window.innerHeight + window.scrollY) >= document.body.offsetHeight - 500) { - this.loadMore(); - } - }); + if (_rafPending) return; + _rafPending = true; + requestAnimationFrame(() => { + _rafPending = false; + if (this.loading || this.finished) return; + if ((window.innerHeight + window.scrollY) >= document.body.offsetHeight - 500) { + this.loadMore(); + } + }); + }, { passive: true }); // Listen for mode changes document.addEventListener('f0ck:modeChange', (e) => {