diff --git a/lagebild/lagebild.js b/lagebild/lagebild.js index f8f40c2..aa7f90b 100644 --- a/lagebild/lagebild.js +++ b/lagebild/lagebild.js @@ -37,7 +37,9 @@ var Lagebild = { sources_json: this.data.current_lagebild.sources_json, updated_at: this.data.current_lagebild.updated_at || this.data.generated_at, articles: this.data.articles, - fact_checks: this.data.fact_checks + fact_checks: this.data.fact_checks, + article_count: this.data.incident.article_count, + fact_check_count: this.data.incident.factcheck_count }; this.render(); this.initTabs(); @@ -162,8 +164,8 @@ var Lagebild = { // Stat Cards (3: Artikel, Quellen, Faktenchecks) var statsHtml = ''; - statsHtml += this.statCard(this.icons.fileText, '0', 'Artikel'); - statsHtml += this.statCard(this.icons.globe, '0', 'Quellen'); + statsHtml += this.statCard(this.icons.fileText, '0', 'Artikel'); + statsHtml += this.statCard(this.icons.globe, '0', 'Quellen'); statsHtml += this.statCard(this.icons.shieldCheck, '0', 'Faktenchecks'); document.getElementById('hero-stats').innerHTML = statsHtml; @@ -292,7 +294,9 @@ var Lagebild = { sources_json: self.data.current_lagebild.sources_json, updated_at: self.data.current_lagebild.updated_at || self.data.generated_at, articles: self.data.articles, - fact_checks: self.data.fact_checks + fact_checks: self.data.fact_checks, + article_count: self.data.incident.article_count, + fact_check_count: self.data.incident.factcheck_count }; self.renderCurrentView(); } else { @@ -317,7 +321,9 @@ var Lagebild = { sources_json: self.data.current_lagebild.sources_json, updated_at: self.data.current_lagebild.updated_at || self.data.generated_at, articles: self.data.articles, - fact_checks: self.data.fact_checks + fact_checks: self.data.fact_checks, + article_count: self.data.incident.article_count, + fact_check_count: self.data.incident.factcheck_count }; self.renderCurrentView(); } else { @@ -354,7 +360,7 @@ var Lagebild = { h += '' + this.fmtTimeOnly(snap.created_at) + ''; h += ''; h += ''; - h += ''; + h += ''; h += ''; } h += ''; @@ -402,8 +408,10 @@ var Lagebild = { summary: sd.summary, sources_json: sj || [], updated_at: sd.created_at, - articles: this.data.articles, - fact_checks: this.getFactChecksAtTime(sd.created_at) + articles: this.filterArticlesAtTime(sd.created_at), + fact_checks: this.getFactChecksAtTime(sd.created_at), + article_count: sd.article_count, + fact_check_count: sd.fact_check_count }; this.allSnapshots[id] = this.currentView; this.renderCurrentView(); @@ -419,12 +427,23 @@ var Lagebild = { if (document.getElementById('panel-karte').classList.contains('active')) { this.renderMap(); } - // Faktencheck-Zaehler aktualisieren (Badge + Hero) - var fcCount = (this.currentView.fact_checks || []).length; - var fcBadge = document.getElementById('tab-badge-faktenchecks'); - if (fcBadge) fcBadge.textContent = fcCount; + // Counts aktualisieren (Hero + Badges) + var articles = this.currentView.articles || []; + var artCount = this.currentView.article_count || articles.length; + var srcCount = new Set(articles.map(function(a) { return a.source; })).size; + var fcCount = this.currentView.fact_check_count || (this.currentView.fact_checks || []).length; + + var heroArt = document.getElementById('hero-art-count'); + if (heroArt) heroArt.textContent = artCount.toLocaleString('de-DE'); + var heroSrc = document.getElementById('hero-src-count'); + if (heroSrc) heroSrc.textContent = srcCount.toLocaleString('de-DE'); var heroFc = document.getElementById('hero-fc-count'); if (heroFc) heroFc.textContent = fcCount.toLocaleString('de-DE'); + + var fcBadge = document.getElementById('tab-badge-faktenchecks'); + if (fcBadge) fcBadge.textContent = fcCount; + var quellenBadge = document.getElementById('tab-badge-quellen'); + if (quellenBadge) quellenBadge.textContent = srcCount; }, /* ===== TAB: LAGEBILD ===== */ @@ -762,6 +781,14 @@ var Lagebild = { h += ''; h += ''; + // Hinweis bei unvollständiger Liste + var storedFcCount = this.currentView.fact_check_count || 0; + if (storedFcCount > 0 && checks.length < storedFcCount) { + h += '