Tischscore4farben

Abend abrechnen

Echte Runde. Nicht der KI-Filz.

Home

BETA

FAQ

Start – neue Abrechnung der Standard-Welt. Erstes Mal: Standardspiel festlegen.

Home – alle Welten, Einstieg und Rückkehr.

Dashboard – Abrechnungsübersicht, Einstellungen, FAQ.

Welt-Klick: Abrechnen / Abrechnungskarte / Kurzanleitung.

Welt

Anmelden

Neues Konto

Tischscore

Einstellungen

Individuell
Führenden markieren
Letzte Runde in Kachel
Steuerleiste
Leiste per Tipp

Persönliche Liste

farbig
G/V-Coins

Gesamttabelle

farbig
G/V-Coins

Schafkopf · Tarif (Cent)

Laufende mitzählen

Admin ändert die Tarif-Liste später.

Spiel

Abend

Spielername: Speichern

QR/Code

Code 2 h · Session Gast 8 h

Wer bist du?

Runde 3

Punktetafel

Runde

GewinnerVerlierer

Ende

Dashboard

Wie in der Akademie: Tafeln nach Spiel, Abende nach Tag.

Export
Alle markieren
Meine Punktetafeln
Meine Abende

Kurz

Code

`); w.document.close(); w.focus(); w.print(); } function flip(btn,key){ S[key]=!S[key]; btn.classList.toggle("on",S[key]); } function applySettings(){ S.weltPref=document.getElementById("opt-welt").value; S.skCent=+document.getElementById("opt-cent").value; S.skSolo=+document.getElementById("opt-solo").value; S.skShow=document.getElementById("opt-skshow").value; S.av=document.getElementById("opt-av").value; S.style=document.getElementById("opt-style").value; S.pOn=document.getElementById("opt-p").value==="1"; S.pCol=document.getElementById("opt-pcol").value; try{ localStorage.setItem("ts-pref", S.weltPref); }catch(e){} const wk=document.getElementById("welt-kacheln"); if(wk) wk.innerHTML=["sk","dk","st"].map(k=>``).join(""); syncGeld(); applyTheme(); } function neuAbend(){ doStart(); } function backFromAufbau(){ go(S.weltPref==="alle"?"v-spiele":"v-dash"); } function seatHtml(n,c){ return `
`; } function togAllSave(el){ document.querySelectorAll("#sitz-box [data-save]").forEach(c=>c.checked=el.checked); } function pickCol(btn){ const i=Math.max(0,FARBEN.indexOf(btn.dataset.col)); const c=FARBEN[(i+1)%FARBEN.length]; btn.dataset.col=c; btn.style.background=c; } function paintSeats(){ document.querySelectorAll("#sitz-box .av").forEach(a=>a.classList.toggle("sq",S.av==="s")); sizeSeats(); } function sizeSeats(){ const n=document.querySelectorAll("#sitz-box .seat").length; document.getElementById("sitz-box").className="n"+n; } function addSeat(){ const box=document.getElementById("sitz-box"); if(!box) return; const n=box.querySelectorAll(".seat").length; if(n>=6) return; box.insertAdjacentHTML("beforeend", seatHtml("Spieler "+(n+1), FARBEN[n%FARBEN.length])); const all=document.getElementById("all-save"); if(all) box.querySelector(".seat:last-child [data-save]").checked=all.checked; } function saveWelt(){ try{ sessionStorage.setItem("ts-welt", S.welt||"dk"); sessionStorage.setItem("ts-pref", S.weltPref||"dk"); }catch(e){} } function loadWelt(){ try{ const w=sessionStorage.getItem("ts-welt"); const p=localStorage.getItem("ts-pref")||sessionStorage.getItem("ts-pref"); if(w&&WELTEN[w]) S.welt=w; if(p&&WELTEN[p]) S.weltPref=p; S.onboard=localStorage.getItem("ts-onboard")==="1"; }catch(e){} } function wahlWelt(k){ S.welt=k; saveWelt(); const w=WELTEN[k]; document.getElementById("aufbau-titel").textContent=w.name; document.getElementById("sitz-box").innerHTML=w.plaetze.map((n,i)=>seatHtml(n,FARBEN[i])).join(""); sizeSeats(); go("v-aufbau"); } function startAbend(){ const seats=[...document.querySelectorAll("#sitz-box .seat")]; S.players=seats.map(s=>({n:s.querySelector("[data-name]").value||"Gast", c:s.querySelector("[data-col]").dataset.col})); saveWelt(); seedDemo(); S.abendId=0; S.gruppe=document.getElementById("grp").value||""; document.getElementById("join-list").innerHTML=S.players.map(p=>``).join(""); persistAbend("offen"); renderTafel(); go("v-tafel"); } function renderTafel(){ const n=names(); const max=Math.max(...n.map(x=>S.stand[x]||0)); const tops=n.filter(x=>(S.stand[x]||0)===max); const lead=tops.length===1?tops[0]:null; const meta=[WELTEN[S.welt].name, document.getElementById("ort").value, S.gruppe].filter(Boolean).join(" · "); document.getElementById("tafel-meta").textContent=meta; document.getElementById("tafel-r").textContent="Runde "+S.runde; document.getElementById("head-sub").textContent=S.gruppe||"4farben"; document.getElementById("tafel-seats").innerHTML=n.map((x,i)=>{ const last=S.hist[S.hist.length-1]; const coin=last?`${last.g[x]?"G":"V"}`:""; const lastHtml=(S.lastOn&&last)?`${coin} ${money(last.d[x]||0)}`:""; let bg=S.style==="gleich"?"#1e4433":col(x); const leadCl=S.leader&&lead&&x===lead?" lead":""; const sh=S.av==="s"?"border-radius:8px":"border-radius:14px"; const side=i%2===1?" r":""; return ``; }).join(""); const pb=document.getElementById("pbtn"); pb.style.display=S.pOn?"block":"none"; pb.style.background=S.pCol; document.getElementById("ende-list").innerHTML=n.slice().sort((a,b)=>S.stand[b]-S.stand[a]).map(x=>`
${x}${money(S.stand[x])}
`).join(""); } function openTafel(){ drawPtafel(); go("v-ptafel"); } function syncHud(){ document.querySelectorAll(".hud").forEach(h=>{ h.classList.toggle("hid", !S.hudOn); h.style.setProperty("--hud-a", S.hudA||.78); }); const slot=document.getElementById("hud-home"); if(slot) slot.classList.toggle("off", !S.hudOn); } function toggleHud(){ if(S.hudTap===false) return; S.hudOn=!S.hudOn; const sw=document.getElementById("sw-hud"); if(sw) sw.classList.toggle("on",S.hudOn); syncHud(); } function togLock(btn){ const h=btn.closest(".hud"); h.classList.toggle("lock"); btn.textContent=h.classList.contains("lock")?"●":"○"; } function snapHudHome(h){ if(h.id!=="tafel-hud") return false; const slot=document.getElementById("hud-home"); if(!slot||slot.classList.contains("off")) return false; const a=h.getBoundingClientRect(), b=slot.getBoundingClientRect(); const hit=!(a.rightb.right||a.bottomb.bottom); if(!hit) return false; h.classList.remove("away","side-l","side-r"); h.style.left=""; h.style.top=""; h.style.bottom=""; h.style.right=""; h.style.transform=""; return true; } function clampHud(h){ const phone=document.querySelector(".phone").getBoundingClientRect(); const r=h.getBoundingClientRect(); let x=r.left-phone.left, y=r.top-phone.top; x=Math.max(4, Math.min(x, phone.width-r.width-4)); y=Math.max(4, Math.min(y, phone.height-r.height-4)); h.style.left=x+"px"; h.style.top=y+"px"; h.style.bottom="auto"; h.style.right="auto"; h.style.transform="none"; h.classList.remove("side-l","side-r"); if(x<=10) h.classList.add("side-l"); else if(x+r.width>=phone.width-10) h.classList.add("side-r"); } function openHilfe(art){ openHilfeFrom(art,"tafel",S.welt||"dk"); } function openHilfeFrom(art,back,welt){ try{ sessionStorage.setItem("ts-hilfe-back", back||"tafel"); sessionStorage.setItem("ts-welt", welt||S.welt||"dk"); }catch(e){} location.href="tischscore-"+(welt||S.welt||"dk")+"-"+art+".html?back="+(back||"welt"); } function bindHudDrag(){ document.querySelectorAll(".hud").forEach(h=>{ const g=h.querySelector(".grip"); if(!g||h._drag) return; h._drag=true; let ox=0,oy=0,sx=0,sy=0,on=false; const start=e=>{ if(h.classList.contains("lock")) return; const p=e.touches?e.touches[0]:e; const r=h.getBoundingClientRect(); const phone=document.querySelector(".phone").getBoundingClientRect(); on=true; sx=p.clientX; sy=p.clientY; ox=r.left-phone.left; oy=r.top-phone.top; e.preventDefault(); }; const move=e=>{ if(!on) return; const p=e.touches?e.touches[0]:e; if(h.id==="tafel-hud") h.classList.add("away"); h.style.left=(ox+p.clientX-sx)+"px"; h.style.top=(oy+p.clientY-sy)+"px"; h.style.bottom="auto"; h.style.right="auto"; h.style.transform="none"; clampHud(h); }; const end=()=>{ if(on){ if(!snapHudHome(h)) clampHud(h); } on=false; }; g.addEventListener("pointerdown",start); window.addEventListener("pointermove",move); window.addEventListener("pointerup",end); }); } function shareTafel(){ const shot=document.getElementById("pt-shot"); const tbl=shot.querySelector("table"); const hud=document.getElementById("pt-hud"); if(hud) hud.classList.remove("on"); document.querySelector(".phone").classList.add("ptoff"); const box=shot.getBoundingClientRect(); const sc=2; const c=document.createElement("canvas"); c.width=Math.max(1,box.width*sc); c.height=Math.max(1,box.height*sc); const g=c.getContext("2d"); const bg=getComputedStyle(document.querySelector(".phone")).getPropertyValue("--creme").trim()||"#f3eee1"; g.fillStyle=bg; g.fillRect(0,0,c.width,c.height); g.scale(sc,sc); const title=document.getElementById("pt-titel"); const tr=title.getBoundingClientRect(); g.fillStyle=getComputedStyle(title).color; g.font="700 14px "+getComputedStyle(title).fontFamily; g.fillText(title.textContent, tr.left-box.left, tr.bottom-box.top-2); if(tbl){ tbl.querySelectorAll("th,td").forEach(cell=>{ const r=cell.getBoundingClientRect(); const cs=getComputedStyle(cell); g.fillStyle=cs.backgroundColor||"#fff"; g.fillRect(r.left-box.left, r.top-box.top, r.width, r.height); g.strokeStyle=cs.borderColor||"#ccc"; g.strokeRect(r.left-box.left, r.top-box.top, r.width, r.height); const coin=cell.querySelector(".gv"); const raw=(cell.childNodes[0]?cell.childNodes[0].textContent:cell.textContent)||""; const txt=raw.replace(/\s*[GV]\s*$/,"").trim(); g.fillStyle=cs.color; g.font=(cs.fontWeight||"400")+" "+cs.fontSize+" "+cs.fontFamily; g.textAlign="center"; g.textBaseline="middle"; const cx=r.left-box.left+r.width/2, cy=r.top-box.top+r.height/2; g.fillText(txt+(coin?" ":""), cx-(coin?8:0), cy); if(coin){ const ok=coin.classList.contains("g"); g.beginPath(); g.arc(cx+r.width/2-12, cy, 7, 0, Math.PI*2); g.fillStyle=ok?"#2d6a4f":"#9a3412"; g.fill(); g.fillStyle="#fff"; g.font="700 9px "+cs.fontFamily; g.fillText(ok?"G":"V", cx+r.width/2-12, cy); } }); } c.toBlob(b=>{ const a=document.createElement("a"); a.href=URL.createObjectURL(b); a.download="punktetafel.png"; a.click(); },"image/png"); } function drawPtafel(){ document.getElementById("pt-titel").textContent="Punktetafel"+(S.gruppe?" · "+S.gruppe:""); const sel=document.getElementById("opt-pt"); if(sel) sel.value=S.ptMode; const n=names(); let html=""; if(S.ptMode==="spieler"){ html+=""+n.map(x=>``).join("")+""; S.hist.forEach(h=>{ html+=``+n.map(x=>ptCell(x,h)).join("")+""; }); html+=``+n.map(x=>``).join("")+""; } else { html+=""+S.hist.map(h=>``).join("")+""; n.forEach(x=>{ html+=``+S.hist.map(h=>ptCell(x,h)).join("")+``; }); } if(!S.hist.length) html+=""; html+="
Runde${x}
${h.nr}
Stand${money(S.stand[x]||0)}
SpielerR${h.nr}Stand
${x}${money(S.stand[x]||0)}
Noch keine Runde.
"; document.getElementById("pt-wrap").innerHTML=html; } function ptCell(x,h){ const cls=S.tabFarbe?(h.g[x]?"g":"v"):""; const coin=S.tabGv?` ${h.g[x]?"G":"V"}`:""; return `${money(h.d[x]||0)}${coin}`; } function openSpieler(name){ const p=S.players.find(x=>x.n===name); document.getElementById("sp-ico").style.background=p.c; document.getElementById("sp-ico").style.borderRadius=S.av==="s"?"8px":"50%"; document.getElementById("sp-ico").textContent=name.slice(0,1); document.getElementById("sp-name").textContent=name; document.getElementById("sp-sum").textContent="Stand "+money(S.stand[name]||0); document.getElementById("sp-list").innerHTML=S.hist.map(h=>{ const bg=S.pfFarbe?(h.g[name]?"#d8f3dc":"#fadbd8"):""; const coin=S.pfGv?`${h.g[name]?"G":"V"}`:""; return `
Runde ${h.nr} ${money(h.d[name]||0)} ${coin}
`; }).join("") || "
Noch keine Runde
"; go("v-spieler"); } function askEnde(){ document.getElementById("ov-ende").style.display="flex"; } function doEnde(){ document.getElementById("ov-ende").style.display="none"; saveAbendLocal("abgerechnet"); go("v-ende"); } function editRunde(nr){ S.editNr=nr; const h=S.hist.find(x=>x.nr===nr); S.party={}; names().forEach(n=>{ S.party[n]=h&&h.g[n]?1:2; }); document.getElementById("runde-titel").textContent=WELTEN[S.welt].name+" · Runde "+nr+" ändern"; document.getElementById("runde-hint").textContent="Änderungen wirken auf den Stand."; drawPlayers(); renderRundeUI(); calc(); go("v-runde"); } function openRunde(){ S.editNr=0; S.party={}; names().forEach(n=>S.party[n]=0); document.getElementById("runde-titel").textContent=WELTEN[S.welt].name+" · Runde "+(S.runde+1); document.getElementById("runde-hint").textContent="Ersten tippen = Gewinner. Zweiten = gleiches Paar. Einer allein = Solo."; drawPlayers(); renderRundeUI(); calc(); go("v-runde"); } function drawPlayers(){ const n=names(); const a=n.filter(x=>S.party[x]===1); document.getElementById("plgrid").innerHTML=n.map(x=>{ const g=S.party[x]; const lab=g===1?(a.length===1?"Solo":"Gewinner"):g===2?"Verlierer":"tippen"; return ``; }).join(""); document.getElementById("party-txt").textContent=a.length===1?"Solo "+a[0]:a.length?("Paar "+a.join(" + ")):"Noch niemand."; } function tapP(name){ const n=names(); const a=n.filter(x=>S.party[x]===1); if(S.party[name]===1) S.party[name]=0; else if(a.length>=2) S.party[name]=2; else S.party[name]=1; const a2=n.filter(x=>S.party[x]===1); if(a2.length>=1) n.forEach(x=>{ if(S.party[x]!==1) S.party[x]=2; }); else n.forEach(x=>S.party[x]=0); drawPlayers(); calc(); } function pill(id,label){ return ``; } function on(id){ return !!document.querySelector('.pill.on[data-id="'+id+'"]'); } function numFeld(id,lab,min,max,val){ return ``; } function renderDK(){ document.getElementById("runde-ui").innerHTML=` ${numFeld("augen","Augen Gewinner (von 240)",0,240,140)}
Vorbehalt
${pill("hochzeit","Hochzeit")}${pill("solo","Solo")}${pill("buben","Bubensolo")}${pill("damen","Damensolo")}${pill("fleisch","Fleischlos")}
Ansage
${pill("re","Re +2")}${pill("kontra","Kontra +2")}${pill("k90","keine 90 gesagt")}${pill("k60","keine 60 gesagt")}${pill("k30","keine 30 gesagt")}${pill("asw","schwarz gesagt")}
Sonder (nicht Solo)
${pill("fuchs","Fuchs Karo-A")}${pill("fuchs2","2. Fuchs")}${pill("karl","Karlchen")}${pill("doko","Doppelkopf")}${pill("alten","gegen die Alten")}
`; } function renderSK(){ document.getElementById("runde-ui").innerHTML=` ${numFeld("augen","Augen Gewinner (von 120)",0,120,70)} ${numFeld("lauf","Laufende",0,14,0)}
Spiel
${pill("saus","Sauspiel")}${pill("solo","Farbsolo")}${pill("wenz","Wenz")}${pill("geier","Geier")}${pill("tout","Tout")}${pill("klopf","Klopfen")}
Malnahme
${pill("kontra","Kontra")}${pill("re","Re")}${pill("schneider","Schneider")}${pill("schwarz","Schwarz")}
`; } function renderST(){ document.getElementById("runde-ui").innerHTML=` ${numFeld("spitzen","Spitzen mit/ohne",1,11,1)}
Spiel
${pill("karo","Karo 9")}${pill("herz","Herz 10")}${pill("pik","Pik 11")}${pill("kreuz","Kreuz 12")}${pill("grand","Grand 24")}${pill("null","Null")}
Stufen
${pill("hand","Hand")}${pill("schneider","Schneider")}${pill("schwarz","Schwarz")}${pill("ouvert","Ouvert")}${pill("nhand","Null Hand")}${pill("nouv","Null Ouvert")}${pill("verl","verloren")}
`; } function renderWA(){ document.getElementById("runde-ui").innerHTML=` ${numFeld("raise","Ausschaffen / Bieten (je +1)",0,6,0)}
Watten
${pill("maschine","Maschine")}${pill("geben","Gegner aufgegeben")}

