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}`);
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);
}