From ef94c8823bc63dc840c93721e0e6d93e320a429c Mon Sep 17 00:00:00 2001 From: Cay Date: Sun, 15 Mar 2026 10:45:34 +0000 Subject: [PATCH] Alert Fenster umgebaut --- public/css/building.css | 104 ++++++++++++++++++++++++++++ public/js/buildings/schwarzmarkt.js | 40 ++++++++++- views/launcher.ejs | 14 ++++ 3 files changed, 156 insertions(+), 2 deletions(-) diff --git a/public/css/building.css b/public/css/building.css index 4d48ba8..ac504bf 100644 --- a/public/css/building.css +++ b/public/css/building.css @@ -527,6 +527,110 @@ body { box-shadow: 0 0 10px rgba(0, 0, 0, 0.4); } +/* ========================= + Game Notification +========================= */ + +#game-notification { + position: fixed; + top: 50%; + left: 50%; + transform: translate(-50%, -50%) scale(0.85); + + z-index: 9999; + + width: 360px; + max-width: 90vw; + + background: url("/images/parchment.png") center / cover no-repeat; + + border: 3px solid #6b4b2a; + border-radius: 10px; + + box-shadow: + 0 0 40px rgba(0, 0, 0, 0.9), + inset 0 0 20px rgba(0, 0, 0, 0.4); + + display: none; + opacity: 0; + + transition: + opacity 0.2s ease, + transform 0.2s ease; +} + +#game-notification.show { + display: block; + opacity: 1; + transform: translate(-50%, -50%) scale(1); +} + +.notification-header { + padding: 12px 16px; + + background: linear-gradient(#6b4b2a, #3c2414); + border-bottom: 2px solid #8b6a3c; + border-radius: 7px 7px 0 0; + + font-family: "Tangerine", serif; + font-size: 28px; + color: #f0d9a6; + text-shadow: 0 2px 4px black; + + display: flex; + align-items: center; + gap: 8px; +} + +.notification-body { + padding: 20px 20px 10px 20px; + + font-family: "Cinzel", serif; + font-size: 15px; + color: #2b1b0f; + line-height: 1.6; + text-align: center; +} + +.notification-footer { + padding: 10px 20px 16px 20px; + display: flex; + justify-content: center; +} + +.notification-btn { + padding: 8px 28px !important; + font-size: 14px !important; + font-family: "Cinzel", serif !important; + font-weight: bold !important; + background: linear-gradient(#7a5a2a, #caa24b) !important; + border: 1px solid #e0c67b !important; + border-radius: 4px; + color: #1a1206 !important; + cursor: pointer; + transition: 0.2s; + margin-top: 0 !important; +} + +.notification-btn:hover { + transform: scale(1.05); + box-shadow: + 0 0 10px #ffd66b, + 0 0 20px #caa24b; +} + +#game-notification-overlay { + position: fixed; + inset: 0; + background: rgba(0, 0, 0, 0.5); + z-index: 9998; + display: none; +} + +#game-notification-overlay.show { + display: block; +} + /* ========================= Animation ========================= */ diff --git a/public/js/buildings/schwarzmarkt.js b/public/js/buildings/schwarzmarkt.js index d11861e..8c3258b 100644 --- a/public/js/buildings/schwarzmarkt.js +++ b/public/js/buildings/schwarzmarkt.js @@ -1,3 +1,35 @@ +/* ================================ + Eigene Benachrichtigung +================================ */ + +function showNotification(message, title = "Hinweis", icon = "⚔️") { + const overlay = document.getElementById("game-notification-overlay"); + const notification = document.getElementById("game-notification"); + const msgEl = document.getElementById("notification-message"); + const titleEl = document.getElementById("notification-title"); + const iconEl = document.getElementById("notification-icon"); + const okBtn = document.getElementById("notification-ok"); + + msgEl.innerText = message; + titleEl.innerText = title; + iconEl.innerText = icon; + + overlay.classList.add("show"); + notification.style.display = "block"; + + requestAnimationFrame(() => { + notification.classList.add("show"); + }); + + okBtn.onclick = () => { + notification.classList.remove("show"); + overlay.classList.remove("show"); + setTimeout(() => { + notification.style.display = "none"; + }, 200); + }; +} + export async function loadSchwarzmarkt() { const ui = document.querySelector(".building-ui"); @@ -115,14 +147,18 @@ document.addEventListener("click", async (e) => { const data = await res.json(); if (data.error) { - alert(data.error); + showNotification(data.error, "Nicht genug Gold", "🪙"); return; } loadPages(); } catch (err) { console.error("Kauf Fehler:", err); - alert("Fehler beim Kauf. Bitte erneut versuchen."); + showNotification( + "Fehler beim Kauf. Bitte erneut versuchen.", + "Fehler", + "⚠️", + ); } }); diff --git a/views/launcher.ejs b/views/launcher.ejs index 03ad903..c94cdae 100644 --- a/views/launcher.ejs +++ b/views/launcher.ejs @@ -203,6 +203,20 @@
+ +
+
+
+ ⚔️ + Hinweis +
+
+

+
+ +