From b43268ddc6b445eccd96a395e666a8f20a89458e Mon Sep 17 00:00:00 2001 From: Kibi Kelburton Date: Fri, 15 May 2026 05:19:11 +0200 Subject: [PATCH] fix lazyloading bug for previous inactive tabs that become active --- public/s/js/f0ckm.js | 19 +++++++++++++++++++ 1 file changed, 19 insertions(+) diff --git a/public/s/js/f0ckm.js b/public/s/js/f0ckm.js index 0673d90..584c9a5 100644 --- a/public/s/js/f0ckm.js +++ b/public/s/js/f0ckm.js @@ -186,6 +186,20 @@ window.cancelAnimFrame = (function () { }, { rootMargin: '300px 0px', threshold: 0.01 }); } + // Nudge lazy loading on tab switch to prevent stuck skeletons in inactive tabs + if (!window._lazyVisibilityBound) { + window._lazyVisibilityBound = true; + document.addEventListener('visibilitychange', () => { + if (!document.hidden && typeof window.initLazyLoading === 'function') { + // Clear observation state for pending items to force re-observation + document.querySelectorAll('.lazy-thumb:not(.loaded)').forEach(t => { + delete t.dataset.lazyObserved; + }); + window.initLazyLoading(); + } + }); + } + document.querySelectorAll('.lazy-thumb').forEach(thumb => { if (!thumb.dataset.lazyObserved) { thumb.dataset.lazyObserved = 'true'; @@ -6543,6 +6557,11 @@ class NotificationSystem { thumb.style.opacity = '1'; thumb.style.transform = 'scale(1)'; }); + + // Refresh lazy loading for the newly added item + if (typeof window.initLazyLoading === 'function') { + window.initLazyLoading(); + } } handleActivity(data) {