pager for transfers
This commit is contained in:
@@ -15,6 +15,7 @@
|
|||||||
var autoplayTimer = null;
|
var autoplayTimer = null;
|
||||||
var isHidden = true;
|
var isHidden = true;
|
||||||
var autoplayOn = false;
|
var autoplayOn = false;
|
||||||
|
var skipReveal = false; // if true, jump straight to compact (on reload restore)
|
||||||
|
|
||||||
var container, card, opCounter;
|
var container, card, opCounter;
|
||||||
|
|
||||||
@@ -36,6 +37,16 @@
|
|||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
var saved = sessionStorage.getItem("transferIndex");
|
||||||
|
if (saved !== null) {
|
||||||
|
var idx = parseInt(saved, 10);
|
||||||
|
if (!isNaN(idx) && idx >= 0 && idx < transfers.length) {
|
||||||
|
currentIndex = idx;
|
||||||
|
skipReveal = true;
|
||||||
|
showTransfer(currentIndex);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
updateCounter();
|
updateCounter();
|
||||||
setupKeys();
|
setupKeys();
|
||||||
console.log("Loaded " + transfers.length + " transfers. Press \u2192 or Enter to start.");
|
console.log("Loaded " + transfers.length + " transfers. Press \u2192 or Enter to start.");
|
||||||
@@ -81,23 +92,29 @@
|
|||||||
card.style.setProperty("--team-color", t.team.color);
|
card.style.setProperty("--team-color", t.team.color);
|
||||||
card.style.setProperty("--team-accent", t.team.accent);
|
card.style.setProperty("--team-accent", t.team.accent);
|
||||||
|
|
||||||
// trigger reveal animation (restart)
|
|
||||||
card.classList.remove("reveal");
|
|
||||||
void card.offsetWidth;
|
|
||||||
card.classList.add("reveal");
|
|
||||||
|
|
||||||
// show
|
// show
|
||||||
container.classList.remove("hidden");
|
container.classList.remove("hidden");
|
||||||
container.classList.add("visible");
|
container.classList.add("visible");
|
||||||
isHidden = false;
|
isHidden = false;
|
||||||
|
|
||||||
// schedule 5 s compact transition
|
if (skipReveal) {
|
||||||
|
skipReveal = false;
|
||||||
|
container.classList.add("compact");
|
||||||
|
card.classList.remove("reveal");
|
||||||
|
} else {
|
||||||
|
container.classList.remove("compact");
|
||||||
|
card.classList.remove("reveal");
|
||||||
|
void card.offsetWidth;
|
||||||
|
card.classList.add("reveal");
|
||||||
|
|
||||||
clearTimeout(compactTimer);
|
clearTimeout(compactTimer);
|
||||||
compactTimer = setTimeout(function () {
|
compactTimer = setTimeout(function () {
|
||||||
card.classList.remove("reveal"); // clear animation fill-mode locks so transitions are clean
|
card.classList.remove("reveal");
|
||||||
container.classList.add("compact");
|
container.classList.add("compact");
|
||||||
}, REVEAL_TIME);
|
}, REVEAL_TIME);
|
||||||
|
}
|
||||||
|
|
||||||
|
sessionStorage.setItem("transferIndex", String(index));
|
||||||
updateCounter();
|
updateCounter();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user