Exakte Ort-Artikel-Zuordnung + Lage zentriert im Header
Monitor-Feed liefert jetzt pro Standort die vollstaendigen Artikel: Headline, Quelle, URL, Inhalts-Auszug, Datum. Keine globale Summary mehr, keine Proximity-Heuristik. Klick auf Waldbrand USA -> zeigt US-Waldbrand-Artikel Klick auf Kenia -> zeigt Kenia-Ueberschwemmungs-Artikel Klick auf Erdbeben -> zeigt naechsten passenden Artikel Lage-Auswahl zentriert in der Header-Leiste.
Dieser Commit ist enthalten in:
@@ -35,75 +35,36 @@ const DisastersLayer = {
|
||||
.catch(function() {});
|
||||
},
|
||||
|
||||
_findMonitorInfo(lat, lon) {
|
||||
if (!this._monitorData) return null;
|
||||
var selectedId = (typeof Globe !== 'undefined') ? Globe._currentLageId : null;
|
||||
if (!selectedId) return null;
|
||||
|
||||
// Naechsten Monitor-Standort zur Klickposition finden
|
||||
_buildMonitorHtml(lat, lon) {
|
||||
if (!this._monitorData) return '';
|
||||
var features = this._monitorData.features || [];
|
||||
var best = null, bestDist = 999;
|
||||
for (var i = 0; i < features.length; i++) {
|
||||
var f = features[i];
|
||||
var c = f.geometry.coordinates;
|
||||
var c = features[i].geometry.coordinates;
|
||||
var d = Math.abs(c[1] - lat) + Math.abs(c[0] - lon);
|
||||
if (d < bestDist) { bestDist = d; best = f; }
|
||||
if (d < bestDist) { bestDist = d; best = features[i]; }
|
||||
}
|
||||
if (!best || bestDist > 3) return '';
|
||||
|
||||
// Lage-Infos
|
||||
var incidents = this._monitorData.incidents || [];
|
||||
var incident = null;
|
||||
for (var j = 0; j < incidents.length; j++) {
|
||||
if (incidents[j].id === selectedId) { incident = incidents[j]; break; }
|
||||
}
|
||||
|
||||
if (!best || bestDist > 5) return { incident: incident, feature: null };
|
||||
return { incident: incident, feature: best };
|
||||
},
|
||||
|
||||
_buildMonitorHtml(lat, lon) {
|
||||
var info = this._findMonitorInfo(lat, lon);
|
||||
if (!info || !info.incident) return '';
|
||||
var p = best.properties;
|
||||
var articles = p.articles || [];
|
||||
if (!articles.length) return '';
|
||||
|
||||
var html = '<div style="border-top:1px solid #333;padding-top:8px;margin-top:8px">';
|
||||
html += '<div style="color:#00ff88;font-size:10px;letter-spacing:1px;margin-bottom:6px">MONITOR: ' +
|
||||
(info.incident.title || 'LAGE').toUpperCase() + '</div>';
|
||||
|
||||
// Ortsspezifische Headlines wenn passender Standort gefunden
|
||||
if (info.feature) {
|
||||
var p = info.feature.properties;
|
||||
var headlines = p.headlines || [];
|
||||
if (headlines.length && headlines[0]) {
|
||||
html += '<div style="color:#00ff88;font-size:11px;margin-bottom:4px">' + (p.name || '') +
|
||||
' (' + (p.article_count || 0) + ' Artikel)</div>';
|
||||
html += '<div style="border-left:2px solid #00ff88;padding-left:8px;margin-bottom:8px">';
|
||||
for (var h = 0; h < Math.min(headlines.length, 3); h++) {
|
||||
if (headlines[h] && headlines[h].trim()) {
|
||||
html += '<div style="color:#e0e0e0;font-size:11px;margin-bottom:3px">• ' +
|
||||
headlines[h].trim().substring(0, 120) + '</div>';
|
||||
}
|
||||
}
|
||||
html += '</div>';
|
||||
}
|
||||
} else {
|
||||
// Kein passender Standort in der Naehe — globale Summary
|
||||
if (info.incident.summary) {
|
||||
var summary = info.incident.summary
|
||||
.replace(/##?\s*/g, '').replace(/\*\*/g, '').replace(/\[(\d+)\]/g, '')
|
||||
.substring(0, 400);
|
||||
html += '<div style="color:#ccc;font-size:11px;line-height:1.5">' + summary + '</div>';
|
||||
}
|
||||
}
|
||||
|
||||
if (info.incident.updated_at) {
|
||||
html += '<div style="color:#666;font-size:9px;margin-top:4px">Stand: ' +
|
||||
new Date(info.incident.updated_at).toLocaleString('de-DE') + '</div>';
|
||||
}
|
||||
html += '<div style="color:#00ff88;font-size:10px;letter-spacing:1px;margin-bottom:4px">MONITOR: ' +
|
||||
(p.name || '').toUpperCase() + ' (' + (p.article_count || 0) + ' Artikel)</div>';
|
||||
articles.forEach(function(a) {
|
||||
html += '<div style="border-left:2px solid #00ff88;padding-left:8px;margin-bottom:6px">';
|
||||
html += '<div style="color:#e0e0e0;font-size:11px;font-weight:700">' + (a.headline || '') + '</div>';
|
||||
if (a.summary) html += '<div style="color:#bbb;font-size:10px;margin-top:2px">' + a.summary.substring(0, 200) + '</div>';
|
||||
if (a.source) html += '<div style="color:#666;font-size:9px">' + a.source + '</div>';
|
||||
html += '</div>';
|
||||
});
|
||||
html += '</div>';
|
||||
return html;
|
||||
},
|
||||
|
||||
_fetch() {
|
||||
_fetch() {
|
||||
var self = this;
|
||||
var loadEl = document.getElementById('loading-disasters');
|
||||
var statusEl = document.getElementById('status-disasters');
|
||||
|
||||
In neuem Issue referenzieren
Einen Benutzer sperren