perf: Produktseite laedt summary.json statt current.json (116 KB statt 10,4 MB)
- Produktseite fetcht summary.json statt der vollen current.json - ~90x kleinere Datenmenge, deutlich schnellere Ladezeit - Zusammenfassung bereits serverseitig extrahiert Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
Dieser Commit ist enthalten in:
@@ -130,11 +130,11 @@
|
||||
}
|
||||
|
||||
function loadLiveData() {
|
||||
fetch('/lagen/iran-konflikt/data/current.json?t=' + Date.now())
|
||||
fetch('/lagen/iran-konflikt/data/summary.json?t=' + Date.now())
|
||||
.then(function (r) { if (!r.ok) throw new Error(r.status); return r.json(); })
|
||||
.then(function (data) {
|
||||
var inc = data.incident || {};
|
||||
var lag = data.current_lagebild || {};
|
||||
// summary.json has flat structure
|
||||
|
||||
var ea = document.getElementById('stat-articles');
|
||||
var es = document.getElementById('stat-sources');
|
||||
@@ -143,32 +143,12 @@
|
||||
if (ea) ea.textContent = inc.article_count || 0;
|
||||
if (es) es.textContent = inc.source_count || 0;
|
||||
if (ef) ef.textContent = inc.factcheck_count || 0;
|
||||
if (eu && lag.updated_at) eu.textContent = timeAgo(lag.updated_at);
|
||||
if (eu && data.updated_at) eu.textContent = timeAgo(data.updated_at);
|
||||
|
||||
// Excerpt: only the "Zusammenfassung aktueller Entwicklungen" section
|
||||
// Excerpt: pre-extracted in summary.json
|
||||
var excerptEl = document.getElementById('excerpt-text');
|
||||
if (excerptEl && lag.summary_markdown) {
|
||||
var md = lag.summary_markdown;
|
||||
var sections = md.split(/^## /m);
|
||||
var zusammenfassung = '';
|
||||
for (var s = 0; s < sections.length; s++) {
|
||||
if (sections[s].indexOf('Zusammenfassung') === 0) {
|
||||
zusammenfassung = '## ' + sections[s];
|
||||
break;
|
||||
}
|
||||
}
|
||||
if (!zusammenfassung) {
|
||||
// Fallback: first section after first heading
|
||||
zusammenfassung = sections.length > 1 ? '## ' + sections[1] : md.split('
|
||||
|
||||
').slice(0, 3).join('
|
||||
|
||||
');
|
||||
}
|
||||
// Remove the next ## heading if captured
|
||||
zusammenfassung = zusammenfassung.replace(/
|
||||
## [\s\S]*$/, '');
|
||||
excerptEl.innerHTML = mdToHtml(zusammenfassung);
|
||||
if (excerptEl && data.zusammenfassung) {
|
||||
excerptEl.innerHTML = mdToHtml(data.zusammenfassung);
|
||||
}
|
||||
|
||||
// Map
|
||||
|
||||
In neuem Issue referenzieren
Einen Benutzer sperren