Grund 2 für 3 Stiche. Ausschaffen +1. Aufgeben: Satz minus 1.

`; } function nRestFelder(){ return names().map(x=>numFeld("rest-"+x.replace(/\W+/g,"_"),"Rest "+x,0,200,S.party[x]===1?0:20)).join(""); } function renderRO(){ document.getElementById("runde-ui").innerHTML=` ${nRestFelder()}
${pill("handrom","Hand-Rommé ×2")}

2–9 Nennwert, 10–K = 10, Ass 11, Joker 20.

`; } function renderCA(){ document.getElementById("runde-ui").innerHTML=` ${numFeld("rein","Reine Canastas à 500",0,8,0)} ${numFeld("mix","Gemischte Canastas à 300",0,8,1)} ${numFeld("meld","Gemeldete Kartenpunkte",0,2500,80)} ${numFeld("hand","Handkarten Minus",0,800,0)} ${numFeld("rot","Rote Dreier",0,4,0)}
${pill("aus","Ausmachen +100")}${pill("verdeckt","verdeckt +100")}${pill("nomeld","keine Erstmeldung")}
`; } function renderRundeUI(){ const m={dk:renderDK,sk:renderSK,st:renderST,wa:renderWA,ro:renderRO,ca:renderCA}; (m[S.welt]||renderST)(); } function augenVal(){ const el=document.getElementById("augen"); return el?+el.value||0:0; } function laufVal(){ const el=document.getElementById("lauf"); return el?Math.max(0,+el.value||0):0; } function spitVal(){ const el=document.getElementById("spitzen"); return el?Math.max(1,+el.value||1):1; } function calc(){ const n=names(); const a=n.filter(x=>S.party[x]===1); const solo=a.length===1; let delta={}; n.forEach(x=>delta[x]=0); if(!a.length){ document.getElementById("runde-sum").innerHTML=""; S._delta=delta; return; } if(S.welt==="dk"){ const W=augenVal(); let v=1; if(on("alten")) v++; if(W>=151) v++; if(W>=181) v++; if(W>=211) v++; if(W>=240) v++; if(on("re")) v+=2; if(on("kontra")) v+=2; if(on("k90")&&W>=151) v++; if(on("k60")&&W>=181) v++; if(on("k30")&&W>=211) v++; if(on("asw")&&W>=240) v++; if(!solo){ ["fuchs","fuchs2","karl","doko"].forEach(k=>{ if(on(k)) v++; }); } n.forEach(x=>delta[x]=a.includes(x)?(solo?v*3:v):-v); } else if(S.welt==="sk"){ const W=augenVal(); const won=W>=61; const sch=on("schneider")||(won&&W>=91)||(!won&&W<=30); const sw=on("schwarz")||W===120||W===0; const einzel=on("solo")||on("wenz")||on("geier")||on("tout")||solo; const unit=S.skCent||10; const grund=einzel?unit*(S.skSolo||2):unit; const L=S.skLauf?laufVal():0; let v; if(on("tout")) v=(grund+L*unit)*2; else { v=grund+L*unit; if(sch) v+=unit; if(sw) v+=unit; } if(on("klopf")) v*=2; if(on("kontra")) v*=2; if(on("re")) v*=2; const sign=won?1:-1; n.forEach(x=>{ if(einzel) delta[x]=a.includes(x)?sign*v*3:-sign*v; else delta[x]=a.includes(x)?sign*v:-sign*v; }); } else if(S.welt==="wa"){ let v=2+Math.max(0,+(document.getElementById("raise")||{}).value||0); if(on("geben")) v=Math.max(1,v-1); n.forEach(x=>delta[x]=a.includes(x)?v:-v); } else if(S.welt==="ro"){ let sumL=0; n.forEach(x=>{ if(a.includes(x)) delta[x]=0; else { const el=document.getElementById("rest-"+x.replace(/\W+/g,"_")); const r=el?+el.value||0:0; delta[x]=-r; sumL+=r; } }); const win=a[0]; if(win) delta[win]=sumL; if(on("handrom")) n.forEach(x=>delta[x]*=2); } else if(S.welt==="ca"){ const rein=+(document.getElementById("rein")||{}).value||0; const mix=+(document.getElementById("mix")||{}).value||0; const meld=+(document.getElementById("meld")||{}).value||0; const hand=+(document.getElementById("hand")||{}).value||0; const rot=+(document.getElementById("rot")||{}).value||0; let rotP=rot===4?800:rot*100; if(on("nomeld")) rotP=-rotP; let v=rein*500+mix*300+meld-hand+rotP; if(on("aus")) v+=100; if(on("verdeckt")) v+=100; n.forEach(x=>delta[x]=a.includes(x)?(solo?v*3:v):-v); } else { let gw=12; if(on("karo")) gw=9; else if(on("herz")) gw=10; else if(on("pik")) gw=11; else if(on("kreuz")) gw=12; else if(on("grand")) gw=24; let val=0; if(on("null")||on("nhand")||on("nouv")){ val=23; if(on("nhand")||on("hand")) val=35; if(on("nouv")||on("ouvert")) val=(on("hand")||on("nhand"))?59:46; } else { let st=spitVal()+1; if(on("hand")) st++; if(on("schneider")) st++; if(on("schwarz")) st++; if(on("ouvert")) st++; val=st*gw; } const s=a[0]; const lost=on("verl"); n.forEach(x=>{ if(x===s) delta[x]=lost?-(val*4):val*2; else delta[x]=lost?val*2:-val; }); } document.getElementById("runde-sum").innerHTML=n.map(x=>`
${x}${money(delta[x])}
`).join(""); S._delta=delta; } function saveRunde(){ if(!S._delta) return; const g={}; names().forEach(n=>g[n]=S.party[n]===1?1:0); if(S.editNr){ const h=S.hist.find(x=>x.nr===S.editNr); if(h){ names().forEach(k=>S.stand[k]=(S.stand[k]||0)-(h.d[k]||0)+(S._delta[k]||0)); h.d={...S._delta}; h.g=g; } S.editNr=0; } else { S.hist.push({nr:S.runde+1,d:{...S._delta},g}); names().forEach(k=>S.stand[k]=(S.stand[k]||0)+S._delta[k]); S.runde++; } renderTafel(); go("v-tafel"); pushSession(); const map={sk:"schafkopf",dk:"doppelkopf",st:"skat"}; persistAbend("offen"); } function renderRegeln(){ document.getElementById("reg-titel").textContent=WELTEN[S.welt].name; document.getElementById("reg-body").innerHTML="
P-KnopfMitte der Tafel öffnet die Gesamtliste. Kachel = Spielerblatt.
"; } loadWelt(); (function(){ const h=(location.hash||"").replace("#",""); const m=h.match(/tafel-?(sk|dk|st)?/); if(m&&m[1]&&WELTEN[m[1]]){ S.welt=m[1]; S.weltPref=m[1]; } const o=document.getElementById("opt-welt"); if(o&&S.weltPref) o.value=S.weltPref; })(); seedDemo(); applySettings(); saveWelt(); (function(){ const h=location.hash||""; let back=""; try{ back=sessionStorage.getItem("ts-hilfe-back")||""; sessionStorage.removeItem("ts-hilfe-back"); }catch(e){} const hm=h.match(/hilfe-?(welt|tafel|home)?-?(sk|dk|st|wa|ro|ca)?/); if(h.indexOf("hilfe")>=0){ const kind=(hm&&hm[1])||back||"welt"; const wk=(hm&&hm[2])||S.weltPeek||S.welt||"dk"; if(kind==="tafel") go("v-tafel"); else if(kind==="welt") openWelt(wk); else openHome(); } else if(h.indexOf("tafel")>=0) go("v-tafel"); else if(h.indexOf("home")>=0) openHome(); else if(h.indexOf("dash")>=0||h.indexOf("liste")>=0) openDash(); bootUser().then(function(){ const jm=h.match(/join-([A-Z0-9]+)/i); if(jm){ S.sessCode=jm[1].toUpperCase(); api("/score_session.php?act=get&code="+S.sessCode).then(j=>{ if(j.payload&&j.payload.players){ S.players=j.payload.players; if(j.payload.welt) S.welt=j.payload.welt; } go("v-join"); }).catch(()=>{}); return; } if(h.indexOf("hilfe")>=0||h.indexOf("tafel")>=0||h.indexOf("home")>=0||h.indexOf("dash")>=0||h.indexOf("liste")>=0) return; if(S.user && !S.user.is_guest && !S.user.guest){ api("/score_abend.php",{act:"flag",product:"score",mandant:S.mandant||"akademie"}).catch(()=>{}); openHome(); } else go("v-konto"); }); })(); (function(){ const mq=window.matchMedia("(orientation: landscape)"); const syncFs=()=>{ document.body.classList.toggle("fs", mq.matches); const pt=document.getElementById("v-ptafel"); if(pt && pt.classList.contains("on")){ S.hudOn=true; syncHud(); drawPtafel(); } }; mq.addEventListener("change", syncFs); syncFs(); bindHudDrag(); syncHud(); const d=document.getElementById("dat"); if(d){ const t=new Date(); d.value=t.toISOString().slice(0,10); } const p=document.getElementById("btn-plus"); if(p) p.addEventListener("click", function(e){ e.preventDefault(); addSeat(); }); })(); renderTafel();