Phase 0+1: Scaffold, Datenmodell, Karte und Liste

Reines HTML5/CSS3/JavaScript ohne Build-Tooling, lauffaehig direkt per
Doppelklick auf index.html (file://, kein Server noetig):

- Datenmodell fuer Ausflugsziele mit allen Feldern aus der Anforderung,
  15 feste Kategorien inkl. Farbe/Icon
- Zentraler Pub/Sub-Store mit LocalStorage-Persistenz und
  Migrations-Grundgeruest
- Interaktive Karte (Leaflet + Leaflet.markercluster, lokal vendored)
  mit kategoriefarbenen Markern, Clustering, Popups, Geolocation-Button
- Kartengrundlage ueber CARTO-Basemaps statt tile.openstreetmap.org, da
  dessen Referer-Pflicht file://-Aufrufe blockiert
- Seed-Daten als eingebettetes Script (data/seed.js) statt JSON-Datei,
  da fetch() auf lokale Dateien unter file:// nicht zuverlaessig
  funktioniert
- Ergebnisliste mit 10 Beispiel-Ausflugszielen, sicher gerendert ueber
  textContent/DOM-APIs statt innerHTML (Vorbereitung fuer spaeteren
  KI-JSON-Import mit Fremddaten)
- Responsives Layout (Desktop nebeneinander, Mobile gestapelt)
This commit is contained in:
2026-07-24 11:24:47 +02:00
parent 6b0d10c4fb
commit ee55fb1cf9
32 changed files with 2557 additions and 0 deletions
+39
View File
@@ -0,0 +1,39 @@
// Optionale Standortabfrage via navigator.geolocation. Wird nur auf
// explizite Nutzeraktion (Button) angefragt, nie automatisch beim Start.
(function () {
const { setState, updateSettings } = EventMap.store;
/**
* Fragt den aktuellen Standort des Nutzers an.
* @param {{onSuccess?: (loc:{lat:number,lng:number}) => void, onError?: (err:Error) => void}} handlers
*/
function requestUserLocation({ onSuccess, onError } = {}) {
if (!('geolocation' in navigator)) {
const err = new Error('Geolocation wird von diesem Browser nicht unterstützt.');
console.warn('EventMap:', err.message);
if (onError) onError(err);
return;
}
navigator.geolocation.getCurrentPosition(
(position) => {
const userLocation = {
lat: position.coords.latitude,
lng: position.coords.longitude,
};
setState({ userLocation });
updateSettings({ userConsentGeo: true });
if (onSuccess) onSuccess(userLocation);
},
(error) => {
console.warn('EventMap: Standort konnte nicht ermittelt werden.', error.message);
updateSettings({ userConsentGeo: false });
if (onError) onError(error);
},
{ enableHighAccuracy: true, timeout: 10000, maximumAge: 60000 }
);
}
EventMap.map.requestUserLocation = requestUserLocation;
})();