34 lines
1.5 KiB
JavaScript
34 lines
1.5 KiB
JavaScript
/* =====================================================================
|
||
NACHSCHAUEN IM FOYER (05.11.2026, Perfektionsplan Runde 8)
|
||
|
||
„Zuletzt“ im Foyer öffnet den Nachbericht – und der hat seit heute
|
||
„Nachschauen“. Diese Datei sagt es an der Karte: „▶ Nachschauen“, und
|
||
„mit Chat von damals“, wenn die Regie ihn aufgehoben hat. Gelesen wird
|
||
die Liste, die der Nachbericht selbst benutzt.
|
||
===================================================================== */
|
||
(() => {
|
||
'use strict';
|
||
let liste = null;
|
||
const el = (tag, cls, text) => { const e = document.createElement(tag); if (cls) e.className = cls; if (text != null) e.textContent = text; return e; };
|
||
async function laden() {
|
||
try {
|
||
const a = await fetch('/workspace/api/reaktion/nachschauen', { credentials: 'same-origin', cache: 'no-store' });
|
||
const j = await a.json().catch(() => null);
|
||
liste = a.ok && Array.isArray(j?.liste) ? j.liste : [];
|
||
} catch { liste = []; }
|
||
zeichnen();
|
||
}
|
||
function zeichnen() {
|
||
if (!liste) return;
|
||
for (const s of liste) {
|
||
const li = document.querySelector(`#zuletzt-liste [data-sendung="${CSS.escape(String(s.id))}"]`);
|
||
if (!li || li.querySelector('.fy-ns')) continue;
|
||
const z = el('span', 'fy-ns', s.chat ? '▶ Nachschauen · mit Chat von damals' : '▶ Nachschauen');
|
||
(li.querySelector('a') || li).append(z);
|
||
}
|
||
}
|
||
const ziel = document.getElementById('zuletzt-liste');
|
||
if (ziel) new MutationObserver(zeichnen).observe(ziel, { childList: true });
|
||
laden();
|
||
})();
|