Nachbericht: Sendeprotokoll je Minute, Kennzahlen, Verlauf mit Momenten

Der Server schreibt live je Minute Zuschauer und Beitraege in
reaktion_protokoll. nachbericht.html zeigt je Sendung aus dem Verlauf
Dauer, Spitze, Schnitt, Beitraege, Momente, die Kurve (Zuschauer blau,
Chat lila, Momente gelb) und die Momente mit Sprung ins Video. Chat-
Ausschlaege (doppeltes Mittel der 5 Minuten davor, >=3) werden 30 s davor
als Moment erkannt. Zahlen nur fuer die Regie, der Saal sieht nur die
markierten Momente. Link in der Werkstatt. pruef-reaktion 667.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
This commit is contained in:
2026-11-03 23:35:43 +01:00
co-authored by Claude Opus 5.5
parent 3cd40d4a55
commit 20d620109f
60 changed files with 1127 additions and 759 deletions
+51
View File
@@ -0,0 +1,51 @@
/* =====================================================================
DER NACHBERICHT (03.11.2026) – siehe nachbericht.js
Dunkel, ruhig, gedeckte Farben: Blau für Zuschauer, Lila für den Chat,
ein gedecktes Gelb für Momente. Nichts bewegt sich.
===================================================================== */
body.sg { min-height: 100dvh; }
.nb { max-width: 1100px; margin: 0 auto; padding: 16px; display: grid; gap: 18px; color: var(--c-text, #e8f1fa); }
.nb [hidden] { display: none !important; }
.nb__kopf { display: flex; flex-wrap: wrap; align-items: center; gap: 12px 18px; }
.nb__titel h1 { margin: 0; font-size: 1.35rem; }
.nb__titel p { margin: 2px 0 0; color: #a9a3bd; font-size: .9rem; }
.nb__wahl { margin-left: auto; display: grid; gap: 4px; font-size: .78rem; color: #a9a3bd; min-width: min(100%, 320px); }
.nb__wahl select { min-height: 44px; }
.nb__leer, .nb__hinweis { color: #a9a3bd; line-height: 1.55; }
.nb__zahlen { display: grid; grid-template-columns: repeat(auto-fit, minmax(150px, 1fr)); gap: 10px; }
.nb__karte {
display: grid; gap: 4px; padding: 14px 16px;
border: 1px solid rgba(170, 180, 210, .2); border-radius: 14px;
background: rgba(255, 255, 255, .025);
}
.nb__karte-wort { font-size: .7rem; letter-spacing: .12em; text-transform: uppercase; color: #a9a3bd; }
.nb__karte-zahl { font-size: 1.35rem; }
.nb h2 { font-size: .78rem; letter-spacing: .14em; text-transform: uppercase; color: #8fd3ff; margin: 0 0 8px; }
.nb__legende { display: flex; flex-wrap: wrap; gap: 14px; margin: 0 0 8px; font-size: .8rem; color: #a9a3bd; }
.nb__l::before { content: ""; display: inline-block; width: 12px; height: 4px; border-radius: 2px; margin-right: 6px; vertical-align: middle; }
.nb__l--zus::before { background: #8fd3ff; }
.nb__l--chat::before { background: #a993e6; }
.nb__l--moment::before { background: #e6c35c; }
.nb__kurve {
width: 100%; height: 220px; display: block;
border: 1px solid rgba(170, 180, 210, .16); border-radius: 14px;
background: rgba(255, 255, 255, .02);
}
.nb__linie { stroke: #8fd3ff; stroke-width: 2; vector-effect: non-scaling-stroke; }
.nb__balken { fill: rgba(169, 147, 230, .45); }
.nb__marke { stroke-width: 1.5; vector-effect: non-scaling-stroke; }
.nb__marke--markiert { stroke: #e6c35c; }
.nb__marke--chat { stroke: #e6c35c; stroke-dasharray: 4 4; opacity: .7; }
.nb__liste { list-style: none; margin: 0; padding: 0; display: grid; gap: 8px; }
.nb__moment {
display: flex; flex-wrap: wrap; align-items: center; gap: 8px 14px;
padding: 10px 14px; border-radius: 12px;
border: 1px solid rgba(230, 195, 92, .22); background: rgba(230, 195, 92, .04);
}
.nb__moment--chat { border-style: dashed; }
.nb__moment-zeit { font-weight: 700; min-width: 8ch; }
.nb__moment-art { color: #a9a3bd; font-size: .88rem; flex: 1 1 auto; }
.nb__moment .btn { min-height: 44px; }
+5
View File
@@ -84,6 +84,11 @@
background: rgba(143, 211, 255, .09);
box-shadow: inset 0 0 0 1px rgba(143, 211, 255, .22);
}
.werkstatt-nav__link {
display: flex; align-items: center; min-height: 44px; padding: 0 12px; margin-top: 8px;
border-top: 1px solid var(--rand); color: #8fd3ff; font-size: .85rem; font-weight: 600; text-decoration: none;
}
.werkstatt-nav__link:hover { text-decoration: underline; }
.werkstatt-nav__knopf:focus-visible { outline: 2px solid #8fd3ff; outline-offset: 2px; }
.werkstatt-nav__zustand {
flex: none;
+126
View File
@@ -0,0 +1,126 @@
/* =====================================================================
DER NACHBERICHT (03.11.2026) – siehe nachbericht.html
Liest eine Sendung über /workspace/api/reaktion/nachbericht und zeichnet
sie. Die Regie bekommt Kennzahlen und Verlauf; alle anderen nur die
Momente – das schickt der Server schon so, diese Seite blendet nichts
„aus“, was sie gar nicht bekommen hat.
`window.__nb` trägt den geladenen Stand für die Prüfung.
===================================================================== */
(() => {
'use strict';
const $ = (id) => document.getElementById(id);
const el = (tag, cls, text) => { const e = document.createElement(tag); if (cls) e.className = cls; if (text != null) e.textContent = text; return e; };
const svgEl = (tag, attr) => { const e = document.createElementNS('http://www.w3.org/2000/svg', tag); for (const [k, v] of Object.entries(attr)) e.setAttribute(k, v); return e; };
const datum = (iso) => new Date(iso).toLocaleString('de-DE', { weekday: 'short', day: '2-digit', month: '2-digit', hour: '2-digit', minute: '2-digit' });
const dauer = (s) => (s == null ? '–' : s >= 3600 ? `${Math.floor(s / 3600)}:${String(Math.floor((s % 3600) / 60)).padStart(2, '0')} h` : `${Math.floor(s / 60)}:${String(s % 60).padStart(2, '0')} min`);
const mmss = (s) => `${Math.floor(s / 60)}:${String(Math.floor(s % 60)).padStart(2, '0')}`;
const videoId = (v) => (String(v || '').match(/(?:youtu\.be\/|v=|embed\/|shorts\/)([\w-]{11})/) || [, /^[\w-]{11}$/.test(v || '') ? v : ''])[1];
async function laden(id) {
let a;
try {
a = await fetch('/workspace/api/reaktion/nachbericht' + (id ? `?id=${encodeURIComponent(id)}` : ''), { credentials: 'same-origin', cache: 'no-store' });
} catch { $('nb-unter').textContent = 'Server nicht erreichbar – bitte neu laden.'; return; }
if (a.status === 401) { location.href = 'start.html'; return; }
const j = await a.json().catch(() => null);
if (!a.ok || !j) { $('nb-unter').textContent = 'Der Nachbericht ging gerade nicht.'; return; }
window.__nb = j;
zeichnen(j);
}
function zeichnen(j) {
$('nb').dataset.stand = j.da ? 'da' : 'leer';
$('nb-leer').hidden = !!j.da;
const wahl = $('nb-wahl');
wahl.textContent = '';
for (const s of j.liste || []) {
const o = el('option', '', `${s.titel || 'ohne Titel'} · ${datum(s.beendet)}`);
o.value = s.id;
if (s.id === j.sendung?.id) o.selected = true;
wahl.append(o);
}
wahl.closest('.nb__wahl').hidden = (j.liste || []).length < 2;
if (!j.da) { $('nb-unter').textContent = ''; $('nb-zahlen').hidden = true; $('nb-verlauf').hidden = true; momenteZeichnen([], null); return; }
$('nb-unter').textContent = `${j.sendung.titel || 'ohne Titel'} · ${j.sendung.begonnen ? datum(j.sendung.begonnen) : ''}`;
$('nb-zahlen').hidden = !j.regie;
$('nb-verlauf').hidden = !j.regie;
if (j.regie) { zahlenZeichnen(j); kurveZeichnen(j); }
momenteZeichnen(j.momente || [], j.sendung);
}
function zahlenZeichnen(j) {
const z = j.kennzahlen;
const karten = [
['Dauer', dauer(z.dauer_s)],
['Spitze', z.spitze ?? '–'],
['Schnitt', z.schnitt == null ? '–' : String(z.schnitt).replace('.', ',')],
['Beiträge', z.beitraege ?? '–'],
['Momente', `${z.momente}${z.ausschlaege ? ` + ${z.ausschlaege} Chat` : ''}`],
];
const f = $('nb-zahlen');
f.textContent = '';
for (const [n, w] of karten) {
const k = el('div', 'nb__karte');
k.append(el('span', 'nb__karte-wort', n), el('strong', 'nb__karte-zahl', String(w)));
f.append(k);
}
}
function kurveZeichnen(j) {
const svg = $('nb-kurve');
svg.textContent = '';
const m = j.minuten || [];
const hinweis = $('nb-kurve-hinweis');
hinweis.hidden = m.length >= 2;
hinweis.textContent = m.length < 2 ? 'Für diese Sendung gibt es noch keinen Verlauf je Minute (aufgezeichnet wird seit dem 03.11.2026).' : '';
if (m.length < 2) { svg.setAttribute('aria-label', 'kein Verlauf'); return; }
const B = 800, H = 220, P = 14;
const t0 = Date.parse(m[0].zeit), t1 = Date.parse(m[m.length - 1].zeit);
const x = (iso) => P + ((Date.parse(iso) - t0) / Math.max(1, t1 - t0)) * (B - 2 * P);
const maxZ = Math.max(1, ...m.map((p) => p.zuschauer));
const maxC = Math.max(1, ...m.map((p) => p.beitraege));
const breite = Math.min(24, Math.max(2, (B - 2 * P) / m.length - 2));
for (const p of m) {
const h = (p.beitraege / maxC) * (H * 0.45);
svg.append(svgEl('rect', { x: x(p.zeit) - breite / 2, y: H - P - h, width: breite, height: h, class: 'nb__balken' }));
}
svg.append(svgEl('polyline', { points: m.map((p) => `${x(p.zeit)},${H - P - (p.zuschauer / maxZ) * (H - 2 * P)}`).join(' '), class: 'nb__linie', fill: 'none' }));
for (const mo of j.momente || []) {
const mx = Math.min(B - P, Math.max(P, x(mo.zeit)));
svg.append(svgEl('line', { x1: mx, x2: mx, y1: P, y2: H - P, class: `nb__marke nb__marke--${mo.art}` }));
}
svg.setAttribute('aria-label', `Verlauf über ${m.length} Minuten: höchstens ${maxZ} Zuschauer, höchstens ${maxC} Beiträge in einer Minute, ${(j.momente || []).length} Momente`);
}
function momenteZeichnen(momente, sendung) {
const ol = $('nb-liste');
ol.textContent = '';
$('nb-momente-leer').hidden = momente.length > 0;
const id = videoId(sendung?.video);
const start = Date.parse(sendung?.begonnen || '') || null;
for (const mo of momente) {
const li = el('li', `nb__moment nb__moment--${mo.art || 'markiert'}`);
const wann = start ? mmss(Math.max(0, (Date.parse(mo.zeit) - start) / 1000)) : datum(mo.zeit);
li.append(el('span', 'nb__moment-zeit', `nach ${wann}`));
li.append(el('span', 'nb__moment-art', mo.art === 'chat' ? `Chat-Ausschlag (${mo.beitraege} Beiträge), 30 s davor` : 'von euch markiert'));
if (id && typeof mo.sekunde === 'number') {
const a = el('a', 'btn btn-klein btn-sekundaer', `Im Video bei ${mmss(mo.sekunde)}`);
a.href = `https://www.youtube.com/watch?v=${id}&t=${Math.max(0, Math.floor(mo.sekunde - 5))}s`;
a.target = '_blank';
a.rel = 'noopener';
li.append(a);
}
ol.append(li);
}
}
function start() {
$('nb-wahl').addEventListener('change', (e) => laden(e.target.value));
const id = new URLSearchParams(location.search).get('id');
laden(id);
}
if (document.readyState === 'loading') document.addEventListener('DOMContentLoaded', start);
else start();
})();
+7
View File
@@ -78,6 +78,13 @@
k.addEventListener('click', () => waehlen(b.id, true));
nav.append(k);
}
/* Kein Bereich, sondern ein Weg: der Nachbericht der letzten Sendungen. */
const nb = document.createElement('a');
nb.className = 'werkstatt-nav__link';
nb.id = 'werkstatt-nachbericht';
nb.href = 'nachbericht.html';
nb.textContent = 'Nachbericht →';
nav.append(nb);
}
function zustaendeZeichnen() {