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
|
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) => {
|
document.querySelectorAll(".qm-popup-close").forEach((btn) => {
|
||||||
btn.addEventListener("click", closeAllPopups);
|
btn.addEventListener("click", closeAllPopups);
|
||||||
});
|
});
|
||||||
@ -113,20 +120,17 @@ document.querySelectorAll(".qm-popup-close").forEach((btn) => {
|
|||||||
overlay.addEventListener("click", closeAllPopups);
|
overlay.addEventListener("click", closeAllPopups);
|
||||||
|
|
||||||
function closeAllPopups() {
|
function closeAllPopups() {
|
||||||
// Nur sperren wenn Slot gerade dreht
|
if (isBoosterSpinning()) return; // Slot dreht → sperren
|
||||||
if (window.__boosterLocked) return;
|
|
||||||
|
|
||||||
document.querySelectorAll(".qm-popup").forEach((p) => {
|
document.querySelectorAll(".qm-popup").forEach((p) => {
|
||||||
p.classList.remove("active");
|
p.classList.remove("active");
|
||||||
});
|
});
|
||||||
overlay.classList.remove("active");
|
overlay.classList.remove("active");
|
||||||
window.__boosterLocked = false; // Sicherheits-Reset
|
|
||||||
}
|
}
|
||||||
|
|
||||||
document.addEventListener("keydown", (e) => {
|
document.addEventListener("keydown", (e) => {
|
||||||
if (e.key === "Escape") {
|
if (e.key === "Escape") {
|
||||||
// Nur sperren wenn Slot gerade dreht
|
if (isBoosterSpinning()) {
|
||||||
if (window.__boosterLocked) {
|
|
||||||
e.stopPropagation();
|
e.stopPropagation();
|
||||||
e.preventDefault();
|
e.preventDefault();
|
||||||
return;
|
return;
|
||||||
|
|||||||
@ -219,7 +219,6 @@ export async function loadEvents() {
|
|||||||
clearAllIntervals();
|
clearAllIntervals();
|
||||||
isSpinning = false;
|
isSpinning = false;
|
||||||
allRevealed = false;
|
allRevealed = false;
|
||||||
window.__boosterLocked = false;
|
|
||||||
|
|
||||||
for (let i = 0; i < 5; i++) {
|
for (let i = 0; i < 5; i++) {
|
||||||
const inner = body.querySelector(`#booster-slot-${i} .booster-slot-inner`);
|
const inner = body.querySelector(`#booster-slot-${i} .booster-slot-inner`);
|
||||||
@ -280,7 +279,6 @@ export async function loadEvents() {
|
|||||||
if (!allCards.length) return;
|
if (!allCards.length) return;
|
||||||
|
|
||||||
isSpinning = true;
|
isSpinning = true;
|
||||||
window.__boosterLocked = true; // äußere Modals sperren
|
|
||||||
|
|
||||||
const stapel = body.querySelector("#booster-stapel");
|
const stapel = body.querySelector("#booster-stapel");
|
||||||
stapel.classList.add("used");
|
stapel.classList.add("used");
|
||||||
@ -335,7 +333,6 @@ export async function loadEvents() {
|
|||||||
await markDailyComplete(1);
|
await markDailyComplete(1);
|
||||||
|
|
||||||
allRevealed = true;
|
allRevealed = true;
|
||||||
window.__boosterLocked = false; // äußere Modals wieder freigeben
|
|
||||||
body.querySelector("#booster-hint").textContent = "Alle Karten erhalten! ✓";
|
body.querySelector("#booster-hint").textContent = "Alle Karten erhalten! ✓";
|
||||||
const backBtn = body.querySelector("#booster-back-btn");
|
const backBtn = body.querySelector("#booster-back-btn");
|
||||||
backBtn.style.opacity = "1";
|
backBtn.style.opacity = "1";
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user