revert: Add temporary SPFN patch to allow for boss to show properly

This commit is contained in:
kittentm 2026-03-10 03:31:38 +01:00
commit ee3c81e606
No known key found for this signature in database
GPG key ID: AC43DFDBC1F44A91

View file

@ -95,12 +95,13 @@ async function fetchRotations() {
if (!res.ok) throw new Error(`HTTP error! status: ${res.status}`); if (!res.ok) throw new Error(`HTTP error! status: ${res.status}`);
const data = await res.json(); const data = await res.json();
const rotations = data?.pretendo?.rotations ?? {}; const rotations = data?.pretendo?.rotations ?? {};
const now = new Date();
const timestamps = Object.keys(rotations).sort((a, b) => Number(a) - Number(b)); const timestamps = Object.keys(rotations).sort((a, b) => Number(a) - Number(b));
const result = []; const result = [];
for (const ts of timestamps) { for (const ts of timestamps) {
const start = new Date(Number(ts)); const start = new Date(Number(ts));
const end = new Date(start.getTime() + 2 * 60 * 60 * 1000); const end = new Date(start.getTime() + 2 * 60 * 60 * 1000);
if (end < now) continue;
const r = rotations[ts]; const r = rotations[ts];
result.push({ result.push({
turf: stageNames(r.turfStages), turf: stageNames(r.turfStages),
@ -133,12 +134,14 @@ async function renderStages() {
const trigger = document.createElement('div'); const trigger = document.createElement('div');
trigger.id = 'scroll-trigger'; trigger.id = 'scroll-trigger';
trigger.style.height = '10px'; trigger.style.height = '2px';
container.appendChild(trigger); container.after(trigger);
loadMore(true);
observer = new IntersectionObserver((entries) => { observer = new IntersectionObserver((entries) => {
if (entries[0].isIntersecting && currentIndex < allRotations.length) { if (entries[0].isIntersecting && currentIndex < allRotations.length) {
loadMore(); loadMore(false);
} }
}, { rootMargin: '200px' }); }, { rootMargin: '200px' });
@ -150,9 +153,8 @@ async function renderStages() {
} }
} }
function loadMore() { function loadMore(isInitial) {
const container = document.getElementById("stages-container"); const container = document.getElementById("stages-container");
const trigger = document.getElementById('scroll-trigger');
const loadingOverlay = document.getElementById("loading-overlay"); const loadingOverlay = document.getElementById("loading-overlay");
if (loadingOverlay) { if (loadingOverlay) {
@ -162,6 +164,8 @@ function loadMore() {
} }
} }
const waitTime = isInitial ? 0 : 800;
setTimeout(() => { setTimeout(() => {
const nextBatch = allRotations.slice(currentIndex, currentIndex + ITEMS_PER_PAGE); const nextBatch = allRotations.slice(currentIndex, currentIndex + ITEMS_PER_PAGE);
let html = ""; let html = "";
@ -209,18 +213,14 @@ function loadMore() {
`; `;
} }
if (trigger) { container.insertAdjacentHTML('beforeend', html);
trigger.insertAdjacentHTML('beforebegin', html);
} else {
container.insertAdjacentHTML('beforeend', html);
}
currentIndex += ITEMS_PER_PAGE; currentIndex += ITEMS_PER_PAGE;
if (loadingOverlay) loadingOverlay.style.display = 'none'; if (loadingOverlay) loadingOverlay.style.display = 'none';
if (currentIndex >= allRotations.length) { if (currentIndex >= allRotations.length) {
if (observer) observer.disconnect(); if (observer) observer.disconnect();
const trigger = document.getElementById('scroll-trigger');
if (trigger) trigger.remove(); if (trigger) trigger.remove();
} }
}, currentIndex === 0 ? 0 : 800); }, waitTime);
} }