diff --git a/workspace/assets/css/unterwegs.css b/workspace/assets/css/unterwegs.css new file mode 100644 index 00000000..e757f55b --- /dev/null +++ b/workspace/assets/css/unterwegs.css @@ -0,0 +1,98 @@ +/* ===================================================================== + REGIE UNTERWEGS (04.11.2026) – siehe unterwegs.js + + Nur am schmalen Handy mit Finger. Ein Blatt von unten, sechs große + Kacheln. Bewegt wird nur `transform` (Einfahren, Halten-Füllung); + bei „weniger Bewegung“ springt es ohne Fahrt. + ===================================================================== */ +.unterwegs-knopf { display: none !important; } +.uw { display: none; } + +@media (max-width: 560px) and (pointer: coarse) { + .regieleiste .unterwegs-knopf { + display: inline-flex !important; align-items: center; gap: 8px; + min-height: 44px; margin-left: auto; + } + .unterwegs-knopf + .werkstatt-knopf { margin-left: 0; } + .unterwegs-knopf__raster { display: inline-grid; grid-template-columns: repeat(3, 4px); gap: 2px; } + .unterwegs-knopf__raster i { width: 4px; height: 4px; border-radius: 1px; background: currentColor; opacity: .75; display: block; } + + .uw { + display: grid; grid-template-rows: auto minmax(0, 1fr) auto; + position: fixed; left: 0; right: 0; bottom: 0; z-index: 80; + padding: 6px 12px calc(12px + env(safe-area-inset-bottom, 0px)); + border-radius: 18px 18px 0 0; + border-top: 1px solid var(--rand-hell); + background: #0d0c16; + box-shadow: 0 -24px 50px -24px #000; + color: var(--schrift); + transform: translateY(105%); + visibility: hidden; + transition: transform .22s cubic-bezier(.2, .7, .3, 1), visibility 0s linear .22s; + } + .uw[data-auf="ja"] { + transform: translateY(0); + visibility: visible; + transition: transform .22s cubic-bezier(.2, .7, .3, 1), visibility 0s; + } + .uw__kopf { display: grid; grid-template-columns: 1fr auto; align-items: center; gap: 2px 8px; padding-bottom: 8px; } + .uw__griff { grid-column: 1 / -1; justify-self: center; width: 40px; height: 4px; border-radius: 2px; background: rgba(255, 255, 255, .18); margin-bottom: 4px; } + .uw__titel { margin: 0; font-size: .78rem; font-weight: 800; letter-spacing: .14em; text-transform: uppercase; color: var(--schrift-leise); } + .uw__zu { + appearance: none; cursor: pointer; width: 44px; height: 44px; border-radius: 12px; + border: 1px solid var(--rand); background: transparent; color: var(--schrift); + font: inherit; font-size: 1.4rem; line-height: 1; + } + .uw__wach { grid-column: 1 / -1; margin: 0; font-size: .78rem; color: var(--schrift-leise); } + .uw__wach[data-zustand="an"]::before { content: ""; display: inline-block; width: 8px; height: 8px; margin-right: 6px; border-radius: 50%; background: #6fcf97; } + .uw__wach[data-zustand="nicht"] { color: #ecd38a; } + + .uw__kacheln { + display: grid; grid-template-columns: 1fr 1fr; grid-auto-rows: minmax(88px, auto); gap: 8px; + overflow-y: auto; overscroll-behavior: contain; min-height: 0; + } + .uw-kachel { + appearance: none; cursor: pointer; position: relative; overflow: hidden; + display: grid; align-content: space-between; justify-items: start; gap: 6px; + min-height: 88px; padding: 12px; + border-radius: 14px; border: 1px solid var(--rand-hell); + background: rgba(255, 255, 255, .035); color: var(--schrift); + font: inherit; text-align: left; + } + .uw-kachel:focus-visible, .uw-stufe:focus-visible, .uw__zu:focus-visible { outline: 2px solid #9ab7ff; outline-offset: 2px; } + .uw-kachel:disabled { opacity: .5; cursor: default; } + .uw-kachel__titel { position: relative; font-size: .74rem; font-weight: 800; letter-spacing: .08em; text-transform: uppercase; color: var(--schrift-leise); } + .uw-kachel__wert { position: relative; font-size: 1rem; font-weight: 700; line-height: 1.25; } + .uw-kachel__hand { position: relative; font-size: .82rem; color: #f1dca0; } + .uw-kachel__hand[hidden] { display: none; } + + /* Sendung: im Live die Halten-Kachel in gedecktem Rot. */ + #uw-sendung[data-art="ende"] { border-color: rgba(239, 123, 123, .45); background: rgba(239, 123, 123, .06); color: #f3b3b3; touch-action: none; user-select: none; -webkit-user-select: none; } + #uw-sendung[data-art="start"]:not(:disabled) { border-color: rgba(143, 211, 255, .4); background: rgba(143, 211, 255, .07); } + .uw-kachel__fuell { position: absolute; inset: 0; background: rgba(239, 123, 123, .28); transform: scaleX(0); transform-origin: left center; } + #uw-sendung[data-halten="ja"] .uw-kachel__fuell { transform: scaleX(1); transition: transform 1s linear; } + + #uw-gaeste[data-hand="ja"] { border-color: rgba(230, 195, 92, .45); } + + .uw-kachel--chat { cursor: default; } + .uw-stufen { display: grid; grid-template-columns: repeat(3, 1fr); gap: 4px; width: 100%; } + .uw-stufe { + appearance: none; cursor: pointer; min-height: 44px; padding: 0 4px; + border-radius: 10px; border: 1px solid var(--rand); background: transparent; + color: var(--schrift-leise); font: inherit; font-size: .82rem; font-weight: 700; + } + .uw-stufe[aria-pressed="true"] { border-color: rgba(143, 211, 255, .5); background: rgba(143, 211, 255, .1); color: var(--schrift); } + + .uw-punkte { position: relative; display: inline-flex; gap: 4px; } + .uw-punkte i { width: 10px; height: 10px; border-radius: 50%; background: #5d5a6e; display: block; } + .uw-punkte i[data-stufe="gut"] { background: #6fcf97; } + .uw-punkte i[data-stufe="knapp"] { background: #e6c35c; } + .uw-punkte i[data-stufe="problem"] { background: #ef7b7b; } + + .uw__sagt { margin: 8px 0 0; min-height: 1.2em; font-size: .8rem; color: var(--schrift-leise); } +} + +@media (prefers-reduced-motion: reduce) { + .uw, .uw[data-auf="ja"] { transition: none !important; } + #uw-sendung[data-halten="ja"] .uw-kachel__fuell { transition: none; } +} diff --git a/workspace/assets/js/unterwegs.js b/workspace/assets/js/unterwegs.js new file mode 100644 index 00000000..2995b4f4 --- /dev/null +++ b/workspace/assets/js/unterwegs.js @@ -0,0 +1,362 @@ +/* ===================================================================== + REGIE UNTERWEGS (04.11.2026, Neuplan C12) + + Am schmalen Handy (bis 560 px, Finger) ist das Pult eine lange Seite + zum Scrollen. Unterwegs braucht die Regie aber nur eine Handvoll + Griffe – also ein BLATT VON UNTEN mit sechs großen Kacheln: + + 1 Sendung – „Auf Sendung“, im Live „Beenden · halten“ + 2 Moment – merkt die Stelle (wie Taste H) + 3 Chat – Offen / Team / Zu + 4 Gäste – wer auf der Bühne ist, wer bereit ist, wer ✋ hebt + 5 Ampel – Ton, Leitung, Rechner auf einen Blick + 6 Werkstatt – alles andere + + NICHTS DOPPELT: Jede Kachel drückt den Knopf, den es schon gibt + (`#p-starten`, `#cockpit-beenden`, `#cockpit-moment`, die Knöpfe in + `#chat-stufen`, `#cockpit-gaeste`, `#cockpit-ampel`, `#werkstatt-knopf`) + und liest ihren Zustand von dort ab. Beenden hält genau wie im Cockpit: + Das Halten wird an `#cockpit-beenden` weitergereicht, dessen Uhr + entscheidet. Eine Kachel ist ein zweiter Griff an derselben Funktion, + keine zweite Funktion – und sie hat keine eigene Taste. + + DER BILDSCHIRM BLEIBT AN (Screen Wake Lock), solange die Regie an einem + Gerät mit Finger live ist und die Seite vor Augen hat. Wird die Seite + verborgen, gibt das Gerät die Sperre frei; beim Zurückkommen wird sie + neu angefordert. Geht es nicht (kein Browser-Support, Stromsparmodus), + steht das im Blatt – „nicht möglich“ ist eine Antwort, kein Schweigen. + + Das Blatt liegt nie auf dem Video (YouTube-Regeln): Seine Höhe endet + über der Unterkante des Videos. + ===================================================================== */ +(() => { + '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 SCHMAL = window.matchMedia('(max-width: 560px) and (pointer: coarse)'); + const FINGER = window.matchMedia('(pointer: coarse)'); + let lage = null; + let gebaut = false; + let offen = false; + let takt = null; + + /* ========================================================= Wach */ + const wach = { sperre: null, zustand: 'aus', grund: '', anfragen: 0 }; + let fragtGerade = false; + function sollWach() { + return !!lage?.ich?.host && lage.stand === 'live' && FINGER.matches && document.visibilityState === 'visible'; + } + function wachSetzen(zustand, grund = '') { + wach.zustand = zustand; + wach.grund = grund; + wachZeichnen(); + } + async function wachAbgleichen() { + if (!sollWach()) { + if (wach.sperre) { + const s = wach.sperre; + wach.sperre = null; + try { await s.release(); } catch { /* schon frei */ } + } + wachSetzen(lage?.ich?.host && lage.stand === 'live' && document.visibilityState !== 'visible' ? 'pause' : 'aus'); + return; + } + if (wach.sperre && !wach.sperre.released) { wachSetzen('an'); return; } + if (!('wakeLock' in navigator) || typeof navigator.wakeLock?.request !== 'function') { + wachSetzen('nicht', 'Dieser Browser kann den Bildschirm nicht wach halten.'); + return; + } + if (fragtGerade) return; + fragtGerade = true; + wach.anfragen++; + try { + const s = await navigator.wakeLock.request('screen'); + /* Während der Anfrage kann die Sendung geendet haben. */ + if (!sollWach()) { try { await s.release(); } catch { /* egal */ } wachSetzen('aus'); return; } + wach.sperre = s; + s.addEventListener('release', () => { + if (wach.sperre === s) wach.sperre = null; + /* Vom Gerät beendet, obwohl die Seite vor Augen ist (z. B. + Stromsparmodus) – das wird gesagt; neu versucht wird beim + nächsten Zurückkommen oder Wechsel, nicht in einer Schleife. */ + if (sollWach()) wachSetzen('nicht', 'Das Gerät hat es wieder beendet (Stromsparmodus?).'); + else wachSetzen(document.visibilityState !== 'visible' && lage?.stand === 'live' ? 'pause' : 'aus'); + }); + wachSetzen('an'); + } catch (f) { + wachSetzen('nicht', f?.name === 'NotAllowedError' + ? 'Das Gerät erlaubt es gerade nicht (Stromsparmodus?).' + : 'Der Browser hat es abgelehnt.'); + } finally { fragtGerade = false; } + } + const WACH_SATZ = { + an: 'Bildschirm bleibt an, solange du live bist.', + aus: 'Bildschirm bleibt an, sobald du live bist.', + pause: 'Seite war verborgen – der Bildschirm wird beim Zurückkommen wieder wach gehalten.', + nicht: 'Bildschirm wach halten: nicht möglich.', + }; + function wachZeichnen() { + const p = $('uw-wach'); + if (!p) return; + p.dataset.zustand = wach.zustand; + p.textContent = wach.zustand === 'nicht' ? `${WACH_SATZ.nicht} ${wach.grund}` : WACH_SATZ[wach.zustand]; + $('unterwegs-knopf')?.setAttribute('data-wach', wach.zustand); + } + + /* ========================================================= Bauen */ + function kachel(id, titel) { + const k = el('button', 'uw-kachel'); + k.type = 'button'; + k.id = id; + const t = el('span', 'uw-kachel__titel', titel); + const w = el('span', 'uw-kachel__wert'); + w.id = `${id}-wert`; + k.append(t, w); + return k; + } + function bauen() { + if (gebaut) return; + const leiste = $('regieleiste'); + const werkstatt = $('werkstatt-knopf'); + if (!leiste || !werkstatt) return; + gebaut = true; + + const auf = el('button', 'btn btn-klein btn-sekundaer unterwegs-knopf'); + auf.type = 'button'; + auf.id = 'unterwegs-knopf'; + auf.setAttribute('aria-expanded', 'false'); + auf.setAttribute('aria-controls', 'unterwegs'); + const raster = el('span', 'unterwegs-knopf__raster'); + raster.setAttribute('aria-hidden', 'true'); + for (let i = 0; i < 6; i++) raster.append(el('i')); + auf.append(raster, el('span', '', 'Griffe')); + auf.addEventListener('click', () => (offen ? schliessen(true) : oeffnen())); + werkstatt.before(auf); + + const blatt = el('section', 'uw'); + blatt.id = 'unterwegs'; + blatt.setAttribute('role', 'dialog'); + blatt.setAttribute('aria-modal', 'false'); + blatt.setAttribute('aria-labelledby', 'uw-titel'); + blatt.dataset.auf = 'nein'; + blatt.inert = true; + const kopf = el('div', 'uw__kopf'); + const griff = el('span', 'uw__griff'); + griff.setAttribute('aria-hidden', 'true'); + const titel = el('h2', 'uw__titel', 'Regie unterwegs'); + titel.id = 'uw-titel'; + const zu = el('button', 'uw__zu'); + zu.type = 'button'; + zu.id = 'uw-zu'; + zu.setAttribute('aria-label', 'Griffe schließen'); + zu.textContent = '×'; + zu.addEventListener('click', () => schliessen(true)); + const wachZeile = el('p', 'uw__wach'); + wachZeile.id = 'uw-wach'; + wachZeile.setAttribute('role', 'status'); + kopf.append(griff, titel, zu, wachZeile); + + const feld = el('div', 'uw__kacheln'); + /* 1 Sendung */ + const sendung = kachel('uw-sendung', 'Sendung'); + sendung.prepend(el('span', 'uw-kachel__fuell')); + haltenVerdrahten(sendung); + /* 2 Moment */ + const moment = kachel('uw-moment', 'Moment'); + moment.addEventListener('click', () => { $('cockpit-moment')?.click(); }); + /* 3 Chat – drei Knöpfe, abgeleitet aus #chat-stufen */ + const chat = el('div', 'uw-kachel uw-kachel--chat'); + chat.id = 'uw-chat'; + chat.setAttribute('role', 'group'); + chat.setAttribute('aria-labelledby', 'uw-chat-titel'); + const ct = el('span', 'uw-kachel__titel', 'Chat'); + ct.id = 'uw-chat-titel'; + const stufen = el('div', 'uw-stufen'); + stufen.id = 'uw-stufen'; + for (const orig of [...($('chat-stufen')?.children || [])]) { + if (!orig.dataset.modus) continue; + const b = el('button', 'uw-stufe', orig.textContent.trim()); + b.type = 'button'; + b.dataset.modus = orig.dataset.modus; + b.setAttribute('aria-pressed', orig.getAttribute('aria-pressed') || 'false'); + b.addEventListener('click', () => orig.click()); + stufen.append(b); + } + chat.append(ct, stufen); + /* 4 Gäste */ + const gaeste = kachel('uw-gaeste', 'Gäste'); + gaeste.addEventListener('click', () => { schliessen(false); $('cockpit-gaeste')?.click(); }); + /* 5 Ampel */ + const ampel = kachel('uw-ampel', 'Ton · Leitung · Rechner'); + const punkte = el('span', 'uw-punkte'); + punkte.setAttribute('aria-hidden', 'true'); + for (let i = 0; i < 3; i++) punkte.append(el('i')); + ampel.insertBefore(punkte, ampel.lastChild); + ampel.addEventListener('click', () => { + schliessen(false); + const a = $('cockpit-ampel'); + if (!a) return; + if ($('cockpit-ampel-tafel')?.hidden) a.click(); + a.scrollIntoView({ block: 'nearest' }); + a.focus({ preventScroll: true }); + }); + /* 6 Werkstatt */ + const ws = kachel('uw-werkstatt', 'Werkstatt'); + ws.addEventListener('click', () => { + schliessen(false); + if (!window.Werkstatt?.offen?.()) $('werkstatt-knopf')?.click(); + }); + feld.append(sendung, moment, chat, gaeste, ampel, ws); + + const sagt = el('p', 'uw__sagt'); + sagt.id = 'uw-sagt'; + sagt.setAttribute('role', 'status'); + sagt.setAttribute('aria-live', 'polite'); + blatt.append(kopf, feld, sagt); + document.body.append(blatt); + + document.addEventListener('keydown', (e) => { if (e.key === 'Escape' && offen) { e.stopPropagation(); schliessen(true); } }, true); + SCHMAL.addEventListener?.('change', () => { if (!SCHMAL.matches && offen) schliessen(false); }); + FINGER.addEventListener?.('change', wachAbgleichen); + /* Was das Cockpit sagt („Moment 2 gemerkt“, „losgelassen …“), + steht auch im Blatt – ohne zweite Meldung. */ + const quelle = $('cockpit-sagt'); + if (quelle) new MutationObserver(() => { sagt.textContent = quelle.textContent; }).observe(quelle, { childList: true, characterData: true, subtree: true }); + wachZeichnen(); + } + + /* Beenden · halten: Das Halten geht an #cockpit-beenden, dessen Uhr + entscheidet. Die Füllung hier spiegelt dessen `data-halten`. */ + function haltenVerdrahten(k) { + let weiter = false; + const ziel = () => $('cockpit-beenden'); + const live = () => lage?.stand === 'live'; + k.addEventListener('pointerdown', (e) => { + if (!live() || k.disabled) return; + weiter = true; + ziel()?.dispatchEvent(new PointerEvent('pointerdown', { bubbles: true, pointerId: e.pointerId, pointerType: e.pointerType })); + }); + for (const art of ['pointerup', 'pointerleave', 'pointercancel']) { + k.addEventListener(art, () => { + if (!weiter) return; + weiter = false; + ziel()?.dispatchEvent(new PointerEvent('pointerup', { bubbles: true })); + }); + } + k.addEventListener('keydown', (e) => { + if (!live() || (e.key !== 'Enter' && e.key !== ' ')) return; + e.preventDefault(); + ziel()?.dispatchEvent(new KeyboardEvent('keydown', { key: e.key, repeat: e.repeat, bubbles: true })); + }); + k.addEventListener('keyup', (e) => { + if (!live() || (e.key !== 'Enter' && e.key !== ' ')) return; + ziel()?.dispatchEvent(new KeyboardEvent('keyup', { key: e.key, bubbles: true })); + }); + k.addEventListener('contextmenu', (e) => e.preventDefault()); + k.addEventListener('click', () => { if (!live()) $('p-starten')?.click(); }); + } + + /* ========================================================= Zeichnen */ + function kachelnZeichnen() { + if (!gebaut || !lage) return; + const live = lage.stand === 'live'; + /* 1 Sendung */ + const s = $('uw-sendung'); + const cb = $('cockpit-beenden'); + const start = $('p-starten'); + s.dataset.art = live ? 'ende' : 'start'; + s.disabled = live ? !!cb?.disabled : !!start?.disabled; + $('uw-sendung-wert').textContent = live ? 'Beenden · halten' : (start?.textContent || 'Auf Sendung').trim(); + s.dataset.halten = cb?.dataset.halten === 'ja' ? 'ja' : 'nein'; + s.setAttribute('aria-label', live ? 'Sendung beenden – eine Sekunde halten' : (start?.textContent || 'Auf Sendung').trim()); + /* 2 Moment */ + const m = $('uw-moment'); + const mk = $('cockpit-moment'); + m.disabled = !mk || mk.hidden || !lage.ich?.host || !live; + const zahl = Number($('cockpit-moment-zahl')?.textContent || 0); + $('uw-moment-wert').textContent = !live ? 'nur live' : zahl ? `${zahl} gemerkt` : 'Stelle merken'; + /* 3 Chat */ + const quelle = $('chat-stufen'); + for (const b of $('uw-stufen').children) { + const o = quelle ? [...quelle.children].find((x) => x.dataset.modus === b.dataset.modus) : null; + b.setAttribute('aria-pressed', o?.getAttribute('aria-pressed') === 'true' ? 'true' : 'false'); + } + /* 4 Gäste */ + const auf = (lage.gaeste || []).length; + const gefragt = (lage.einladungen || []).filter((e) => e.stand === 'gefragt').length; + const haende = window.Backstage?.haende?.() || []; + const bereit = (window.Backstage?.bereite?.() || []).length; + const teile = [auf ? `${auf} auf der Bühne` : 'niemand auf der Bühne']; + if (gefragt) teile.push(`${gefragt} gefragt`); + if (auf) teile.push(`${bereit} bereit`); + $('uw-gaeste-wert').textContent = teile.join(' · '); + const g = $('uw-gaeste'); + g.dataset.hand = haende.length ? 'ja' : 'nein'; + let hz = $('uw-gaeste-hand'); + if (!hz) { hz = el('span', 'uw-kachel__hand'); hz.id = 'uw-gaeste-hand'; g.append(hz); } + hz.textContent = haende.length ? `✋ ${haende.join(', ')}` : ''; + hz.hidden = !haende.length; + /* 5 Ampel */ + const a = $('cockpit-ampel'); + const quellPunkte = a ? [...a.querySelectorAll('.cockpit-ampel__punkt')] : []; + [...$('uw-ampel').querySelectorAll('.uw-punkte i')].forEach((p, i) => { p.dataset.stufe = quellPunkte[i]?.dataset.stufe || 'unbekannt'; }); + $('uw-ampel').dataset.stufe = a?.dataset.stufe || 'unbekannt'; + $('uw-ampel-wert').textContent = (a?.querySelector('.cockpit-ampel__wort')?.textContent || 'nicht messbar').trim(); + /* 6 Werkstatt */ + $('uw-werkstatt-wert').textContent = 'alle Bereiche'; + } + + /* Höhe: endet über dem Video, nie darauf. */ + function hoeheSetzen() { + const blatt = $('unterwegs'); + if (!blatt) return; + const v = $('video-platz')?.getBoundingClientRect(); + const sichtbar = v && v.height > 0 && v.bottom > 0 && v.top < window.innerHeight; + const frei = sichtbar ? Math.floor(window.innerHeight - v.bottom - 8) : Math.floor(window.innerHeight * 0.85); + blatt.style.maxHeight = `${Math.max(0, frei)}px`; + } + + function oeffnen() { + bauen(); + const blatt = $('unterwegs'); + if (!blatt || !SCHMAL.matches) return; + offen = true; + kachelnZeichnen(); + hoeheSetzen(); + blatt.inert = false; + blatt.dataset.auf = 'ja'; + $('unterwegs-knopf').setAttribute('aria-expanded', 'true'); + clearInterval(takt); + takt = setInterval(() => { kachelnZeichnen(); hoeheSetzen(); }, 500); + requestAnimationFrame(() => $('uw-sendung')?.focus({ preventScroll: true })); + } + function schliessen(fokusZurueck) { + const blatt = $('unterwegs'); + if (!blatt) return; + offen = false; + blatt.dataset.auf = 'nein'; + blatt.inert = true; + clearInterval(takt); + takt = null; + $('unterwegs-knopf')?.setAttribute('aria-expanded', 'false'); + if (fokusZurueck) $('unterwegs-knopf')?.focus({ preventScroll: true }); + } + + function lageAnwenden(l) { + lage = l; + if (l?.ich?.host) bauen(); + else if (offen) schliessen(false); + kachelnZeichnen(); + wachAbgleichen(); + } + window.addEventListener('saal:lage', (e) => lageAnwenden(e.detail)); + window.addEventListener('backstage:stand', () => { if (offen) kachelnZeichnen(); }); + document.addEventListener('visibilitychange', wachAbgleichen); + window.addEventListener('resize', () => { if (offen) hoeheSetzen(); }); + + window.Unterwegs = { + oeffnen, schliessen: () => schliessen(false), offen: () => offen, + wach: () => ({ zustand: wach.zustand, grund: wach.grund, aktiv: !!(wach.sperre && !wach.sperre.released), anfragen: wach.anfragen }), + abgleichen: wachAbgleichen, + }; +})(); diff --git a/workspace/reaktion.html b/workspace/reaktion.html index 471eec03..c4ea3d60 100644 --- a/workspace/reaktion.html +++ b/workspace/reaktion.html @@ -19,6 +19,8 @@ + + @@ -2034,6 +2036,8 @@ + +