gh,
This commit is contained in:
parent
5b5af5a286
commit
0f14dce958
@ -106,6 +106,13 @@ document.querySelectorAll(".qm-popup").forEach((popup) => {
|
||||
Quick Menu – Popups schließen
|
||||
================================ */
|
||||
|
||||
function isBoosterSpinning() {
|
||||
// Prüft direkt am DOM ob der Slot gerade dreht – kein globaler Flag nötig
|
||||
const ui = document.getElementById("booster-ui");
|
||||
if (!ui || ui.style.display === "none") return false;
|
||||
return !!ui.querySelector(".booster-slot.spinning");
|
||||
}
|
||||
|
||||
document.querySelectorAll(".qm-popup-close").forEach((btn) => {
|
||||
btn.addEventListener("click", closeAllPopups);
|
||||
});
|
||||
@ -113,20 +120,17 @@ document.querySelectorAll(".qm-popup-close").forEach((btn) => {
|
||||
overlay.addEventListener("click", closeAllPopups);
|
||||
|
||||
function closeAllPopups() {
|
||||
// Nur sperren wenn Slot gerade dreht
|
||||
if (window.__boosterLocked) return;
|
||||
if (isBoosterSpinning()) return; // Slot dreht → sperren
|
||||
|
||||
document.querySelectorAll(".qm-popup").forEach((p) => {
|
||||
p.classList.remove("active");
|
||||
});
|
||||
overlay.classList.remove("active");
|
||||
window.__boosterLocked = false; // Sicherheits-Reset
|
||||
}
|
||||
|
||||
document.addEventListener("keydown", (e) => {
|
||||
if (e.key === "Escape") {
|
||||
// Nur sperren wenn Slot gerade dreht
|
||||
if (window.__boosterLocked) {
|
||||
if (isBoosterSpinning()) {
|
||||
e.stopPropagation();
|
||||
e.preventDefault();
|
||||
return;
|
||||
|
||||
@ -219,7 +219,6 @@ export async function loadEvents() {
|
||||
clearAllIntervals();
|
||||
isSpinning = false;
|
||||
allRevealed = false;
|
||||
window.__boosterLocked = false;
|
||||
|
||||
for (let i = 0; i < 5; i++) {
|
||||
const inner = body.querySelector(`#booster-slot-${i} .booster-slot-inner`);
|
||||
@ -280,7 +279,6 @@ export async function loadEvents() {
|
||||
if (!allCards.length) return;
|
||||
|
||||
isSpinning = true;
|
||||
window.__boosterLocked = true; // äußere Modals sperren
|
||||
|
||||
const stapel = body.querySelector("#booster-stapel");
|
||||
stapel.classList.add("used");
|
||||
@ -335,7 +333,6 @@ export async function loadEvents() {
|
||||
await markDailyComplete(1);
|
||||
|
||||
allRevealed = true;
|
||||
window.__boosterLocked = false; // äußere Modals wieder freigeben
|
||||
body.querySelector("#booster-hint").textContent = "Alle Karten erhalten! ✓";
|
||||
const backBtn = body.querySelector("#booster-back-btn");
|
||||
backBtn.style.opacity = "1";
|
||||
|
||||
Loading…
Reference in New Issue
Block a user