From ee3c81e606acdf7499e0fa9b42998ef1c4cc702a Mon Sep 17 00:00:00 2001 From: KittenTM Date: Tue, 10 Mar 2026 03:31:38 +0100 Subject: [PATCH] revert: Add temporary SPFN patch to allow for boss to show properly --- stages/stages.js | 26 +++++++++++++------------- 1 file changed, 13 insertions(+), 13 deletions(-) diff --git a/stages/stages.js b/stages/stages.js index ab326d3..392cf12 100644 --- a/stages/stages.js +++ b/stages/stages.js @@ -95,12 +95,13 @@ async function fetchRotations() { if (!res.ok) throw new Error(`HTTP error! status: ${res.status}`); const data = await res.json(); const rotations = data?.pretendo?.rotations ?? {}; + const now = new Date(); const timestamps = Object.keys(rotations).sort((a, b) => Number(a) - Number(b)); const result = []; - for (const ts of timestamps) { const start = new Date(Number(ts)); const end = new Date(start.getTime() + 2 * 60 * 60 * 1000); + if (end < now) continue; const r = rotations[ts]; result.push({ turf: stageNames(r.turfStages), @@ -133,12 +134,14 @@ async function renderStages() { const trigger = document.createElement('div'); trigger.id = 'scroll-trigger'; - trigger.style.height = '10px'; - container.appendChild(trigger); + trigger.style.height = '2px'; + container.after(trigger); + + loadMore(true); observer = new IntersectionObserver((entries) => { if (entries[0].isIntersecting && currentIndex < allRotations.length) { - loadMore(); + loadMore(false); } }, { rootMargin: '200px' }); @@ -150,9 +153,8 @@ async function renderStages() { } } -function loadMore() { +function loadMore(isInitial) { const container = document.getElementById("stages-container"); - const trigger = document.getElementById('scroll-trigger'); const loadingOverlay = document.getElementById("loading-overlay"); if (loadingOverlay) { @@ -162,6 +164,8 @@ function loadMore() { } } + const waitTime = isInitial ? 0 : 800; + setTimeout(() => { const nextBatch = allRotations.slice(currentIndex, currentIndex + ITEMS_PER_PAGE); let html = ""; @@ -209,18 +213,14 @@ function loadMore() { `; } - if (trigger) { - trigger.insertAdjacentHTML('beforebegin', html); - } else { - container.insertAdjacentHTML('beforeend', html); - } - + container.insertAdjacentHTML('beforeend', html); currentIndex += ITEMS_PER_PAGE; if (loadingOverlay) loadingOverlay.style.display = 'none'; if (currentIndex >= allRotations.length) { if (observer) observer.disconnect(); + const trigger = document.getElementById('scroll-trigger'); if (trigger) trigger.remove(); } - }, currentIndex === 0 ? 0 : 800); + }, waitTime); } \ No newline at end of file