Fix: Leaflet 'L is not defined' - Integrity-Hashes entfernt + Guard

- SRI integrity-Hashes von Leaflet CDN-Links entfernt (verursachen
  stille Blockierung wenn Hash nicht passt)
- renderMap() prueft ob L verfuegbar ist und merkt sich Locations
- retryPendingMap() rendert nachtraeglich wenn Leaflet spaeter bereit ist
- 2s Retry-Timer nach init() als Fallback

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
Dieser Commit ist enthalten in:
claude-dev
2026-03-04 22:46:58 +01:00
Ursprung 2f6dd97100
Commit 75df9fc66d
3 geänderte Dateien mit 33 neuen und 8 gelöschten Zeilen

Datei anzeigen

@@ -602,12 +602,26 @@ const UI = {
_map: null,
_mapCluster: null,
_pendingLocations: null,
renderMap(locations) {
const container = document.getElementById('map-container');
const emptyEl = document.getElementById('map-empty');
const statsEl = document.getElementById('map-stats');
if (!container) return;
// Leaflet noch nicht geladen? Locations merken und spaeter rendern
if (typeof L === 'undefined') {
this._pendingLocations = locations;
// Statistik trotzdem anzeigen
if (locations && locations.length > 0) {
const totalArticles = locations.reduce((s, l) => s + l.article_count, 0);
if (statsEl) statsEl.textContent = `${locations.length} Orte / ${totalArticles} Artikel`;
if (emptyEl) emptyEl.style.display = 'none';
}
return;
}
if (!locations || locations.length === 0) {
if (emptyEl) emptyEl.style.display = 'flex';
if (statsEl) statsEl.textContent = '';
@@ -723,6 +737,14 @@ const UI = {
if (this._map) this._map.invalidateSize();
},
retryPendingMap() {
if (this._pendingLocations && typeof L !== 'undefined') {
const locs = this._pendingLocations;
this._pendingLocations = null;
this.renderMap(locs);
}
},
/**
* HTML escapen.
*/