';
- for (var i = 0; i < snaps.length; i++) {
- var snap = snaps[i];
+ var h = '
';
+ for (var i = 0; i < ordered.length; i++) {
+ var snap = ordered[i];
var isActive = (String(snap.id) === String(activeSnapId));
- h += '';
}
h += '
';
dropdown.innerHTML = h;
dropdown.classList.add('open');
+
+ // Scroll to active point
+ var activePoint = dropdown.querySelector('.h-timeline-point.active');
+ if (activePoint) {
+ setTimeout(function() {
+ activePoint.scrollIntoView({ behavior: 'smooth', inline: 'center', block: 'nearest' });
+ }, 50);
+ }
},
toDateKey: function(iso) {
@@ -394,7 +403,7 @@ var Lagebild = {
sources_json: sj || [],
updated_at: sd.created_at,
articles: this.data.articles,
- fact_checks: this.data.fact_checks
+ fact_checks: this.getFactChecksAtTime(sd.created_at)
};
this.allSnapshots[id] = this.currentView;
this.renderCurrentView();
@@ -410,6 +419,12 @@ 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;
+ var heroFc = document.getElementById('hero-fc-count');
+ if (heroFc) heroFc.textContent = fcCount.toLocaleString('de-DE');
},
/* ===== TAB: LAGEBILD ===== */
@@ -943,6 +958,42 @@ var Lagebild = {
}
},
+ /* ===== FAKTENCHECK-FILTER NACH ZEITRAUM ===== */
+ getFactChecksAtTime: function(cutoff) {
+ var allFCs = this.data.fact_checks || [];
+ if (!cutoff) return allFCs;
+ var cutoffTime = new Date(this.toUTC(cutoff)).getTime();
+ var filtered = [];
+ for (var i = 0; i < allFCs.length; i++) {
+ var fc = allFCs[i];
+ var hist = fc.status_history || [];
+ if (!hist.length) continue;
+ // Erster Eintrag = Erstellungszeitpunkt des Faktenchecks
+ var firstAt = new Date(this.toUTC(hist[0].at)).getTime();
+ if (firstAt > cutoffTime) continue;
+ // Status zum gewaehlten Zeitpunkt ermitteln
+ var statusAtTime = hist[0].status;
+ for (var j = 0; j < hist.length; j++) {
+ var stepTime = new Date(this.toUTC(hist[j].at)).getTime();
+ if (stepTime <= cutoffTime) {
+ statusAtTime = hist[j].status;
+ }
+ }
+ // Kopie mit angepasstem Status und getrimmter History
+ var copy = {};
+ for (var key in fc) { if (fc.hasOwnProperty(key)) copy[key] = fc[key]; }
+ copy.status = statusAtTime;
+ copy.status_history = [];
+ for (var j = 0; j < hist.length; j++) {
+ if (new Date(this.toUTC(hist[j].at)).getTime() <= cutoffTime) {
+ copy.status_history.push(hist[j]);
+ }
+ }
+ filtered.push(copy);
+ }
+ return filtered;
+ },
+
/* ===== HILFSFUNKTIONEN ===== */
extractDomain: function(url) {
if (!url) return null;