From 35fcc5a576df6ba18b0d74a206c648fae241e56f Mon Sep 17 00:00:00 2001 From: dfuhrmann3 Date: Thu, 16 Jul 2026 10:02:01 +0200 Subject: [PATCH] feat(v3): Intro-Overlay-Baustein (Overlay-Injektion, Skip/Auto-Fade/Replay) - Player-Leiste des Bundler-Exports ausgeblendet, Panel 16:9 (1280x720) Co-Authored-By: Claude Opus 4.8 --- intro_overlay.py | 132 +++++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 132 insertions(+) create mode 100644 intro_overlay.py diff --git a/intro_overlay.py b/intro_overlay.py new file mode 100644 index 0000000..1aaadc4 --- /dev/null +++ b/intro_overlay.py @@ -0,0 +1,132 @@ +import streamlit.components.v1 as components + +# Animationslaenge 16,4 s + ~1 s Puffer fuers "Unpacking" der Bundler-Animation. +INTRO_DURATION_MS = 17400 +# Statische URL (Streamlit Static Serving). Beim Live-Test ggf. auf "./static/intro.html" +# oder "/static/intro.html" korrigieren, falls "app/static/..." 404 liefert. +_INTRO_SRC = "app/static/intro.html" +_SEEN_KEY = "einrechnung_intro_seen" + + +def render_intro_overlay(duration_ms: int = INTRO_DURATION_MS, + intro_src: str = _INTRO_SRC, + seen_key: str = _SEEN_KEY) -> None: + """Injiziert ein einmaliges Intro-Overlay in die Streamlit-Elternseite (Ansatz A). + + Ein unsichtbarer components.html-Baustein (Hoehe 0) fuehrt JS aus, das ein + position:fixed-Overlay in window.parent.document einfuegt - ein echtes Overlay ueber der + Seite. Autoplay nur einmal pro Browser (localStorage), "Ueberspringen"-Button + Auto-Fade, + Replay-Button oben rechts (aendert den "gesehen"-Merker nicht). Die Animation laeuft + isoliert in einem inneren iframe (eigenes CSS/JS, keine Kollision mit Streamlit). + """ + html = f""" + +""" + components.html(html, height=0)