tools:ur-timer
Unterschiede
Hier werden die Unterschiede zwischen zwei Versionen der Seite angezeigt.
| Beide Seiten, vorherige ÜberarbeitungVorherige ÜberarbeitungNächste Überarbeitung | Vorherige Überarbeitung | ||
| tools:ur-timer [12/03/2026 09:03] – Eric Weber | tools:ur-timer [18/03/2026 19:44] (aktuell) – Eric Weber | ||
|---|---|---|---|
| Zeile 239: | Zeile 239: | ||
| padding: 15px 40px; | padding: 15px 40px; | ||
| border-radius: | border-radius: | ||
| - | border: none; | + | border: none !important; |
| - | background: linear-gradient(160deg, | + | background: linear-gradient(160deg, |
| - | color: #fff; | + | color: #fff !important; |
| font-family: | font-family: | ||
| font-size: 18px; | font-size: 18px; | ||
| letter-spacing: | letter-spacing: | ||
| cursor: pointer; | cursor: pointer; | ||
| - | transition: | + | transition: |
| box-shadow: 0 2px 0 #166534, 0 5px 18px rgba(22, | box-shadow: 0 2px 0 #166534, 0 5px 18px rgba(22, | ||
| text-shadow: | text-shadow: | ||
| Zeile 252: | Zeile 252: | ||
| .ut-start-btn: | .ut-start-btn: | ||
| transform: translateY(-1px); | transform: translateY(-1px); | ||
| + | background: linear-gradient(160deg, | ||
| + | color: #fff !important; | ||
| box-shadow: 0 3px 0 #166534, 0 8px 26px rgba(22, | box-shadow: 0 3px 0 #166534, 0 8px 26px rgba(22, | ||
| } | } | ||
| Zeile 321: | Zeile 323: | ||
| position: relative; | position: relative; | ||
| width: 100%; | width: 100%; | ||
| + | /* dvh = dynamic viewport height, berücksichtigt iOS Browser-Chrome */ | ||
| height: 100vh; | height: 100vh; | ||
| - | min-height: | + | height: 100dvh; |
| + | min-height: | ||
| + | overflow: hidden; | ||
| + | flex-direction: | ||
| } | } | ||
| Zeile 351: | Zeile 357: | ||
| width: 7ch; | width: 7ch; | ||
| flex-shrink: | flex-shrink: | ||
| + | white-space: | ||
| + | display: flex !important; | ||
| + | flex-direction: | ||
| + | align-items: | ||
| } | } | ||
| .ut-topinfo { | .ut-topinfo { | ||
| Zeile 392: | Zeile 402: | ||
| /* Jede Ziffer in einer eigenen Box — absolute Pixelbreite */ | /* Jede Ziffer in einer eigenen Box — absolute Pixelbreite */ | ||
| .utd { | .utd { | ||
| - | display: inline-block; | + | display: inline-block |
| width: 0.62em; | width: 0.62em; | ||
| text-align: center; | text-align: center; | ||
| Zeile 400: | Zeile 410: | ||
| /* Ziffern für Prozentwert */ | /* Ziffern für Prozentwert */ | ||
| .utdd { | .utdd { | ||
| - | display: inline-block; | + | display: inline-block |
| width: 0.62em; | width: 0.62em; | ||
| text-align: center; | text-align: center; | ||
| Zeile 408: | Zeile 418: | ||
| /* Prozentzeichen — feste Breite */ | /* Prozentzeichen — feste Breite */ | ||
| .utdpc { | .utdpc { | ||
| - | display: inline-block; | + | display: inline-block |
| width: 0.7em; | width: 0.7em; | ||
| text-align: center; | text-align: center; | ||
| Zeile 423: | Zeile 433: | ||
| .ut-chip.gc .utv { color: #16a34a; } | .ut-chip.gc .utv { color: #16a34a; } | ||
| + | |||
| + | .ut-fsbtn { | ||
| + | position: absolute; | ||
| + | top: 10px; | ||
| + | right: 10px; | ||
| + | z-index: 100; | ||
| + | width: 34px; | ||
| + | height: 34px; | ||
| + | border-radius: | ||
| + | border: 1.5px solid rgba(0, | ||
| + | background: rgba(255, | ||
| + | color: #6b7280 !important; | ||
| + | font-size: 17px; | ||
| + | line-height: | ||
| + | cursor: pointer; | ||
| + | display: flex !important; | ||
| + | align-items: | ||
| + | justify-content: | ||
| + | transition: background 0.15s, color 0.15s, border-color 0.15s; | ||
| + | padding: 0; | ||
| + | box-shadow: 0 1px 6px rgba(0, | ||
| + | } | ||
| + | .ut-fsbtn: | ||
| + | background: #fff !important; | ||
| + | color: #16a34a !important; | ||
| + | border-color: | ||
| + | } | ||
| + | .ut-fsbtn.ut-fs-on { | ||
| + | color: #dc2626 !important; | ||
| + | border-color: | ||
| + | background: #fee2e2 !important; | ||
| + | } | ||
| + | .ut-fsbtn.ut-fs-on: | ||
| + | background: #dc2626 !important; | ||
| + | color: #fff !important; | ||
| + | } | ||
| + | |||
| + | /* Vollbild-Modus: | ||
| + | body.ut-fs-active { | ||
| + | overflow: hidden !important; | ||
| + | position: fixed !important; | ||
| + | width: 100% !important; | ||
| + | } | ||
| + | # | ||
| + | position: fixed !important; | ||
| + | top: 0 !important; | ||
| + | left: 0 !important; | ||
| + | width: 100% !important; | ||
| + | height: 100vh !important; | ||
| + | height: 100dvh !important; | ||
| + | z-index: 99999 !important; | ||
| + | background: #fff !important; | ||
| + | overflow-y: auto !important; | ||
| + | overflow-x: hidden !important; | ||
| + | } | ||
| + | /* Timer-Screen im Vollbild: volle Höhe */ | ||
| + | # | ||
| + | height: 100vh !important; | ||
| + | height: 100dvh !important; | ||
| + | } | ||
| + | /* Ergebnis-Screen im Vollbild: immer sichtbar über Timer */ | ||
| + | # | ||
| + | position: fixed !important; | ||
| + | inset: 0 !important; | ||
| + | z-index: 100001 !important; | ||
| + | } | ||
| + | /* Vollbild-Button im Vollbild: über allem */ | ||
| + | # | ||
| + | position: fixed !important; | ||
| + | top: 10px !important; | ||
| + | right: 10px !important; | ||
| + | z-index: 100002 !important; | ||
| + | } | ||
| .ut-otbadge { | .ut-otbadge { | ||
| Zeile 449: | Zeile 532: | ||
| padding: 10px 14px; | padding: 10px 14px; | ||
| min-height: 0; | min-height: 0; | ||
| + | overflow: hidden; | ||
| } | } | ||
| .ut-panel { | .ut-panel { | ||
| Zeile 492: | Zeile 576: | ||
| font-family: | font-family: | ||
| line-height: | line-height: | ||
| - | letter-spacing: | + | letter-spacing: |
| + | display: flex !important; | ||
| + | flex-direction: | ||
| + | align-items: | ||
| + | justify-content: | ||
| + | } | ||
| + | /* Einzelne Ziffer im Ring */ | ||
| + | .utrt { | ||
| + | display: inline-block !important; | ||
| + | width: 0.58em; | ||
| + | text-align: center; | ||
| + | font-family: | ||
| + | font-variant-numeric: | ||
| + | } | ||
| + | /* Doppelpunkt im Ring */ | ||
| + | .utrtc { | ||
| + | display: inline-block !important; | ||
| + | width: 0.28em; | ||
| + | text-align: center; | ||
| + | font-family: | ||
| } | } | ||
| .ut-rstat { | .ut-rstat { | ||
| Zeile 653: | Zeile 756: | ||
| </ | </ | ||
| <div id=" | <div id=" | ||
| + | <!-- Vollbild-Button: | ||
| + | <button class=" | ||
| <!-- ══ SETUP ══ --> | <!-- ══ SETUP ══ --> | ||
| - | |||
| <div id=" | <div id=" | ||
| <div class=" | <div class=" | ||
| Zeile 661: | Zeile 764: | ||
| < | < | ||
| </ | </ | ||
| - | + | | |
| - | ``` | + | <div class=" |
| - | <div class=" | + | < |
| - | <div class=" | + | <select id=" |
| - | < | + | </ |
| - | <select id=" | + | <div class=" |
| - | </ | + | < |
| - | + | <select id=" | |
| - | | + | <option value=" |
| - | < | + | <option value=" |
| - | <select id=" | + | </ |
| - | <option value=" | + | </ |
| - | <option value=" | + | <div class=" |
| - | </ | + | < |
| - | </ | + | <div class=" |
| - | + | <button class=" | |
| - | | + | <button class=" |
| - | < | + | </ |
| - | <div class=" | + | </ |
| - | <button class=" | + | <div class=" |
| - | <button class=" | + | <div style=" |
| + | <div class=" | ||
| + | <div class=" | ||
| + | </ | ||
| + | <div style=" | ||
| + | <label class=" | ||
| + | <input type=" | ||
| + | <div class=" | ||
| + | </ | ||
| + | </div> | ||
| </ | </ | ||
| - | </ | + | |
| - | + | <button | |
| - | | + | <button |
| - | <div style=" | + | |
| - | <div class=" | + | |
| - | <div class=" | + | |
| </ | </ | ||
| - | < | + | <div class=" |
| - | < | + | |
| - | <input type=" | + | & |
| - | <div class="ut-rlabels">< | + | |
| </ | </ | ||
| </ | </ | ||
| - | </ | ||
| - | |||
| - | <div class=" | ||
| - | <button class=" | ||
| - | <button class=" | ||
| - | </ | ||
| - | <div class=" | ||
| - | Warte auf Startzeit: <span id=" | ||
| - | & | ||
| - | <button onclick=" | ||
| - | </ | ||
| - | ``` | ||
| - | |||
| - | </ | ||
| - | |||
| <!-- ══ TIMER ══ --> | <!-- ══ TIMER ══ --> | ||
| - | |||
| <div id=" | <div id=" | ||
| <div class=" | <div class=" | ||
| Zeile 724: | Zeile 817: | ||
| </ | </ | ||
| </ | </ | ||
| - | + | | |
| - | ``` | + | <!-- GREEN --> |
| - | <div class=" | + | <div class=" |
| - | <!-- GREEN --> | + | <div class=" |
| - | <div class=" | + | <svg id=" |
| - | <div class=" | + | <circle cx=" |
| - | <svg id=" | + | <circle cx=" |
| - | <circle cx=" | + | <circle id=" |
| - | <circle cx=" | + | stroke="# |
| - | <circle id=" | + | stroke-dasharray=" |
| - | stroke="# | + | transform=" |
| - | stroke-dasharray=" | + | </ |
| - | transform=" | + | <div class=" |
| - | </ | + | <div class=" |
| - | <div class=" | + | <div class=" |
| - | <div class=" | + | <div class=" |
| - | <div class=" | + | </ |
| - | <div class=" | + | |
| </ | </ | ||
| - | </ | + | |
| - | </ | + | <!-- RED --> |
| - | + | <div class=" | |
| - | | + | <div class=" |
| - | + | <svg id=" | |
| - | | + | <circle cx=" |
| - | <div class=" | + | <circle cx=" |
| - | <div class=" | + | <circle id=" |
| - | <svg id=" | + | stroke="# |
| - | <circle cx=" | + | stroke-dasharray=" |
| - | <circle cx=" | + | transform=" |
| - | <circle id=" | + | </ |
| - | stroke="# | + | <div class=" |
| - | stroke-dasharray=" | + | <div class=" |
| - | transform=" | + | <div class=" |
| - | </ | + | <div class=" |
| - | <div class=" | + | </ |
| - | <div class=" | + | |
| - | <div class=" | + | |
| - | <div class=" | + | |
| </ | </ | ||
| </ | </ | ||
| </ | </ | ||
| - | </ | ||
| - | ``` | ||
| - | |||
| - | </ | ||
| - | |||
| <!-- ══ RESULT ══ --> | <!-- ══ RESULT ══ --> | ||
| - | |||
| <div id=" | <div id=" | ||
| <div class=" | <div class=" | ||
| Zeile 797: | Zeile 882: | ||
| </ | </ | ||
| </ | </ | ||
| - | |||
| </ | </ | ||
| - | |||
| < | < | ||
| (function(){ | (function(){ | ||
| 'use strict'; | 'use strict'; | ||
| - | var cfg = { startH:7, startM:0, duration: | + | var cfg = { startH:7, startM:0, duration: |
| - | var st = { phase:'idle', active:'green', gMs:0, rMs:0, last: | + | var st = { phase:‘idle’, active:‘green’, gMs:0, rMs:0, last: |
| - | total:0, limit:0, wIv:null, tIv:null, cIv:null }; | + | total:0, limit:0, wIv:null, tIv:null, cIv:null }; |
| /* ── helpers ── */ | /* ── helpers ── */ | ||
| - | function pad(n){ return String(n).padStart(2, | + | function pad(n){ return String(n).padStart(2, |
| function berlin(){ | function berlin(){ | ||
| - | | + | var d=new Date(), b=new Date(d.toLocaleString(‘en-US’,{timeZone:‘Europe/ |
| - | return {h: | + | return {h: |
| } | } | ||
| function mmss(ms){ | function mmss(ms){ | ||
| - | | + | var s=Math.floor(ms/ |
| - | return pad(m)+':'+pad(s%60); | + | return pad(m)+’:’+pad(s%60); |
| } | } | ||
| function el(id){ return document.getElementById(id); | function el(id){ return document.getElementById(id); | ||
| Zeile 822: | Zeile 905: | ||
| /* ── Init ── */ | /* ── Init ── */ | ||
| function init(){ | function init(){ | ||
| - | | + | var sel=el(‘ut-sel-start’); |
| - | for(var h=7; | + | for(var h=7; |
| - | for(var m=0; | + | for(var m=0; |
| - | if(h===17&& | + | if(h===17&& |
| - | var o=document.createElement('option'); | + | var o=document.createElement(‘option’); |
| - | o.value=h+':'+m; | + | o.value=h+’:’+m; |
| - | o.textContent=pad(h)+':'+pad(m)+' | + | o.textContent=pad(h)+’:’+pad(m)+’ Uhr’; |
| - | sel.appendChild(o); | + | sel.appendChild(o); |
| - | } | + | } |
| - | } | + | } |
| - | var now=berlin(), | + | var now=berlin(), |
| - | if(bm> | + | if(bm> |
| - | if(bh> | + | if(bh> |
| - | sel.value=bh+':'+bm; | + | sel.value=bh+’:’+bm; |
| - | startClock(); | + | startClock(); |
| } | } | ||
| function startClock(){ | function startClock(){ | ||
| - | | + | function tick(){ |
| - | var b=berlin(); | + | var b=berlin(); |
| - | var hh=pad(b.h), | + | var hh=pad(b.h), |
| - | el('utd-ch0').textContent=hh[0]; | + | el(‘utd-ch0’).textContent=hh[0]; |
| - | el('utd-cm0').textContent=mm[0]; | + | el(‘utd-cm0’).textContent=mm[0]; |
| - | el('utd-cs0').textContent=ss[0]; | + | el(‘utd-cs0’).textContent=ss[0]; |
| - | } | + | } |
| - | tick(); | + | tick(); |
| - | st.cIv=setInterval(tick, | + | st.cIv=setInterval(tick, |
| } | } | ||
| /* ── Setup callbacks ── */ | /* ── Setup callbacks ── */ | ||
| window.utSetFirst=function(w){ | window.utSetFirst=function(w){ | ||
| - | | + | cfg.first=w; |
| - | el('ut-btn-g').classList.toggle('active',w==='green'); | + | el(‘ut-btn-g’).classList.toggle(‘active’,w===‘green’); |
| - | el('ut-btn-r').classList.toggle('active',w==='red'); | + | el(‘ut-btn-r’).classList.toggle(‘active’,w===‘red’); |
| }; | }; | ||
| window.utGoal=function(v){ | window.utGoal=function(v){ | ||
| - | | + | cfg.goal=parseInt(v); |
| - | el('ut-goal-val').textContent=v+'%'; | + | el(‘ut-goal-val’).textContent=v+’%’; |
| - | el('ut-slider').value=v; | + | el(‘ut-slider’).value=v; |
| }; | }; | ||
| function applyCfg(){ | function applyCfg(){ | ||
| - | | + | var p=el(‘ut-sel-start’).value.split(’:’).map(Number); |
| - | cfg.startH=p[0]; | + | cfg.startH=p[0]; |
| - | cfg.duration=parseInt(el('ut-sel-dur').value); | + | cfg.duration=parseInt(el(‘ut-sel-dur’).value); |
| - | st.limit=cfg.duration*60*1000; | + | st.limit=cfg.duration*60*1000; |
| } | } | ||
| window.utConfirm=function(){ | window.utConfirm=function(){ | ||
| - | | + | applyCfg(); |
| - | el('ut-sbtn').disabled=true; | + | el(‘ut-sbtn’).disabled=true; |
| - | el('ut-nbtn').disabled=true; | + | el(‘ut-nbtn’).disabled=true; |
| - | el('ut-sbtn').textContent='Warte auf Startzeit…'; | + | el(‘ut-sbtn’).textContent=‘Warte auf Startzeit…’; |
| - | el('ut-wnote').classList.add('show'); | + | el(‘ut-wnote’).classList.add(‘show’); |
| - | updWait(); | + | updWait(); |
| - | st.wIv=setInterval(function(){ | + | st.wIv=setInterval(function(){ |
| - | updWait(); | + | updWait(); |
| - | var n=berlin(); | + | var n=berlin(); |
| - | if(n.h===cfg.startH&& | + | if(n.h===cfg.startH&& |
| - | clearInterval(st.wIv); | + | clearInterval(st.wIv); |
| - | } | + | } |
| - | },500); | + | },500); |
| }; | }; | ||
| window.utNow=function(){ | window.utNow=function(){ | ||
| - | | + | clearInterval(st.wIv); |
| - | applyCfg(); | + | applyCfg(); |
| - | begin(); | + | begin(); |
| }; | }; | ||
| - | function updWait(){ el('ut-wdisp').textContent=pad(cfg.startH)+':'+pad(cfg.startM); | + | function updWait(){ el(‘ut-wdisp’).textContent=pad(cfg.startH)+’:’+pad(cfg.startM); |
| /* ── Begin ── */ | /* ── Begin ── */ | ||
| function begin(){ | function begin(){ | ||
| - | | + | st.phase=‘running’; st.active=cfg.first; |
| - | st.gMs=0; st.rMs=0; st.total=0; | + | st.gMs=0; st.rMs=0; st.total=0; |
| - | st.last=Date.now(); | + | st.last=Date.now(); |
| - | el('ut-gtop').textContent=cfg.goal+'%'; | + | el(‘ut-gtop’).textContent=cfg.goal+’%’; |
| - | // Verbleibend korrekt initialisieren über Digit-Spans (nicht textContent!) | + | // Verbleibend korrekt initialisieren über Digit-Spans (nicht textContent!) |
| - | setMmss('utd-rem-0','utd-rem-1','utd-rem-2','utd-rem-3', st.limit); | + | setMmss(‘utd-rem-0’,‘utd-rem-1’,‘utd-rem-2’,‘utd-rem-3’, st.limit); |
| - | el('ut-setup').style.display='none'; | + | el(‘ut-setup’).style.display=‘none’; |
| - | el('ut-timer').style.display='flex'; | + | el(‘ut-timer’).style.display=‘flex’; |
| - | panels(); resize(); | + | panels(); resize(); |
| - | st.tIv=setInterval(tick, | + | st.tIv=setInterval(tick, |
| } | } | ||
| /* ── Tick ── */ | /* ── Tick ── */ | ||
| function tick(){ | function tick(){ | ||
| - | | + | if(st.phase===‘done’) return; |
| - | var now=Date.now(), | + | var now=Date.now(), |
| - | if(st.active==='green') st.gMs+=d; else st.rMs+=d; | + | if(st.active===‘green’) st.gMs+=d; else st.rMs+=d; |
| - | st.total=st.gMs+st.rMs; | + | st.total=st.gMs+st.rMs; |
| - | if(st.phase==='running'&& | + | if(st.phase===‘running’&& |
| - | if(st.active==='green'){ end(); return; } | + | if(st.active===‘green’){ end(); return; } |
| - | else{ st.phase='overtime'; el('ut-otbadge').style.display='inline-flex'; } | + | else{ st.phase=‘overtime’; el(‘ut-otbadge’).style.display=‘inline-flex’; } |
| - | } | + | } |
| - | render(); | + | render(); |
| } | } | ||
| /* ── Switch ── */ | /* ── Switch ── */ | ||
| window.utSwitch=function(w){ | window.utSwitch=function(w){ | ||
| - | | + | if(st.phase===‘done’||st.phase===‘idle’) return; |
| - | if(st.phase==='overtime'&& | + | if(st.phase===‘overtime’&& |
| - | var now=Date.now(), | + | var now=Date.now(), |
| - | if(st.active==='red') st.rMs+=d; else st.gMs+=d; | + | if(st.active===‘red’) st.rMs+=d; else st.gMs+=d; |
| - | st.total=st.gMs+st.rMs; | + | st.total=st.gMs+st.rMs; |
| - | end(); return; | + | end(); return; |
| - | } | + | } |
| - | if(st.active===w) return; | + | if(st.active===w) return; |
| - | st.active=w; | + | st.active=w; |
| - | panels(); render(); | + | panels(); render(); |
| }; | }; | ||
| /* ── Digit helpers ── */ | /* ── Digit helpers ── */ | ||
| function setMmss(d0, d1, d2, d3, ms){ | function setMmss(d0, d1, d2, d3, ms){ | ||
| - | | + | var s=Math.floor(ms/ |
| - | var mm=pad(m), ss=pad(s%60); | + | var mm=pad(m), ss=pad(s%60); |
| - | el(d0).textContent=mm[0]; | + | el(d0).textContent=mm[0]; |
| - | el(d1).textContent=mm[1]; | + | el(d1).textContent=mm[1]; |
| - | el(d2).textContent=ss[0]; | + | el(d2).textContent=ss[0]; |
| - | el(d3).textContent=ss[1]; | + | el(d3).textContent=ss[1]; |
| } | } | ||
| function setGreenPct(gp){ | function setGreenPct(gp){ | ||
| - | | + | // Hunderter: |
| - | el('utd-gp-h').textContent = gp === 100 ? '1' | + | el(‘utd-gp-h’).textContent = gp === 100 ? ‘1’ : ‘\u2007’; |
| - | // Zehner: Ziffer wenn >= 10, sonst Leerzeichen | + | // Zehner: Ziffer wenn >= 10, sonst Leerzeichen |
| - | el('utd-gp-t').textContent = gp >= 10 ? String(Math.floor(gp / 10) % 10) : '\u2007'; | + | el(‘utd-gp-t’).textContent = gp >= 10 ? String(Math.floor(gp / 10) % 10) : ‘\u2007’; |
| - | // Einer: immer eine Ziffer | + | // Einer: immer eine Ziffer |
| - | el('utd-gp-o').textContent = String(gp % 10); | + | el(‘utd-gp-o’).textContent = String(gp % 10); |
| } | } | ||
| /* ── Render ── */ | /* ── Render ── */ | ||
| function render(){ | function render(){ | ||
| - | el('ut-tg' | + | // Ring-Timer: digit-by-digit |
| - | el('ut-tr' | + | setMmss(‘utrt-g0’, |
| + | setMmss(‘utrt-r0’, | ||
| - | | + | setMmss(‘utd-total-0’,‘utd-total-1’,‘utd-total-2’,‘utd-total-3’, st.total); |
| - | setMmss('utd-rem-0', | + | setMmss(‘utd-rem-0’, |
| - | | + | var gp=st.total> |
| - | setGreenPct(gp); | + | setGreenPct(gp); |
| - | | + | if(st.limit> |
| - | var C=816.8; | + | var C=816.8; |
| - | el('ut-prog-g').style.strokeDashoffset=Math.max(0, | + | el(‘ut-prog-g’).style.strokeDashoffset=Math.max(0, |
| - | el('ut-prog-r').style.strokeDashoffset=Math.max(0, | + | el(‘ut-prog-r’).style.strokeDashoffset=Math.max(0, |
| - | } | + | } |
| } | } | ||
| function panels(){ | function panels(){ | ||
| - | | + | el(‘ut-pg’).className=‘ut-panel’+(st.active===‘green’?’ ag’:’’); |
| - | el('ut-pr').className='ut-panel'+(st.active==='red'?' | + | el(‘ut-pr’).className=‘ut-panel’+(st.active===‘red’?’ ar’:’’); |
| - | el('ut-sg').textContent=st.active==='green'?'Läuft':'Pausiert'; | + | el(‘ut-sg’).textContent=st.active===‘green’?‘Läuft’:‘Pausiert’; |
| - | el('ut-sr').textContent=st.active==='red'?'Läuft':'Pausiert'; | + | el(‘ut-sr’).textContent=st.active===‘red’?‘Läuft’:‘Pausiert’; |
| } | } | ||
| /* ── End ── */ | /* ── End ── */ | ||
| function end(){ | function end(){ | ||
| - | | + | st.phase=‘done’; clearInterval(st.tIv); |
| - | var tot=st.total, | + | var tot=st.total, |
| - | setTimeout(function(){ | + | setTimeout(function(){ |
| - | var gm=(st.gMs/ | + | var gm=(st.gMs/ |
| - | el('ut-rtitle').textContent=ok? | + | el(‘ut-rtitle’).textContent=ok? |
| - | el('ut-rtitle').className='ut-rtitle | + | el(‘ut-rtitle’).className=‘ut-rtitle |
| - | el('ut-pg-pct').textContent=gp+'%'; el('ut-pr-pct').textContent=rp+'%'; | + | el(‘ut-pg-pct’).textContent=gp+’%’; el(‘ut-pr-pct’).textContent=rp+’%’; |
| - | el('ut-ag').textContent=gm+' | + | el(‘ut-ag’).textContent=gm+’ min’; el(‘ut-ar’).textContent=rm+’ min’; |
| - | el('ut-rgoal').innerHTML='Ziel: < | + | el(‘ut-rgoal’).innerHTML=‘Ziel: < |
| - | el('ut-result').style.display='flex'; | + | el(‘ut-result’).style.display=‘flex’; |
| - | setTimeout(function(){ el('ut-bg').style.width=gp+'%'; el('ut-br').style.width=rp+'%'; },80); | + | setTimeout(function(){ el(‘ut-bg’).style.width=gp+’%’; el(‘ut-br’).style.width=rp+’%’; },80); |
| - | },350); | + | },350); |
| } | } | ||
| /* ── Reset ── */ | /* ── Reset ── */ | ||
| window.utReset=function(){ | window.utReset=function(){ | ||
| - | | + | var app=document.getElementById(‘ut-app’); |
| - | st={phase:'idle',active:'green', | + | if(app.classList.contains(‘ut-fs-float’)){ |
| - | el('ut-result').style.display='none'; | + | app.classList.remove(‘ut-fs-float’); |
| - | el('ut-timer').style.display='none'; | + | el(‘ut-fsbtn’).classList.remove(‘ut-fs-on’); |
| - | el('ut-setup').style.display='flex'; | + | document.body.classList.remove(‘ut-fs-active’); |
| - | el('ut-sbtn').disabled=false; | + | document.body.style.top=’’; |
| - | el('ut-sbtn').textContent='Stunde konfigurieren & warten'; | + | window.scrollTo(0, |
| - | el('ut-wnote').classList.remove('show'); | + | var btn=el(‘ut-fsbtn’); |
| - | el('ut-otbadge').style.display='none'; | + | if(btn){ btn.textContent=‘⛶’; |
| - | el('ut-prog-g').style.strokeDashoffset=816.8; | + | } |
| - | el('ut-prog-r').style.strokeDashoffset=816.8; | + | clearInterval(st.tIv); |
| + | st={phase:‘idle’,active:‘green’, | ||
| + | el(‘ut-result’).style.display=‘none’; | ||
| + | el(‘ut-timer’).style.display=‘none’; | ||
| + | el(‘ut-setup’).style.display=‘flex’; | ||
| + | el(‘ut-sbtn’).disabled=false; | ||
| + | el(‘ut-sbtn’).textContent=‘Stunde konfigurieren & warten’; | ||
| + | el(‘ut-wnote’).classList.remove(‘show’); | ||
| + | el(‘ut-otbadge’).style.display=‘none’; | ||
| + | el(‘ut-prog-g’).style.strokeDashoffset=816.8; | ||
| + | el(‘ut-prog-r’).style.strokeDashoffset=816.8; | ||
| }; | }; | ||
| - | /* ── | + | /* ── |
| + | var _fsScrollY = 0; | ||
| + | window.utToggleFS = function(){ | ||
| + | var app = document.getElementById(‘ut-app’); | ||
| + | var btn = el(‘ut-fsbtn’); | ||
| + | var isFS = app.classList.contains(‘ut-fs-float’); | ||
| + | |||
| + | if(!isFS){ | ||
| + | _fsScrollY = window.scrollY; | ||
| + | app.classList.add(‘ut-fs-float’); | ||
| + | btn.classList.add(‘ut-fs-on’); | ||
| + | document.body.classList.add(‘ut-fs-active’); | ||
| + | document.body.style.top = ‘-’ + _fsScrollY + ‘px’; | ||
| + | btn.textContent = ‘✕’; | ||
| + | btn.title = ‘Vollbild beenden’; | ||
| + | } else { | ||
| + | app.classList.remove(‘ut-fs-float’); | ||
| + | btn.classList.remove(‘ut-fs-on’); | ||
| + | document.body.classList.remove(‘ut-fs-active’); | ||
| + | document.body.style.top = ‘’; | ||
| + | window.scrollTo(0, | ||
| + | btn.textContent = ‘⛶’; | ||
| + | btn.title = ‘Vollbild’; | ||
| + | } | ||
| + | setTimeout(resize, | ||
| + | setTimeout(resize, | ||
| + | }; | ||
| + | |||
| + | document.addEventListener(‘keydown’, | ||
| + | if(e.key === ‘Escape’ && document.getElementById(‘ut-app’).classList.contains(‘ut-fs-float’)){ | ||
| + | utToggleFS(); | ||
| + | } | ||
| + | }); | ||
| + | window.addEventListener(‘orientationchange’, | ||
| + | setTimeout(resize, | ||
| + | setTimeout(resize, | ||
| + | }); | ||
| function resize(){ | function resize(){ | ||
| - | | + | var app=document.getElementById(‘ut-app’); |
| - | var w=app ? app.offsetWidth : window.innerWidth; | + | var isFS = document.getElementById(‘ut-app’) && document.getElementById(‘ut-app’).classList.contains(‘ut-fs-float’); |
| + | var w = isFS ? window.innerWidth | ||
| - | | + | // Breakpoints basierend auf tatsächlicher Container-Breite setzen |
| - | app.classList.toggle('ut-sm', w < 700); | + | if(app){ |
| - | app.classList.toggle('ut-xs', w < 480); | + | app.classList.toggle(‘ut-sm’, w < 700); |
| + | app.classList.toggle(‘ut-xs’, w < 480); | ||
| + | } | ||
| - | | + | var area=document.querySelector(’#ut-app .ut-area’); |
| - | if(!area) return; | + | if(!area) return; |
| - | var areaH = area.clientHeight > 0 ? area.clientHeight : window.innerHeight - 60; | + | |
| - | var areaW = area.clientWidth | + | // Im Vollbild: Fenstergröße nutzen. Sonst: tatsächliche Element-Größe. |
| - | var sz=Math.max(150, Math.min(areaH - 20, areaW / 2 - 44, 340)); | + | var topbarH = 0; |
| - | ['ut-svg-g','ut-svg-r'].forEach(function(id){ | + | var tb = document.querySelector(’# |
| - | var s=el(id); if(s){s.style.width=sz+'px'; | + | if(tb) topbarH = tb.offsetHeight || 50; |
| - | }); | + | |
| - | var fs=Math.max(24, | + | var areaH = isFS |
| - | document.querySelectorAll('#ut-app .ut-rtime').forEach(function(e){e.style.fontSize=fs+'px';}); | + | ? (window.innerHeight - topbarH - 10) |
| + | : (area.clientHeight > 20 ? area.clientHeight : window.innerHeight | ||
| + | var areaW = isFS ? window.innerWidth : (area.clientWidth > 0 ? area.clientWidth : w); | ||
| + | |||
| + | var sz = Math.max(100, Math.min(areaH - 10, areaW / 2 - 30, 340)); | ||
| + | [‘ut-svg-g’,‘ut-svg-r’].forEach(function(id){ | ||
| + | var s=el(id); if(s){s.style.width=sz+‘px’; | ||
| + | }); | ||
| + | var fs=Math.max(20, sz*0.205); | ||
| + | document.querySelectorAll(’#ut-app .ut-rtime’).forEach(function(e){e.style.fontSize=fs+‘px’;}); | ||
| } | } | ||
| - | window.addEventListener('resize',resize); | + | window.addEventListener(‘resize’,resize); |
| // Auch beim Laden direkt auswerten | // Auch beim Laden direkt auswerten | ||
| - | document.addEventListener('DOMContentLoaded', resize); | + | document.addEventListener(‘DOMContentLoaded’, resize); |
| init(); | init(); | ||
| Zeile 1184: | Zeile 1326: | ||
| /* ── Render ── */ | /* ── Render ── */ | ||
| function render(){ | function render(){ | ||
| - | | + | |
| - | | + | setMmss('utrt-g0',' |
| + | | ||
| setMmss(' | setMmss(' | ||
| Zeile 1224: | Zeile 1367: | ||
| /* ── Reset ── */ | /* ── Reset ── */ | ||
| window.utReset=function(){ | window.utReset=function(){ | ||
| + | var app=document.getElementById(' | ||
| + | if(app.classList.contains(' | ||
| + | app.classList.remove(' | ||
| + | el(' | ||
| + | document.body.classList.remove(' | ||
| + | document.body.style.top=''; | ||
| + | window.scrollTo(0, | ||
| + | var btn=el(' | ||
| + | if(btn){ btn.textContent=' | ||
| + | } | ||
| clearInterval(st.tIv); | clearInterval(st.tIv); | ||
| st={phase:' | st={phase:' | ||
| Zeile 1237: | Zeile 1390: | ||
| }; | }; | ||
| - | /* ── | + | /* ── |
| + | var _fsScrollY = 0; | ||
| + | window.utToggleFS = function(){ | ||
| + | var app = document.getElementById(' | ||
| + | var btn = el(' | ||
| + | var isFS = app.classList.contains(' | ||
| + | |||
| + | if(!isFS){ | ||
| + | _fsScrollY = window.scrollY; | ||
| + | app.classList.add(' | ||
| + | btn.classList.add(' | ||
| + | document.body.classList.add(' | ||
| + | document.body.style.top = ' | ||
| + | btn.textContent = ' | ||
| + | btn.title = ' | ||
| + | } else { | ||
| + | app.classList.remove(' | ||
| + | btn.classList.remove(' | ||
| + | document.body.classList.remove(' | ||
| + | document.body.style.top = ''; | ||
| + | window.scrollTo(0, | ||
| + | btn.textContent = ' | ||
| + | btn.title = ' | ||
| + | } | ||
| + | setTimeout(resize, | ||
| + | setTimeout(resize, | ||
| + | }; | ||
| + | |||
| + | document.addEventListener(' | ||
| + | if(e.key === ' | ||
| + | utToggleFS(); | ||
| + | } | ||
| + | }); | ||
| + | window.addEventListener(' | ||
| + | setTimeout(resize, | ||
| + | setTimeout(resize, | ||
| + | }); | ||
| function resize(){ | function resize(){ | ||
| var app=document.getElementById(' | var app=document.getElementById(' | ||
| - | var w=app ? app.offsetWidth : window.innerWidth; | + | |
| + | | ||
| // Breakpoints basierend auf tatsächlicher Container-Breite setzen | // Breakpoints basierend auf tatsächlicher Container-Breite setzen | ||
| - | app.classList.toggle(' | + | |
| - | app.classList.toggle(' | + | |
| + | app.classList.toggle(' | ||
| + | } | ||
| var area=document.querySelector('# | var area=document.querySelector('# | ||
| if(!area) return; | if(!area) return; | ||
| - | | + | |
| - | var areaW = area.clientWidth | + | // Im Vollbild: Fenstergröße nutzen. Sonst: tatsächliche Element-Größe. |
| - | var sz=Math.max(150, Math.min(areaH - 20, areaW / 2 - 44, 340)); | + | var topbarH = 0; |
| + | var tb = document.querySelector('# | ||
| + | if(tb) topbarH = tb.offsetHeight || 50; | ||
| + | |||
| + | | ||
| + | ? (window.innerHeight - topbarH - 10) | ||
| + | : (area.clientHeight > 20 ? area.clientHeight : window.innerHeight | ||
| + | var areaW = isFS ? window.innerWidth : (area.clientWidth > 0 ? area.clientWidth : w); | ||
| + | |||
| + | var sz = Math.max(100, Math.min(areaH - 10, areaW / 2 - 30, 340)); | ||
| [' | [' | ||
| var s=el(id); if(s){s.style.width=sz+' | var s=el(id); if(s){s.style.width=sz+' | ||
| }); | }); | ||
| - | var fs=Math.max(24,sz*0.205); | + | var fs=Math.max(20, sz*0.205); |
| document.querySelectorAll('# | document.querySelectorAll('# | ||
| } | } | ||
tools/ur-timer.1773302621.txt.gz · Zuletzt geändert: von Eric Weber
