Titelvideo, Rundgang mit Kapiteln, naechste freie Termine, ruhigere Buchungsseite
- Webseite > Videos (Datei, Standbild, Kapitel mit Raum im Grundriss); Upload bis 100 MB - Titelbereich: Video statt Foto (stumme Schleife, respektiert Bewegung reduzieren/Save-Data) und naechste freie Termine mit Gesamtpreis (NextFreeStays) - Neuer Baustein Rundgang (Video) mit waehlbarer Anordnung; Grundriss springt ins Video - Buchungsseite: Preis unter dem Kalender, Formular rechts, Ablauf als Grafik - Seebad: Fahrkarten, Fahrplan-Kapitel, Sonnenaufgang als einmaliges Ereignis Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
1 parent
f5f18cd984
commit
d42c42059c
38 files changed
+1279
-23
No files matched your search
@@ -68,3 +68,98 @@ document.querySelectorAll('[data-rotator]').forEach((rotator) => {
|
||||
setInterval(() => { if (!paused && !document.hidden) show(current + 1); }, 7000);
|
||||
}
|
||||
});
|
||||
|
||||
const reducedMotion = () => window.matchMedia('(prefers-reduced-motion: reduce)').matches;
|
||||
|
||||
// Silent video loops (partials/video-loop): loaded only with motion allowed and without Save-Data, playing while
|
||||
// visible; the button pauses and resumes. Otherwise the poster stays and nothing is downloaded.
|
||||
document.querySelectorAll('[data-video-loop]').forEach((box) => {
|
||||
const video = box.querySelector('video');
|
||||
const toggle = box.querySelector('[data-video-toggle]');
|
||||
if (!video?.dataset.src || reducedMotion() || navigator.connection?.saveData) {
|
||||
return;
|
||||
}
|
||||
|
||||
let stopped = false;
|
||||
const play = () => video.play().catch(() => {});
|
||||
video.src = video.dataset.src;
|
||||
video.preload = 'auto';
|
||||
toggle.hidden = false;
|
||||
toggle.addEventListener('click', () => {
|
||||
stopped = !stopped;
|
||||
stopped ? video.pause() : play();
|
||||
const label = stopped ? 'Video abspielen' : 'Video anhalten';
|
||||
toggle.setAttribute('aria-pressed', String(stopped));
|
||||
toggle.setAttribute('aria-label', label);
|
||||
toggle.title = label;
|
||||
toggle.querySelector('[data-icon-pause]').classList.toggle('hidden', stopped);
|
||||
toggle.querySelector('[data-icon-play]').classList.toggle('hidden', !stopped);
|
||||
});
|
||||
new IntersectionObserver(([entry]) => {
|
||||
entry.isIntersecting && !stopped ? play() : video.pause();
|
||||
}).observe(video);
|
||||
});
|
||||
|
||||
// Video tour (sections/tour): start overlay, chapter buttons, highlighting the current chapter; floor plan rooms
|
||||
// with [data-tour-link] jump into the tour on the same page. Without JavaScript the native controls remain.
|
||||
const tour = document.querySelector('[data-tour]');
|
||||
if (tour) {
|
||||
const video = tour.querySelector('video');
|
||||
const start = tour.querySelector('[data-tour-start]');
|
||||
const seeks = [...tour.querySelectorAll('[data-tour-seek]')];
|
||||
|
||||
const playFrom = (seconds) => {
|
||||
start.hidden = true;
|
||||
const go = () => {
|
||||
if (seconds !== null) {
|
||||
video.currentTime = seconds;
|
||||
}
|
||||
video.play().catch(() => {});
|
||||
};
|
||||
video.readyState >= 1 ? go() : video.addEventListener('loadedmetadata', go, { once: true });
|
||||
if (video.readyState < 1) {
|
||||
video.load();
|
||||
}
|
||||
};
|
||||
|
||||
start.hidden = false;
|
||||
start.addEventListener('click', () => playFrom(null));
|
||||
video.addEventListener('play', () => { start.hidden = true; });
|
||||
tour.querySelector('[data-tour-chapters]')?.removeAttribute('hidden');
|
||||
seeks.forEach((button) => button.addEventListener('click', () => playFrom(Number(button.dataset.tourSeek))));
|
||||
video.addEventListener('timeupdate', () => {
|
||||
const current = seeks.filter((button) => Number(button.dataset.tourSeek) <= video.currentTime + 0.25).pop();
|
||||
seeks.forEach((button) => (button === current ? button.setAttribute('aria-current', 'true') : button.removeAttribute('aria-current')));
|
||||
});
|
||||
|
||||
document.querySelectorAll('[data-tour-link]').forEach((link) => {
|
||||
link.hidden = false;
|
||||
link.addEventListener('click', (event) => {
|
||||
event.preventDefault();
|
||||
tour.scrollIntoView({ behavior: reducedMotion() ? 'auto' : 'smooth', block: 'center' });
|
||||
playFrom(Number(link.dataset.tourLink));
|
||||
});
|
||||
});
|
||||
}
|
||||
|
||||
// One-time reveal of a graphic when it scrolls into view (e.g. the sunrise of theme Seebad): the theme's CSS
|
||||
// styles [data-reveal="ready"] (start) and the transition to [data-reveal="shown"]. Without JavaScript or with
|
||||
// reduced motion the graphic is simply shown.
|
||||
if (!reducedMotion() && 'IntersectionObserver' in window) {
|
||||
const reveal = new IntersectionObserver((entries) => {
|
||||
entries.filter((entry) => entry.isIntersecting).forEach((entry) => {
|
||||
entry.target.dataset.reveal = 'shown';
|
||||
reveal.unobserve(entry.target);
|
||||
});
|
||||
}, { threshold: 0.6 });
|
||||
|
||||
document.querySelectorAll('[data-reveal]').forEach((element) => {
|
||||
if (element.getBoundingClientRect().top < window.innerHeight * 0.85) {
|
||||
element.dataset.reveal = 'ready';
|
||||
requestAnimationFrame(() => requestAnimationFrame(() => { element.dataset.reveal = 'shown'; }));
|
||||
return;
|
||||
}
|
||||
element.dataset.reveal = 'ready';
|
||||
reveal.observe(element);
|
||||
});
|
||||
}
|
||||
Reference in new issue
Block a user