Files
Leon TonhäuserandClaude Fable 5.2 c793eb7359 feat: Intro flüssiger machen und englische Sprachversion ergänzen
Intro „Fokus":
- zwei Bild-Ebenen blenden ineinander über statt hartem Bildwechsel
- Unschärfe über winzige Vorschaubilder statt live berechnetem Weichzeichner
  (animiert werden nur noch transform und opacity)
- eigene WebP-Dateien für Laptop (quer) und Handy (hoch) in assets/intro,
  erzeugt mit scripts/intro-bilder.py; 1,8 MB bzw. 1,1 MB statt 5,9 MB
- Bühnenhöhe auf dem Handy unabhängig von der Adressleiste, größere HUD-Schrift
- „Überspringen"-Knopf, Scroll-Hinweis blendet jetzt wirklich aus
- Bildpfade relativ zum Skript, damit das Intro auch unter /en/ lädt

Zweisprachigkeit:
- englische Seiten unter public/en/, Sprachschalter in Topbar und Dock
- hreflang-Verweise, SEO-Konfiguration, Sitemap und SEO-Prüfskript angepasst
- docs/zweisprachigkeit.md

Co-Authored-By: Claude Fable 5.2 <noreply@anthropic.com>
2026-11-13 13:57:00 +01:00

76 lines
3.5 KiB
JavaScript
Raw Permalink Blame History

This file contains ambiguous Unicode characters
This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.
// Cookie-/Consent-Banner (Google Consent Mode v2).
// Selbstgebaute, DSGVO-konforme Einwilligung. Defaults stehen auf „denied" (im head),
// nach Nutzerwahl update per gtag('consent','update',…). Wahl landet in localStorage.
(function () {
'use strict';
var KEY = 'lt_consent_v1';
function update(granted) {
// GTM erst nach Einwilligung laden – vorher keine Verbindung zu Google.
if (granted && typeof window.ltLadeGtm === 'function') window.ltLadeGtm();
if (typeof gtag !== 'function') return;
var v = granted ? 'granted' : 'denied';
gtag('consent', 'update', {
'ad_storage': v,
'ad_user_data': v,
'ad_personalization': v,
'analytics_storage': v
});
}
var saved = null;
try { saved = localStorage.getItem(KEY); } catch (e) {}
if (saved === 'all') { update(true); return; }
if (saved === 'none') { update(false); return; }
// Keine Entscheidung gespeichert → Banner einblenden.
// Englische Sprachversion (lang="en") bekommt englische Texte,
// der Datenschutz-Link zeigt dann aus /en/ heraus auf ../datenschutz.
function show() {
var EN = document.documentElement.lang === 'en';
var texte = EN ? {
hinweis: 'This site uses Google Analytics & Google Ads to measure usage and show you more relevant advertising. Clicking "Accept all" consents to the processing. You can choose "Necessary only". See the <a href="../datenschutz">privacy policy</a>.',
akzeptieren: 'Accept all',
ablehnen: 'Necessary only'
} : {
hinweis: 'Diese Seite nutzt Google Analytics &amp; Google Ads, um die Nutzung zu messen und dir relevantere Werbung zu zeigen. Mit „Alle akzeptieren" stimmst du der Verarbeitung zu. Du kannst „Nur Notwendige" wählen. Mehr in der <a href="./datenschutz">Datenschutzerklärung</a>.',
akzeptieren: 'Alle akzeptieren',
ablehnen: 'Nur Notwendige'
};
var style = document.createElement('style');
style.textContent = [
'#lt-consent{position:fixed;left:0;right:0;bottom:0;z-index:9999;background:#fff;color:#111;',
'box-shadow:0 -4px 24px rgba(0,0,0,.12);padding:18px 20px;font:inherit;font-size:14px;line-height:1.5}',
'#lt-consent .lt-inner{max-width:1080px;margin:0 auto;display:flex;gap:16px;align-items:center;flex-wrap:wrap}',
'#lt-consent p{margin:0;flex:1 1 320px}',
'#lt-consent a{color:#111;text-decoration:underline}',
'#lt-consent .lt-btns{display:flex;gap:10px;flex-wrap:wrap}',
'#lt-consent button{font:inherit;font-weight:600;border-radius:10px;padding:10px 18px;cursor:pointer;border:1px solid #ddd;background:#fff;color:#111}',
'#lt-consent button.lt-accept{background:#111;color:#fff;border-color:#111}'
].join('');
document.head.appendChild(style);
var b = document.createElement('div');
b.id = 'lt-consent';
b.innerHTML = '<div class="lt-inner"><p>' + texte.hinweis + '</p><div class="lt-btns"><button class="lt-accept" type="button">' + texte.akzeptieren + '</button><button class="lt-decline" type="button">' + texte.ablehnen + '</button></div></div>';
document.body.appendChild(b);
function close() { b.remove(); style.remove(); }
b.querySelector('.lt-accept').addEventListener('click', function () {
try { localStorage.setItem(KEY, 'all'); } catch (e) {}
update(true); close();
});
b.querySelector('.lt-decline').addEventListener('click', function () {
try { localStorage.setItem(KEY, 'none'); } catch (e) {}
update(false); close();
});
}
if (document.readyState === 'loading') {
document.addEventListener('DOMContentLoaded', show);
} else {
show();
}
})();