Modal, das sich bei Marker- oder Listen-Auswahl (state.selectedPlaceId) oeffnet: Titelbild/Platzhalter, vollstaendige Beschreibung, Adresse, Mini-Karte mit Positionsmarker, Oeffnungszeiten, Kosten, Altersempfehlung, Ausstattung (inkl. klar markierter negativer Werte), Hinweise fuer Familien, Website-Link. Navigation-Button zu OSM Directions. Loeschen ist bereits voll funktional (mit Bestaetigung), Bearbeiten ist als Platzhalter fuer Phase 3 markiert. Neuer Helper isSafeHttpUrl() in dom.js: nur http/https als Link- oder Bildquelle zulaessig, schuetzt vor javascript:-URLs in Fremddaten (Vorbereitung fuer KI-JSON-Import). Rendering weiterhin ausschliesslich ueber textContent/el(), kein innerHTML mit Place-Daten.
55 lines
1.5 KiB
JavaScript
55 lines
1.5 KiB
JavaScript
// Einstiegspunkt der Anwendung: initialisiert Store, Karte und Liste.
|
|
|
|
(function () {
|
|
const { initStore } = EventMap.store;
|
|
const { initMap, centerOnCoords, requestUserLocation } = EventMap.map;
|
|
const { initList, initDetail } = EventMap.ui;
|
|
|
|
function showFatalError(message) {
|
|
const status = document.getElementById('app-status');
|
|
if (!status) return;
|
|
status.textContent = message;
|
|
status.hidden = false;
|
|
}
|
|
|
|
function setupGeolocationButton() {
|
|
const button = document.getElementById('locate-btn');
|
|
if (!button) return;
|
|
|
|
const defaultLabel = button.textContent;
|
|
|
|
button.addEventListener('click', () => {
|
|
button.disabled = true;
|
|
button.textContent = 'Standort wird ermittelt…';
|
|
|
|
requestUserLocation({
|
|
onSuccess: ({ lat, lng }) => {
|
|
centerOnCoords(lat, lng, 13);
|
|
button.disabled = false;
|
|
button.textContent = defaultLabel;
|
|
},
|
|
onError: () => {
|
|
button.disabled = false;
|
|
button.textContent = defaultLabel;
|
|
showFatalError(
|
|
'Standort konnte nicht ermittelt werden. Bitte Standortfreigabe im Browser prüfen.'
|
|
);
|
|
},
|
|
});
|
|
});
|
|
}
|
|
|
|
async function bootstrap() {
|
|
await initStore();
|
|
initMap('map');
|
|
initList('place-list');
|
|
initDetail('detail-modal');
|
|
setupGeolocationButton();
|
|
}
|
|
|
|
bootstrap().catch((err) => {
|
|
console.error('EventMap: Initialisierung fehlgeschlagen.', err);
|
|
showFatalError('Die Anwendung konnte nicht geladen werden. Bitte Seite neu laden.');
|
|
});
|
|
})();
|