From 462127dc522a68cab7491777422569c7c223a8f0 Mon Sep 17 00:00:00 2001 From: UserIsMH Date: Fri, 1 May 2026 16:04:02 +0200 Subject: [PATCH] Ereignis-Timeline: Heatmap-Klick-Bug beheben MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Inline-onclick mit JSON.stringify(label) + UI.escape erzeugte bei Bucket-Labels mit Anführungszeichen oder Sonderzeichen einen kaputten HTML-Attribut-String. Klicks lösten daher gar keinen Handler aus. Statt JS-String im onclick werden Bucket-Daten jetzt als data-start/data-end/data-label-Attribute am Cell-Element gehalten. Onclick ruft App.handleStripClick(this), das die Werte sauber aus dataset liest und an openTimelineWindow weiterreicht. Co-Authored-By: Claude Opus 4.7 (1M context) --- src/static/dashboard.html | 2 +- src/static/js/app.js | 14 +++++++++++++- 2 files changed, 14 insertions(+), 2 deletions(-) diff --git a/src/static/dashboard.html b/src/static/dashboard.html index 13e7bad..775117d 100644 --- a/src/static/dashboard.html +++ b/src/static/dashboard.html @@ -647,7 +647,7 @@ - + diff --git a/src/static/js/app.js b/src/static/js/app.js index d59ee90..a9e5b56 100644 --- a/src/static/js/app.js +++ b/src/static/js/app.js @@ -1298,7 +1298,8 @@ const App = { if (win && win.start === b.start && win.end === b.end) cls.push('active'); const tip = `${b.label}: ${b.articles} Meldung${b.articles === 1 ? '' : 'en'}` + (b.snapshots > 0 ? ` + ${b.snapshots} Lagebericht${b.snapshots === 1 ? '' : 'e'}` : ''); - html += `
`; + // data-Attribute statt JSON-String im onclick-Inline (vermeidet Quote-Konflikte bei Labels mit Komma/Anführungszeichen) + html += `
`; }); html += ''; @@ -1355,6 +1356,17 @@ const App = { this.rerenderTimeline(); }, + /** Robuster Click-Handler fuer Heatmap-Cells (vermeidet Quote-Konflikte). */ + handleStripClick(el) { + if (!el) return; + const start = parseInt(el.dataset.start, 10); + const end = parseInt(el.dataset.end, 10); + const label = el.dataset.label || ''; + if (!isNaN(start) && !isNaN(end)) { + this.openTimelineWindow(start, end, label); + } + }, + /** Klick auf Heatmap-Balken: Stream auf dieses Zeitfenster filtern. * Zweiter Klick auf denselben Balken hebt den Filter auf. */