Anliegen, Feldkatalog, Feldgruppen, Anfragevorlagen mit Fassungen, Anfrage-Einstiege, Posteingang mit Status und Notizen, Einstellungen mit Empfängern. Das Widget speichert nur die Kennung eines veröffentlichten Einstiegs; Formular, Bedingungen und Annahme kommen zur Laufzeit vom Server (Kompaktformular und mehrstufiger Dialog aus derselben Beschreibung). Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com>
103 lines
2.5 KiB
JavaScript
103 lines
2.5 KiB
JavaScript
import Hls from 'hls.js';
|
|
import './site-nav.js';
|
|
import './card-clip.js';
|
|
import './notice.js';
|
|
import './hero-video.js';
|
|
import './inquiry-form.js';
|
|
import './member-nav.js';
|
|
|
|
function attachPlayback(video) {
|
|
if (!(video instanceof HTMLVideoElement) || video.dataset.playbackReady === '1') {
|
|
return;
|
|
}
|
|
|
|
const source = video.dataset.hls;
|
|
|
|
if (!source) {
|
|
return;
|
|
}
|
|
|
|
video.dataset.playbackReady = '1';
|
|
|
|
if (Hls.isSupported()) {
|
|
const playback = new Hls();
|
|
playback.loadSource(source);
|
|
playback.attachMedia(video);
|
|
|
|
return;
|
|
}
|
|
|
|
if (video.canPlayType('application/vnd.apple.mpegurl')) {
|
|
video.src = source;
|
|
}
|
|
}
|
|
|
|
function scanPlayback(root) {
|
|
if (root instanceof HTMLVideoElement) {
|
|
attachPlayback(root);
|
|
}
|
|
|
|
// Der Anfangsscan übergibt das Dokument selbst; es ist kein Element und wurde bisher übersprungen,
|
|
// sodass im Quelltext stehende HLS-Filme nie angebunden wurden.
|
|
if (root instanceof Element || root instanceof Document) {
|
|
root.querySelectorAll('video[data-hls]').forEach(attachPlayback);
|
|
}
|
|
}
|
|
|
|
scanPlayback(document);
|
|
|
|
new MutationObserver((records) => {
|
|
records.forEach((record) => {
|
|
record.addedNodes.forEach((node) => {
|
|
if (node instanceof Element) {
|
|
scanPlayback(node);
|
|
}
|
|
});
|
|
});
|
|
}).observe(document.documentElement, { childList: true, subtree: true });
|
|
|
|
document.addEventListener('click', (event) => {
|
|
const fullscreen = event.target.closest('[data-fullscreen]');
|
|
|
|
if (fullscreen) {
|
|
// Der Vollbild-Knopf steht im Player oder, im Mitgliederbereich, neben ihm in derselben Spalte bzw. Zeile.
|
|
const media = fullscreen.closest('.player, .mb-content-main, .mb-outline-item')?.querySelector('video, audio');
|
|
|
|
if (media?.requestFullscreen) {
|
|
media.requestFullscreen();
|
|
}
|
|
|
|
return;
|
|
}
|
|
|
|
const decision = event.target.closest('[data-course-decision]');
|
|
const restart = event.target.closest('[data-course-restart]');
|
|
const button = decision || restart;
|
|
|
|
if (!button) {
|
|
return;
|
|
}
|
|
|
|
const video = button.closest('li')?.querySelector('video');
|
|
|
|
if (!video) {
|
|
return;
|
|
}
|
|
|
|
if (restart) {
|
|
video.currentTime = 0;
|
|
video.play();
|
|
|
|
return;
|
|
}
|
|
|
|
const at = Number(video.dataset.decision);
|
|
|
|
if (Number.isNaN(at)) {
|
|
return;
|
|
}
|
|
|
|
video.currentTime = at;
|
|
video.pause();
|
|
});
|