uiöui
This commit is contained in:
parent
ba952fe607
commit
0100b5b7ed
@ -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();
|
||||
}
|
||||
|
||||
|
||||
Loading…
Reference in New Issue
Block a user