adventskalender/shared/js/lock.js aktualisiert

This commit is contained in:
2025-11-05 20:37:21 +00:00
parent 2e5163c003
commit a0a3d87fd8

View File

@@ -52,18 +52,28 @@ function _checkDoorUnlocked(day) {
// DEV-Konsole aufbauen (nur bei ?dev) // DEV-Konsole aufbauen (nur bei ?dev)
// =============================== // ===============================
function createDevConsole() { function createDevConsole() {
// schauen, ob schon ein Reset-Button existiert (von save-progress.js) // gemeinsames Panel holen oder anlegen
const existingReset = document.getElementById("dev-reset"); let panel = document.getElementById("dev-panel");
if (!panel) {
panel = document.createElement("div");
panel.id = "dev-panel";
panel.style.cssText = `
position: fixed;
bottom: 10px;
right: 10px;
display: flex;
flex-direction: column;
gap: 10px;
z-index: 9999;
`;
document.body.appendChild(panel);
}
const box = document.createElement("div"); const box = document.createElement("div");
box.className = "dev-console"; box.className = "dev-console";
box.style.cssText = ` box.style.cssText = `
background: rgba(0,0,0,0.8); background: rgba(0,0,0,0.8);
color: #f1e1a6; color: #f1e1a6;
position: fixed;
bottom: 10px;
right: 10px;
z-index: 9999;
padding: 10px; padding: 10px;
border: 1px solid #c8aa49; border: 1px solid #c8aa49;
border-radius: 8px; border-radius: 8px;
@@ -98,7 +108,6 @@ function createDevConsole() {
`; `;
b.onclick = () => { b.onclick = () => {
localStorage.setItem(`${STORAGE_BASE}_simday`, String(i)); localStorage.setItem(`${STORAGE_BASE}_simday`, String(i));
// Anzeige bleibt nur korrekt, wenn wir neu laden
location.reload(); location.reload();
}; };
grid.appendChild(b); grid.appendChild(b);
@@ -147,14 +156,8 @@ function createDevConsole() {
box.appendChild(actions); box.appendChild(actions);
// An passender Stelle einfügen // endgültig ins Panel
if (existingReset) { panel.appendChild(box);
existingReset.insertAdjacentElement("afterend", box);
// etwas Abstand, damit sich Reset und Dev nicht überlagern
box.style.bottom = "60px";
} else {
document.body.appendChild(box);
}
} }
// =============================== // ===============================