From 0100b5b7ed3ed8a82348cd13bf62216caa78e52f Mon Sep 17 00:00:00 2001 From: cay Date: Fri, 10 Apr 2026 07:07:07 +0100 Subject: [PATCH] =?UTF-8?q?ui=C3=B6ui?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- public/js/map-ui.js | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/public/js/map-ui.js b/public/js/map-ui.js index 9f6fe67..cb10e4b 100644 --- a/public/js/map-ui.js +++ b/public/js/map-ui.js @@ -247,13 +247,13 @@ document.querySelector(".popup-close").onclick = () => { document.querySelectorAll(".building").forEach((building) => { building.addEventListener("mouseenter", async (e) => { try { - const id = building.dataset.id; + // data-id bevorzugen, sonst ID aus href extrahieren (z.B. "/building/5" → "5") + const id = building.dataset.id || building.getAttribute("href")?.split("/").pop(); + if (!id) return; if (!tooltipCache[id]) { const res = await fetch("/api/building/" + id); - if (!res.ok) throw new Error("API Fehler"); - tooltipCache[id] = await res.json(); }