Files
pokerfreak/mock/seiten/table.html
T
mmintel 9c79d8236b Acceptance 5.11.: channel play without AFK, quiet focus, working Cockpit, stronger play
- Practice tables: 20-min session 54/54 turns at the server, control session 28 turns,
  0 timeouts; stage: 3 tables, two rounds each, clean teardown.
- Never let the clock run: an engine abstention becomes check or fold (nie_verstreichen).
- Mittler join in a fixed order (kill the duplicate, then announce), a mittler ends with its
  game, the laufwache opens no tables, stop waits for the runner to stand up.
- Focus: no lobby connections from HUD, probes or layout; "Focus Window on Turn" off.
- Tables: disconnected or sitting-out opponents do not count; a table without channel is
  closed and avoided after 45 s; the join event keeps the writer's pid (strict invariants).
- Geldwache: same room list as the runner, the table's own report, stand up before closing.
- Engine: the small blind completes the top 65 % against limpers (price per fair share);
  the calling range of a bet is as wide as the villain calls - value bets into stations.
- Cockpit: the source tree never comes from SHELL; one operating set for laufwache and
  Cockpit (sicht/start.py --client, ServerStart).
- Project lives in ~/Projects/pokerfreak (kern was a detour).
2026-11-05 16:10:43 +01:00

757 lines
43 KiB
HTML
Raw 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.
<!doctype html>
<html lang="en">
<head>
<meta charset="utf-8">
<title>{{TITEL}}</title>
<!-- Nachbildung des gemalten Unity-Tisches. Alle Stellen sind Anteile des FENSTERRAHMENS
(mock/vorlage/README.md), nicht der Seite - so rechnet auch hand/click.py.
Am Tisch gemessen (mock/vorlage/tisch-geometrie.md, Fenster 820x628):
+ freier Platz 1: 0.140/0.235 2: 0.485/0.185 3: 0.868/0.239 4: 0.868/0.622
5: 0.497/0.787 6: 0.107/0.61 (Seitennummern; Client: 3, 4, 5, 6, 1, 2)
voller Tisch Join Wait List 0.720/0.951 Find Seat 0.902/0.951
Buy-in-Dialog Min 0.377/0.611 Mitte 0.500/0.611 Max 0.624/0.611 Buy-In 0.500/0.847
Schliessen 0.674/0.151 "Claim Chips" 0.613/0.261 (nur bei offenen Chips)
Der rote Knopf heisst "Buy-In" (freier Platz, Nachkauf) oder "Join Wait List"
(Find Seat am vollen Tisch). Betrag beim Öffnen: freier Platz Max, Wartelisten-
Dialog Min, Nachkauf Min - gekauft wird, was im Feld steht.
Fensterkreuz des Spiels 0.972/0.024 (schliesst das Tischfenster). Im Chrome des Klons liegt
die Titelleiste des Betriebssystems über der Seite: bei 0.024 (rund 15 px) trifft
ein Mausklick sie, nicht die Seite. Das Kreuz sitzt deshalb bei x 0.972 und so
hoch, wie die Seite reicht (14 px unter ihrem Rand, data-min-top) - ohne
Titelleiste ist es genau 0.024. Abweichung nur in y, nur im Klon.
Sit Out / I'm Back (SITOUT 0.060/0.951): geschätzt, am Tisch nicht gemessen - dieselbe
Stelle in beiden Zuständen, nur wenn wir sitzen (hand/sitzen.py hat denselben Wert).
Wer am eigenen Platz das Fensterkreuz drückt, steht auf: game.leave_Seat, Stack zurück ins Guthaben.
Nachkauf: kein eigener Knopf. Auf dem eigenen Platz sitzt ein kleines "+" an der Stelle des
freien-Platz-+ (PLUS), solange der Stack unter dem Max-Buy-in liegt; Klick öffnet den Dialog.
Find Seat am vollen Tisch bleibt am Tisch und öffnet den Wartelisten-Dialog.
Profil-Dialog (Vorfall 29.10.2026, archiv/mitschrieb/vorfall-profil-dialog.png): Fläche x 0.265-0.735, y 0.068-0.975,
Kopfzeile "Profile" y 0.068-0.16, Kreuz 0.704/0.113. Der ganze Tisch dahinter ist abgedunkelt, der Dialog
schluckt ALLE Klicks (auch auf Fold/Call/Raise darunter); nur das Kreuz schliesst, "Save" nicht.
Öffnet, wenn der Zeiger >= 0,6 s über einem besetzten Sitzschild ruht (Mitte +- 0.075/0.10) oder per
POST /api/profil. Das Fensterkreuz des Spiels bleibt darüber (es gehört dem Betriebssystem).
Mit --profil- (Befund 18:1x): Hover öffnet nur das KOMPAKTE Profil (Ringe neben dem Schild, die Leiste
bleibt frei, Klicks gehen durch), erst ein Klick aufs fremde Sitzschild das grosse; das kompakte geht zu, sobald
der Zeiger das Schild verlässt. -->
<style>
html, body { margin: 0; height: 100%; overflow: hidden; }
body { background: #11131b; color: #eee; font: 15px/1.2 Roboto, Arial, sans-serif; position: relative; }
.filz { position: absolute; left: 7%; right: 7%; top: 21%; bottom: 20%; border-radius: 50%;
background: radial-gradient(#1d7a55, #0f4d37); border: 14px solid #232634; }
.stelle { position: absolute; transform: translate(-50%, -50%); }
.platz { text-align: center; }
.platz.name { background: #1b1e29; border-radius: 8px; padding: 6px 14px; min-width: 110px; }
.platz.chips { color: #f5c542; font-weight: 700; }
.platz.held.name { outline: 2px solid #4fc3f7; }
.platz.dran.name { outline: 2px solid #f5c542; }
.platz.aktion { color: #9ab; font-size: 12px; min-height: 14px; }
.platz.gefoldet { opacity:.45; }
.einsatz { background: #0d0f15; color: #f5c542; border-radius: 10px; padding: 2px 10px; font-size: 13px; }
.uhr { background: #f5c542; color: #111; font-weight: 700; border-radius: 10px; padding: 2px 8px; font-size: 13px; }
.uhr.knapp { background: #d4202c; color: #fff; }
.uhr[hidden] { display: none; }
.handnr { position: absolute; left: 12px; top: 10px; color: #778; font-size: 12px; }
.platz-frei { width: 80px; height: 80px; border-radius: 50%; border: 3px solid #2a2d3a;
background: #1a1c25; color: #ccc; font-size: 44px; line-height: 1; cursor: pointer; padding: 0; }
.mitte { text-align: center; }
.pot { background: #1b1e29; color: #fff; border-radius: 12px; padding: 4px 14px; display: inline-block; }
.pot[hidden] { display: none; }
.pot b { color: #4fc3f7; }
.karten { display: flex; gap: 6px; justify-content: center; margin-top: 10px; }
.karte { background: #fff; color: #111; border-radius: 6px; width: 42px; height: 58px; font-size: 20px;
font-weight: 700; display: flex; align-items: center; justify-content: center; }
.karte.rot { color: #d4202c; }
.aktionsleiste button { position: absolute; transform: translate(-50%, -50%); border: 0; border-radius: 8px;
background: #262a36; color: #fff; font: 600 16px Roboto, Arial, sans-serif; cursor: pointer;
white-space: nowrap; }
.aktionsleiste.gross { width: 12.5vw; height: 7vh; min-width: 90px; }
.aktionsleiste.klein { width: 5.2vw; height: 4.6vh; min-width: 40px; font-size: 13px; background: #1e2130; }
.aktionsleiste.fold { background: #8c2b2b; }
.aktionsleiste.call { background: #2b6b3f; }
.aktionsleiste.raise { background: #a5791d; }
.aktionsleiste.an { outline: 2px solid #4caf50; }
.betrag { position: absolute; transform: translate(-50%, -50%); width: 9vw; height: 4.4vh; text-align: center;
background: #0d0f15; color: #fff; border: 1px solid #333; border-radius: 6px; }
.dialog-backdrop { position: absolute; inset: 0; background: rgba(0,0,0,.55); display: none; }
/* Der Dialog ist eine durchsichtige Fläche über dem ganzen Fenster; jedes Element mit data-fx
sitzt an seiner gemessenen Stelle (anordnen()). Keine Klassen ausser denen der Seite. */
.sfs-buy-in-modal { position: absolute; inset: 0; display: none; }
.sfs-buy-in-modal [data-fx] { position: absolute; transform: translate(-50%, -50%); margin: 0; }
.sfs-buy-in-header,.sfs-buy-in-body,.sfs-buy-in-body-range-buttons,
.sfs-buy-in-modal-button-container { display: contents; } /* nur Gruppen, ohne eigene Fläche */
.sfs-buy-in-modal-container { width: 40vw; height: 82vh; background: #1b1e29; border-radius: 12px; }
.sfs-buy-in-heading { font-size: 20px; font-weight: 700; }
.sfs-buy-in-header-game-info { color: #99a; white-space: nowrap; }
.sfs-buy-in-balance-container { display: flex; gap: 8px; white-space: nowrap; }
.sfs-buy-in-user-balance { color: #f5c542; font-weight: 700; }
.sfs-slider-range-value { width: 30vw; box-sizing: border-box; padding: 8px; font-size: 18px; text-align: center;
background: #0d0f15; color: #fff; border: 1px solid #333; border-radius: 6px; }
.sfs-buy-in-body-min-range,.sfs-buy-in-body-mid-range,.sfs-buy-in-body-max-range,
.sfs-buy-in-modal-button,.sfs-buy-in-modal-header-button {
background: #2b3045; color: #fff; border: 0; border-radius: 6px; padding: 6px 16px; cursor: pointer;
font: inherit; white-space: nowrap; min-width: 9vw; }
.sfs-buy-in-modal-header-button { background: #a5791d; font-size: 13px; min-width: 0; }
.sfs-buy-in-modal-button { background: #d4202c; font-weight: 700; padding: 10px; min-width: 18vw; }
.sfs-buy-in-body-error { color: #ff6b6b; min-height: 1em; font-size: 12px; white-space: nowrap; }
.common-dialog-cross-icon { cursor: pointer; font-size: 22px; line-height: 1; padding: 4px 8px; }
.sfs-buy-in-body-container-text { color: #99a; font-size: 13px; white-space: nowrap; }
.nachkauf { border: 2px solid #2a2d3a; border-radius: 50%; width: 30px; height: 30px; padding: 0; z-index: 5;
background: #1f6fae; color: #fff; font: 700 20px/1 Roboto, Arial; cursor: pointer; }
.spielkreuz { background: #232634; color: #ccc; border-radius: 6px; width: 26px; height: 22px; line-height: 22px;
text-align: center; cursor: pointer; font-size: 18px; }
.sitoutknopf { background: #262a36; color: #fff; border: 0; border-radius: 8px; padding: 6px 14px;
font: 600 14px Roboto, Arial, sans-serif; cursor: pointer; white-space: nowrap; }
/* Sit Out steckt hinter dem "..."-Knopf (31.10. am Tisch gemessen): der Knopf unten
links oeffnet ein Menue, darin "Sit Out Next Hand" / "Sit Out All". */
.menueknopf { background: #262a36; color: #fff; border: 0; border-radius: 20px; width: 46px; height: 30px;
font: 700 14px/1 Roboto, Arial; cursor: pointer; }
.menueintrag { background: #17181d; border: 1px solid #333; border-radius: 6px; color: #e8e8ee;
padding: 5px 12px; font: 13px Roboto, Arial, sans-serif; cursor: pointer; white-space: nowrap;
z-index: 1500; }
.turnierleiste { position: absolute; left: 12px; top: 28px; color: #9ab; font-size: 12px; }
.guthaben { position: absolute; right: 8%; top: 10px; color: #99a; font-size: 13px; }
.guthaben b { color: #f5c542; }
/* Profil-Dialog: Fläche in Anteilen des Fensters (profilAnordnen), alles darin in Anteilen der Fläche */
.kompakt { background: #17181d; border: 1px solid #333; border-radius: 10px; padding: 6px 10px; font-size: 12px;
pointer-events: none; z-index: 900; white-space: nowrap; }
.kompakt[hidden] { display: none; }
.kompakt b { color: #2e86f5; margin-right: 6px; }
.profil-backdrop { position: fixed; inset: 0; background: rgba(0,0,0,.68); z-index: 1000; display: none; }
.profil { position: absolute; container-type: inline-size; background: #17181d; border-radius: 3.2cqw;
overflow: hidden; color: #e8e8ea; font-family: Roboto, Arial, sans-serif; user-select: none; }
.profil > * { position: absolute; box-sizing: border-box; }
.p-kopf { left: 0; top: 0; width: 100%; height: 10.1%; border-bottom:.3cqw solid #b3261e;
background: linear-gradient(#141010 0%, #2a1212 55%, #5e1a14 100%); }
.p-titel { left: 0; top: 0; width: 100%; height: 10.1%; display: flex; align-items: center; justify-content: center;
font-size: 5.2cqw; font-weight: 700; color: #fff; }
.p-info { left: 6.5%; top: 5%; transform: translate(-50%, -50%); width: 5.2cqw; height: 5.2cqw; border:.35cqw solid #e8e8ea;
border-radius: 50%; display: flex; align-items: center; justify-content: center; font-size: 3.2cqw; font-weight: 700; }
.profil-kreuz { left: 93.4%; top: 4.96%; transform: translate(-50%, -50%); font-size: 6cqw; line-height: 1;
color: #e7625b; cursor: pointer; padding: 1cqw; }
.p-person { left: 0; top: 10.1%; width: 100%; height: 14%; background: #1d1e24; }
.p-avatar { left: 3.7%; top: 12.4%; width: 13.3%; aspect-ratio: 1; border-radius: 50%; border:.5cqw solid #6b5b73;
background: radial-gradient(circle at 50% 35%, #8a7a92, #3b3342); }
.p-name { left: 19.5%; top: 16.6%; transform: translateY(-50%); font-size: 4.2cqw; font-weight: 500; white-space: nowrap; }
.p-telefon { left: 90%; top: 16.6%; transform: translate(-50%, -50%); width: 6cqw; height: 6cqw; border-radius: 1cqw;
background: #2a2b31; display: flex; align-items: center; justify-content: center; font-size: 3.4cqw; color: #bbb; }
.p-tabs { left: 0; top: 24.2%; width: 100%; height: 6.2%; display: flex; background: #0e0e11; }
.p-tab { flex: 1; display: flex; align-items: center; justify-content: center; font-size: 3.4cqw; color: #9a9a9f;
border-bottom:.5cqw solid transparent; cursor: pointer; }
.p-tab.an { background: #1d1e24; color: #fff; border-bottom-color: #d4202c; }
.p-lifetime { left: 3.6%; top: 31.9%; width: 21.7%; height: 5.3%; background: #202127; border-radius: 1cqw;
display: flex; align-items: center; padding-left: 1.8cqw; font-size: 3.2cqw; gap: 1.6cqw; }
.p-power { left: 63%; top: 31.5%; font-size: 2.2cqw; color: #aaa; line-height: 1.15; }
.p-power b { display: block; font-size: 3.6cqw; color: #eee; font-weight: 500; }
.p-zeile { left: 3%; width: 94%; height: 1px; background: #2a2b31; }
.p-kennzahl { width: 21%; transform: translateX(-50%); text-align: center; }
.p-kennzahl.z { font-size: 3.9cqw; font-weight: 500; }
.p-kennzahl.l { font-size: 3.1cqw; color: #9a9a9f; margin-top: 1.2cqw; }
.p-wtsd { left: 0; top: 66%; width: 100%; height: 8%; }
.p-wtsd > * { position: absolute; }
.p-balken { left: 20.8%; top: 69.5%; width: 59.1%; height: 1.2%; background: #1d2230; border-radius: 1cqw; overflow: hidden; }
.p-balken i { position: absolute; top: 0; bottom: 0; left: 0; background: #2e86f5; }
.p-balken u { position: absolute; top: 0; bottom: 0; background: #ee8f35; text-decoration: none; }
.p-notiz { left: 3.4%; top: 75.7%; width: 71.9%; height: 22.3%; background: #1d1e24; border-radius: 1cqw; }
.p-notiz textarea { position: absolute; left: 0; top: 0; width: 100%; height: 66%; background: transparent; border: 0;
color: #eee; font: 3.2cqw Roboto, Arial, sans-serif; padding: 2.5cqw 3cqw; resize: none; outline: 0; }
.p-zaehler { left: 6%; top: 94.3%; transform: translateY(-50%); font-size: 3.4cqw; color: #8d8d92; }
.p-save { left: 54.7%; top: 92%; width: 18.6%; height: 4.6%; background: #c8201c; color: #fff; border: 0; border-radius:.7cqw;
font: 600 3.8cqw Roboto, Arial, sans-serif; cursor: pointer; }
/* Trefferfläche des Kreuzes reicht nach unten: im Klon klickt der Läufer Anteile des Viewports, die Seite setzt
Anteile des Fensterrahmens samt Titelleiste (rund 30 px Unterschied oben) */
.profil-kreuz::before { content: ""; position: absolute; left: -2cqw; right: -2cqw; top: -2cqw; bottom: -9cqw; }
.p-farbe { width: 6.4cqw; height: 6.4cqw; border-radius: 50%; transform: translate(-50%, -50%); cursor: pointer; border:.5cqw solid transparent; }
.p-farbe.an { border-color: #fff; }
.p-powered,.p-power { pointer-events: none; }
/* Bühnenmodus (start.py --buehne): sichtbarer Zeiger, folgt den Mausereignissen; fängt selbst keine */
#zeiger { position: fixed; left: 0; top: 0; width: 28px; height: 28px; z-index: 99999; pointer-events: none;
display: none; filter: drop-shadow(0 0 3px #000); }
#zeiger path { fill: #fff; stroke: #111; stroke-width: 1.5; }
#zeiger.bediener path { fill: #ff9d2e; }
</style>
</head>
<body>
<div class="filz"></div>
<div class="handnr" id="handnr"></div>
<div class="turnierleiste" id="turnier" hidden></div>
<div class="guthaben">Balance <b id="guthaben"></b></div>
<div id="plaetze"></div>
<div id="einsaetze"></div>
<div class="stelle uhr" id="uhr" hidden></div>
<div class="stelle mitte" data-fx="0.5" data-fy="0.5">
<div class="pot" hidden><b>Pot</b> <span id="pot"></span></div>
<div class="karten" id="board"></div>
</div>
<div class="stelle" id="eigene" data-fx="0.5" data-fy="0.73"><div class="karten"></div></div>
<div class="aktionsleiste" id="leiste"></div>
<button class="stelle menueknopf" id="menue" data-fx="0.032" data-fy="0.881" hidden>•••</button>
<button class="stelle menueintrag" id="sitout_next" data-fx="0.110" data-fy="0.768" hidden>Sit Out Next Hand</button>
<button class="stelle menueintrag" id="sitout" data-fx="0.110" data-fy="0.798" hidden>Sit Out All</button>
<button class="stelle sitoutknopf" id="joinnow" hidden>Join Now</button>
<div class="stelle spielkreuz" id="spielkreuz" role="button" data-fx="0.972" data-fy="0.024" data-min-top="14" style="z-index:2000">×</div>
<!-- Spielerprofil: dunkler Grund über dem ganzen Fenster, die Fläche darin wie im Bild des Clients -->
<div class="profil-backdrop" id="profil">
<div class="profil" id="profilfeld">
<div class="p-kopf"></div>
<div class="p-titel">Profile</div>
<div class="p-info">i</div>
<div class="profil-kreuz" id="profilkreuz" role="button" aria-label="close">✕</div>
<div class="p-person"></div>
<div class="p-avatar"></div>
<div class="p-name" id="p-name"></div>
<div class="p-telefon">▯</div>
<div class="p-tabs"><div class="p-tab an" data-tab="stats">Game Stats</div><div class="p-tab" data-tab="beat">Bad Beat Counter</div></div>
<div class="p-lifetime">Lifetime <span>▾</span></div>
<div class="p-power">Powered By<b>PokerIntel &#8250;</b></div>
<div class="p-kennzahl" style="left:12.9%;top:41.2%"><div class="z" id="s-vpip"></div><div class="l">VPIP</div></div>
<div class="p-kennzahl" style="left:36.2%;top:41.2%"><div class="z" id="s-pfr"></div><div class="l">PFR</div></div>
<div class="p-kennzahl" style="left:59.6%;top:41.2%"><div class="z" id="s-threeBet"></div><div class="l">3-BET</div></div>
<div class="p-kennzahl" style="left:83.1%;top:41.2%"><div class="z" id="s-foldToThreeBet"></div><div class="l">Fold to 3-Bet</div></div>
<div class="p-zeile" style="top:51.2%"></div>
<div class="p-kennzahl" style="left:12.9%;top:53.2%"><div class="z" id="s-cbet"></div><div class="l">C-BET</div></div>
<div class="p-kennzahl" style="left:36.2%;top:53.2%"><div class="z" id="s-foldToCbet"></div><div class="l">Fold to C-Bet</div></div>
<div class="p-kennzahl" style="left:59.6%;top:53.2%"><div class="z" id="s-steal"></div><div class="l">Steal</div></div>
<div class="p-kennzahl" style="left:83.1%;top:53.2%"><div class="z" id="s-checkRaise"></div><div class="l">Check/Raise</div></div>
<div class="p-zeile" style="top:63.3%"></div>
<div class="p-wtsd">
<div style="left:5.9%;top:50%;color:#ee8f35;font-size:3.4cqw;transform:translateY(-10%)">WTSD ⓘ</div>
<div id="s-wtsd" style="left:20.8%;top:8%;color:#2e86f5;font-size:3.4cqw"></div>
<div id="s-wsd" style="left:76%;top:8%;color:#2e86f5;font-size:3.4cqw"></div>
<div style="left:84%;top:50%;color:#2e86f5;font-size:3.4cqw;transform:translateY(-10%)">WSD ⓘ</div>
</div>
<div class="p-balken"><i id="b-wtsd"></i><u id="b-wsd"></u></div>
<div class="p-notiz"><textarea id="p-notiz" maxlength="250" placeholder="Take player note here..."></textarea></div>
<div class="p-zaehler" id="p-zaehler">0/250</div>
<button class="p-save" id="p-save">Save</button>
<div class="p-farbe" data-farbe="" style="left:82.5%;top:78%;border:.5cqw solid #fff;background:transparent">⌀</div>
<div class="p-farbe" data-farbe="red" style="left:91.6%;top:78%;background:#e0373a"></div>
<div class="p-farbe" data-farbe="yellow" style="left:82.5%;top:83.9%;background:#e5e51b"></div>
<div class="p-farbe" data-farbe="blue" style="left:91.6%;top:83.9%;background:#1a63c6"></div>
<div class="p-farbe" data-farbe="pink" style="left:82.5%;top:89.8%;background:#cc2b8e"></div>
<div class="p-farbe" data-farbe="teal" style="left:91.6%;top:89.8%;background:#18bcb3"></div>
<div class="p-farbe" data-farbe="orange" style="left:82.5%;top:95.7%;background:#fa7c1b"></div>
<div class="p-farbe" data-farbe="green" style="left:91.6%;top:95.7%;background:#10b050"></div>
</div>
</div>
<!-- kompaktes Profil (nur --profil-): klein, neben dem Schild, nimmt keine Klicks -->
<div class="stelle kompakt" id="kompakt" hidden></div>
<div id="zeiger" hidden><svg viewBox="0 0 28 28" width="28" height="28"><path d="M2 2 L2 22 L7.5 17 L11 25 L14.5 23.5 L11 15.5 L18.5 15.5 Z"/></svg></div>
<div class="dialog-backdrop"></div>
<div class="sfs-buy-in-modal">
<div class="sfs-buy-in-modal-container" data-fx="0.5" data-fy="0.51"></div>
<div class="sfs-buy-in-header">
<h2 class="sfs-buy-in-heading" data-fx="0.5" data-fy="0.17">Buy-In</h2>
<div class="common-dialog-cross-icon" role="button" aria-label="close" data-fx="0.674" data-fy="0.151">×</div>
</div>
<div class="sfs-buy-in-header-game-info" data-fx="0.5" data-fy="0.215">{{TITEL}}</div>
<div class="sfs-buy-in-balance-container" data-fx="0.43" data-fy="0.261">
<div class="sfs-buy-in-balance-label">Balance</div>
<div class="sfs-buy-in-user-balance"></div>
</div>
<button class="sfs-buy-in-modal-header-button" data-fx="0.613" data-fy="0.261" hidden>Claim Chips</button>
<div class="sfs-buy-in-body">
<div class="sfs-buy-in-body-container-text" data-fx="0.5" data-fy="0.34" hidden></div>
<input class="sfs-slider-range-value" data-fx="0.5" data-fy="0.45" inputmode="numeric">
<div class="sfs-buy-in-body-range-buttons">
<button class="sfs-buy-in-body-min-range" data-fx="0.377" data-fy="0.611">Min</button>
<button class="sfs-buy-in-body-mid-range" data-fx="0.500" data-fy="0.611">Mid</button>
<button class="sfs-buy-in-body-max-range" data-fx="0.624" data-fy="0.611">Max</button>
</div>
<div class="sfs-buy-in-body-error" data-fx="0.5" data-fy="0.70"></div>
</div>
<div class="sfs-buy-in-modal-button-container">
<button class="sfs-buy-in-modal-button" data-fx="0.500" data-fy="0.847">Buy-In</button>
</div>
</div>
<script>
const RAUM = "{{RAUM}}";
// Stelle des + je freiem Platz (Anteil des Fensterrahmens), Nummern der Seite. Wie hand/sitzen.py PLUS.
const PLUS = {1: [0.140, 0.235], 2: [0.485, 0.185], 3: [0.868, 0.239],
4: [0.868, 0.622], 5: [0.497, 0.787], 6: [0.107, 0.61]};
// Sitzschilder (Name, Chips, Einsatz, Uhr): nicht neu vermessen, die Schätzungen von früher.
const SCHILD = {1: [0.14, 0.24], 2: [0.50, 0.20], 3: [0.86, 0.27],
4: [0.88, 0.66], 5: [0.50, 0.84], 6: [0.12, 0.64]};
// Sit Out / I'm Back: im Klon ein Menue wie am Tisch (die Stellen stehen als data-fx/fy an
// den Knoepfen - 0.032/0.881 Menue, 0.110/0.798 "Sit Out All", 31.10. gemessen).
// Sit Out All am Menueeintrag (0.110/0.798, HTML) und "Join Now" (hand/sitzen.py ZURUECK,
// am lebenden Tisch gemessen) - die zwei Stellen, die zustand.sitout umschaltet.
const SITOUT = [0.110, 0.798]; // "Sit Out All" im Menue; JOIN_NOW steht unten
let MENUE_AUF = false;
// Zurueck aus dem Sitout: "Join Now", am lebenden Tisch gemessen (hand/sitzen.py ZURUECK)
const JOIN_NOW = [0.913, 0.971];
const START = new URLSearchParams(location.search);
const BUEHNE = "{{BUEHNE}}" === "1";
const PROFIL_ECHT = "{{PROFIL_ECHT}}" === "1";
const PROFIL_ZWEISTUFIG = "{{PROFIL_ZWEISTUFIG}}" === "1";
const HEADLESS = "{{HEADLESS}}" === "1"; // ohne Fensterrahmen: Stellen als Anteil des Viewports
window.name = "tisch-" + RAUM.split(" ").pop(); // das Fenster heisst nach seinem Tisch
// Die drei Zustände der Aktionsleiste (README; "vorab" wie in bild-tisch-im-spiel.png)
const LEISTE = {
zug: z => [["Fold", 0.66, 0.94, "gross fold", "fold"],
[z.call ? "Call " + z.call: "Check", 0.80, 0.94, "gross call", "call"],
["Raise" + (z.raise ? " " + z.raise: ""), 0.93, 0.94, "gross raise", "raise"],
["33%", 0.616, 0.86, "klein", "v33"], ["50%", 0.677, 0.86, "klein", "v50"],
["75%", 0.735, 0.86, "klein", "v75"], ["Max", 0.784, 0.86, "klein", "vmax"]],
vorab: () => [["✓ Call Any", 0.79, 0.876, "gross", "callany"],
["✓ X/F", 0.66, 0.95, "gross", "xf"],
["✓ Call", 0.80, 0.95, "gross", "vcall"]],
voll: () => [["Find Seat", 0.902, 0.951, "gross", "findseat"],
["Join Wait List", 0.720, 0.951, "gross", "waitlist"]],
keine: () => [],
};
const FARBE = {HEARTS: "♥", DIAMONDS: "♦", CLUBS: "♣", SPADES: "♠"};
const WERT = {TWO: "2", THREE: "3", FOUR: "4", FIVE: "5", SIX: "6", SEVEN: "7", EIGHT: "8",
NINE: "9", TEN: "10", JACK: "J", QUEEN: "Q", KING: "K", ACE: "A"};
let zustand = null, leisteSchluessel = "", vorab = new Set();
// --- Mauszeiger -------------------------------------------------------------
// Die Seite merkt sich, wo sie den Zeiger zuletzt sah (window.__zeiger, Pixel des Viewports; hand/klonmaus.py
// liest das) und meldet es gedrosselt an den Server (Anteil des Viewports -> /api/zustand). Mausereignisse
// sind von CDP-Ereignissen nicht zu trennen; `bediener` setzt nur der Prüfhebel POST /api/bediener.
const zeiger = window.__zeiger = {x: null, y: null, n: 0, bediener: false, bediener: 0, mx: null, my: null};
const zeigerEl = document.getElementById("zeiger");
let zeigerMeldung = 0, zeigerTimer = null, bedienerNr = null;
function zeigerSehen(x, y, bediener) {
zeiger.x = x; zeiger.y = y; zeiger.n++; zeiger.bediener = bediener;
if (BUEHNE) {
zeigerEl.hidden = false; zeigerEl.style.display = "block";
zeigerEl.classList.toggle("bediener", bediener);
zeigerEl.style.transform = "translate(" + x + "px," + y + "px)";
}
const warte = zeigerMeldung + 50 - Date.now();
if (warte <= 0) zeigerMelden(); else if (!zeigerTimer) zeigerTimer = setTimeout(zeigerMelden, warte);
hoverPruefen();
}
function zeigerMelden() {
zeigerTimer = null; zeigerMeldung = Date.now();
if (zeiger.x === null) return;
fetch("/api/zeiger", {method: "POST", keepalive: true, body: JSON.stringify({
room: RAUM, x: zeiger.x / innerWidth, y: zeiger.y / innerHeight, n: zeiger.n, bediener: zeiger.bediener})});
}
addEventListener("mousemove", e => zeigerSehen(e.clientX, e.clientY, false), true);
// der Zeiger hat das Fenster verlassen (hand/klonmaus.Bildschirm): nicht mehr zeichnen
window.zeigerWeg = () => { zeigerEl.hidden = true; zeigerEl.style.display = "none"; };
// Prüfhebel: als hätte ein Bediener die Maus bewegt (zustand.bediener zählt die Aufrufe)
function bedienerPruefen(m) {
if (!m) return;
if (bedienerNr === null) { bedienerNr = m.nr; return; } // frisch geöffnet: alte Aufrufe zählen nicht
if (m.nr === bedienerNr || m.x === null) return;
bedienerNr = m.nr;
// bleibt stehen, auch wenn gleich das nächste CDP-Ereignis kommt: bediener zählt, mx/my ist die Stelle
zeiger.bediener++; zeiger.mx = m.x * innerWidth; zeiger.my = m.y * innerHeight;
zeigerSehen(zeiger.mx, zeiger.my, true);
}
// --- Profil: Hover auf ein Sitzschild ------------------------------------------------------------
// Ruht der Zeiger >= HOVER_S ununterbrochen über einem besetzten Sitzschild (Mitte +- SCHILD_HALB, Anteile des
// Fensters), öffnet das Profil dieses Spielers. Nach dem Öffnen gilt der Platz als "gesehen": erst wenn der
// Zeiger ihn verlassen hat, kann er wieder öffnen (der Client öffnet beim Hineinfahren).
const SCHILD_HALB = [0.075, 0.10], HOVER_S = 0.6;
let hoverSitz = null, hoverSeit = 0, hoverTimer = null, hoverGesperrt = null, kompaktZu = false;
function schildUnter(x, y) {
if (!zustand) return null;
const r = rahmen(), fx = (x + r.rand) / r.w, fy = (y + r.oben) / r.h;
for (const s of zustand.sitze) {
if (!s.name || !SCHILD[s.nr]) continue;
const m = SCHILD[s.nr];
if (Math.abs(fx - m[0]) <= SCHILD_HALB[0] && Math.abs(fy - m[1]) <= SCHILD_HALB[1]) return s.nr;
}
return null;
}
function hoverPruefen() {
clearTimeout(hoverTimer); hoverTimer = null;
if (zeiger.x === null) return;
const nr = schildUnter(zeiger.x, zeiger.y);
if (nr !== hoverGesperrt) hoverGesperrt = null; // Platz verlassen: wieder frei
if (PROFIL_ECHT && zustand && zustand.dialog === "profil_kompakt" && zustand.profil
&& nr !== zustand.profil.sitz && !kompaktZu) { // das kompakte geht mit dem Zeiger
kompaktZu = true;
senden("/api/profil", {zu: true}).then(() => { kompaktZu = false; laden(); });
}
const blockiert = dialogOffen() || (typeof modal !== "undefined" && modal.style.display === "block");
const ziel = blockiert || nr === null || nr === hoverGesperrt ? null: nr;
if (ziel !== hoverSitz) { hoverSitz = ziel; hoverSeit = Date.now(); }
if (hoverSitz === null) return;
const rest = hoverSeit + HOVER_S * 1000 - Date.now();
if (rest > 0) { hoverTimer = setTimeout(hoverPruefen, rest + 5); return; }
hoverGesperrt = hoverSitz;
const sitz = hoverSitz; hoverSitz = null;
profilOeffnen(sitz);
}
async function profilOeffnen(sitz, art = "hover") {
const r = await senden("/api/profil", {sitz, art});
if (r.ok) laden();
}
function rahmen() {
if (HEADLESS) return {w: innerWidth, h: innerHeight, rand: 0, oben: 0};
const w = outerWidth || innerWidth, h = outerHeight || innerHeight;
const rand = Math.max(0, (w - innerWidth) / 2); // links, rechts und unten gleich
return {w, h, rand, oben: Math.max(0, h - innerHeight - rand)};
}
window.__rahmen = () => rahmen(); // hand/klonmaus.py rechnet Klickpunkte mit demselben Rahmen
function setzeStelle(el, fx, fy) {
const r = rahmen();
el.style.left = (fx * r.w - r.rand) + "px";
let oben = fy * r.h - r.oben;
if (el.dataset.minTop) oben = Math.max(oben, +el.dataset.minTop); // nie über den Seitenrand hinaus
el.style.top = oben + "px";
}
function anordnen() {
for (const el of document.querySelectorAll("[data-fx]")) setzeStelle(el, +el.dataset.fx, +el.dataset.fy);
profilAnordnen();
}
function karte(k) {
const d = document.createElement("div");
d.className = "karte" + (k.suit === "HEARTS" || k.suit === "DIAMONDS" ? " rot": "");
d.textContent = (WERT[k.value] || "?") + (FARBE[k.suit] || "?");
return d;
}
async function senden(pfad, daten) {
const r = await fetch(pfad, {method: "POST", body: JSON.stringify(Object.assign({room: RAUM}, daten))});
return r.json();
}
function plaetzeZeichnen() {
const box = document.getElementById("plaetze"), einsaetze = document.getElementById("einsaetze");
box.textContent = ""; einsaetze.textContent = "";
for (const s of zustand.sitze) {
let el;
if (s.name) {
el = document.createElement("div");
el.className = "stelle platz" + (s.nr === zustand.held_sitz ? " held": "")
+ (zustand.uhr && zustand.uhr.sitz === s.nr ? " dran": "")
+ (s.aktion === "Fold" ? " gefoldet": "");
el.innerHTML = '<div class="name"><div></div><div class="chips"></div></div><div class="aktion"></div>';
el.querySelector(".name div").textContent = s.name;
el.querySelector(".chips").textContent = s.chips ?? "";
el.querySelector(".aktion").textContent = s.aktion || "";
if (s.einsatz) { // Einsatz liegt zwischen Platz und Mitte
const e = document.createElement("div");
e.className = "stelle einsatz"; e.textContent = s.einsatz;
e.dataset.fx = SCHILD[s.nr][0] + (0.5 - SCHILD[s.nr][0]) * 0.4;
e.dataset.fy = SCHILD[s.nr][1] + (0.5 - SCHILD[s.nr][1]) * 0.4;
einsaetze.appendChild(e);
}
if (s.nr === zustand.held_sitz && zustand.buyin.nachkauf_max > 0) { // Nachkauf: + an der Stelle des freien +
const n = document.createElement("button");
n.className = "stelle nachkauf"; n.textContent = "+";
n.dataset.fx = PLUS[s.nr][0]; n.dataset.fy = PLUS[s.nr][1];
n.addEventListener("click", () => { if (!dialogOffen()) nachkaufOeffnen(); });
box.appendChild(n);
}
if (PROFIL_ECHT && s.nr !== zustand.held_sitz) // Klick aufs fremde Schild: das grosse Profil
el.addEventListener("click", () => { if (!dialogOffen()) profilOeffnen(s.nr, "klick"); });
} else if (zustand.held_sitz === null) {
el = document.createElement("button"); // ohne Hülle: der Text gehört dem Knopf
el.className = "stelle platz-frei"; el.textContent = "+";
el.addEventListener("click", () => { if (!dialogOffen()) platzWaehlen(s.nr); });
} else continue;
const stelle = s.name ? SCHILD[s.nr]: PLUS[s.nr];
el.dataset.fx = stelle[0]; el.dataset.fy = stelle[1];
box.appendChild(el);
}
}
function leisteZeichnen() {
const box = document.getElementById("leiste");
const knoepfe = LEISTE[zustand.leiste](zustand);
const schluessel = zustand.leiste + JSON.stringify(knoepfe.map(k => k[0]));
if (schluessel === leisteSchluessel) return;
leisteSchluessel = schluessel;
box.textContent = "";
for (const [text, fx, fy, art, name] of knoepfe) {
const b = document.createElement("button");
b.textContent = text; b.className = art; b.dataset.fx = fx; b.dataset.fy = fy;
if (vorab.has(name)) b.classList.add("an");
b.addEventListener("click", () => klick(name, b));
box.appendChild(b);
}
if (zustand.leiste === "zug") {
const f = document.createElement("input");
f.className = "betrag"; f.dataset.fx = 0.873; f.dataset.fy = 0.855; f.value = zustand.raise || "";
box.appendChild(f);
}
}
function klick(name, knopf) {
if (dialogOffen()) return; // ein offener Dialog schluckt alles darunter (auch per Skript)
if (name === "findseat") { findSeat(); return; }
if (name === "waitlist") return; // der untere Knopf "Join Wait List" tut nichts; erst Find Seat öffnet den Dialog
if (["fold", "call", "raise"].includes(name)) { senden("/api/aktion", {aktion: name}); return; }
if (name.startsWith("v") && zustand.leiste === "zug") {
const f = document.querySelector(".betrag");
if (f) f.value = name === "vmax" ? "Max": name.slice(1) + "%";
return;
}
if (zustand.leiste === "vorab") { // Vorauswahl: nur Haken umschalten, wie im Client
vorab.has(name) ? vorab.delete(name): vorab.add(name);
knopf.classList.toggle("an");
}
}
// Find Seat am vollen Tisch: bleibt am Tisch und öffnet den Wartelisten-Dialog (Betrag Min).
async function findSeat() {
const r = await senden("/api/findseat", {});
if (r.ok) { modus = "warteliste"; dialogOeffnen("Buy-In"); }
}
function zeichnen() {
plaetzeZeichnen();
leisteZeichnen();
const board = document.getElementById("board");
board.textContent = "";
for (const k of zustand.board) board.appendChild(karte(k));
const eigene = document.querySelector("#eigene .karten");
eigene.textContent = "";
for (const k of zustand.karten) eigene.appendChild(karte(k));
const so = document.getElementById("sitout");
const mn = document.getElementById("menue");
mn.hidden = zustand.held_sitz === null;
so.hidden = zustand.held_sitz === null || !MENUE_AUF;
document.getElementById("sitout_next").hidden = so.hidden;
so.textContent = zustand.sitout ? "I'm Back": "Sit Out All";
so.dataset.fx = SITOUT[0]; so.dataset.fy = SITOUT[1];
const jn = document.getElementById("joinnow");
jn.hidden = zustand.held_sitz === null || !zustand.sitout;
jn.dataset.fx = JOIN_NOW[0]; jn.dataset.fy = JOIN_NOW[1];
document.querySelector(".pot").hidden = zustand.pot === null;
document.getElementById("pot").textContent = zustand.pot ?? "";
const tl = document.getElementById("turnier"), tu = zustand.turnier;
tl.hidden = !tu; // Turnier-Modus: Level, Blinds, Ante, Feld
if (tu) tl.textContent = (zustand.aus ? "Busted, Platz " + tu.platz + " - ": "") + "Level " + tu.level + " "
+ tu.sb + "/" + tu.bb + " ante " + tu.ante + " - " + tu.feld + "/" + tu.gesamt + " (bezahlt " + tu.bezahlt + ")";
document.getElementById("handnr").textContent = zustand.hand ? "Hand #" + zustand.hand: "";
document.getElementById("guthaben").textContent = zahl(zustand.buyin.konto);
const uhr = document.getElementById("uhr");
uhr.hidden = !(zustand.uhr && zustand.uhr.sitz);
if (!uhr.hidden) { // über dem Namen dessen, der dran ist
uhr.dataset.fx = SCHILD[zustand.uhr.sitz][0]; uhr.dataset.fy = SCHILD[zustand.uhr.sitz][1] - 0.075;
}
uhrTicken();
profilZeichnen();
anordnen();
}
function uhrTicken() { // die Uhr läuft zwischen zwei Abfragen weiter
const u = zustand && zustand.uhr, el = document.getElementById("uhr");
if (!u || el.hidden) return;
const rest = Math.max(0, Math.ceil(u.frist - (Date.now() / 1000 - u.start) * u.faktor));
el.textContent = "⏱ " + rest;
el.classList.toggle("knapp", rest <= 5);
}
async function laden() {
try {
const neu = await (await fetch("/api/zustand?room=" + encodeURIComponent(RAUM))).json();
bedienerPruefen(neu.bediener);
// Zeigerstand ändert sich ständig und darf die Seite nicht neu zeichnen (ein Knopf unter der Maus ginge verloren)
const ohneZeiger = z => JSON.stringify(Object.assign({}, z, {zeiger: null, bediener: null}));
if (ohneZeiger(neu) !== ohneZeiger(zustand)) { zustand = neu; zeichnen(); }
if (zustand.wechsel) { location.href = "/table.html?room=" + encodeURIComponent(zustand.wechsel); return; } // Tischwechsel
const an = zustand.angebot; // Warteliste: Platz frei geworden und für uns reserviert
if (an && an.nr !== angebotNr) { angebotNr = an.nr; buyinOeffnen(an.sitz); }
if (START.get("sitz")) { const nr = +START.get("sitz"); START.delete("sitz"); platzWaehlen(nr); }
} catch (e) { /* Server weg */ }
}
// --- Buy-in ---------------------------------------------------------------
const modal = document.querySelector(".sfs-buy-in-modal");
const feld = document.querySelector(".sfs-slider-range-value");
const fehler = document.querySelector(".sfs-buy-in-body-error");
let gewaehlt = null, modus = "sitzen", angebotNr = null; // modus: sitzen | warteliste | nachkauf
const zahl = n => Number(n).toLocaleString("en-US");
const stackInfo = document.querySelector(".sfs-buy-in-body-container-text");
const claim = document.querySelector(".sfs-buy-in-modal-header-button");
const bestaetigen = document.querySelector(".sfs-buy-in-modal-button");
// Grenzen des Dialogs: beim Hinsetzen und auf der Warteliste Min/Max des Tischs, beim Nachkauf bis zur Obergrenze
function grenzen() {
const b = zustand.buyin;
if (modus !== "nachkauf") return {min: b.min, max: Math.min(b.max, b.konto)};
const max = Math.min(b.nachkauf_max, b.konto);
return {min: Math.min(b.bb, max), max};
}
// Vorbelegung beim Öffnen (am Tisch beobachtet): freier Platz Max, Warteliste Min; Nachkauf Min (Klon-Annahme)
function voreinstellung() {
return modus === "sitzen" ? grenzen().max: grenzen().min;
}
// Für Werkzeuge, die per Bildschirm klicken: Mitte eines Elements als Anteil des Fensterrahmens
window.stelleVon = sel => {
const el = document.querySelector(sel), r = rahmen();
if (!el || !el.offsetParent) return null;
const k = el.getBoundingClientRect();
return [(k.left + k.width / 2 + r.rand) / r.w, (k.top + k.height / 2 + r.oben) / r.h];
};
function buyinOeffnen(nr) {
gewaehlt = nr; modus = "sitzen";
dialogOeffnen("Buy-In");
}
// Klick auf ein freies +: der Platz wird reserviert (game.reserve_Seat), dann öffnet der Dialog
async function platzWaehlen(nr) {
await senden("/api/reservieren", {sitz: nr});
buyinOeffnen(nr);
}
function nachkaufOeffnen() {
modus = "nachkauf";
dialogOeffnen("Add Chips");
}
function dialogOeffnen(titel) {
const b = zustand.buyin;
document.querySelector(".sfs-buy-in-heading").textContent = titel;
document.querySelector(".sfs-buy-in-user-balance").textContent = zahl(b.konto);
stackInfo.hidden = modus !== "nachkauf";
stackInfo.textContent = "Stack " + zahl(b.stack ?? 0) + " · bis " + zahl(b.max);
claim.hidden = !b.claim_offen; // "Claim Chips" nur, solange die Chips offen sind (jeder Dialog)
bestaetigen.textContent = modus === "warteliste" ? "Join Wait List": "Buy-In";
feld.value = zahl(voreinstellung());
fehler.textContent = "";
modal.style.display = "block";
document.querySelector(".dialog-backdrop").style.display = "block";
anordnen();
}
function buyinSchliessen() {
modal.style.display = "none";
document.querySelector(".dialog-backdrop").style.display = "none";
}
document.querySelector(".sfs-buy-in-body-min-range").addEventListener("click", () => feld.value = zahl(grenzen().min));
document.querySelector(".sfs-buy-in-body-max-range").addEventListener("click", () => feld.value = zahl(grenzen().max));
document.querySelector(".sfs-buy-in-body-mid-range").addEventListener("click", () => {
const g = grenzen();
feld.value = zahl(Math.round((g.min + g.max) / 2));
});
claim.addEventListener("click", async () => {
const r = await senden("/api/claim", {});
if (!r.ok) return;
await laden();
document.querySelector(".sfs-buy-in-user-balance").textContent = zahl(zustand.buyin.konto);
claim.hidden = true;
feld.value = zahl(voreinstellung());
});
document.querySelector(".common-dialog-cross-icon").addEventListener("click", buyinSchliessen);
bestaetigen.addEventListener("click", async () => {
let betrag = Number(feld.value.replace(/[^0-9.]/g, "")); // gekauft wird, was im Feld steht
if (modus === "nachkauf") betrag = Math.min(betrag, zustand.buyin.nachkauf_max); // höchstens bis Max
const r = modus === "sitzen" ? await senden("/api/sitzen", {sitz: gewaehlt, betrag})
: modus === "warteliste" ? await senden("/api/warteliste", {betrag})
: await senden("/api/nachkauf", {betrag});
if (r.ok) { buyinSchliessen(); laden(); } else fehler.textContent = r.fehler || "Platz nicht frei";
});
// Fensterkreuz des Spiels: das Tischfenster schliesst. Greift window.close() nicht (nicht per Skript
// geöffnet), schliesst der Server das Ziel per CDP.
document.getElementById("joinnow").addEventListener("click", () => {
if (dialogOffen()) return;
senden("/api/sitout", {an: false}).then(laden);
});
document.getElementById("menue").addEventListener("click", () => {
if (dialogOffen()) return;
MENUE_AUF = !MENUE_AUF;
zeichnen();
});
document.getElementById("sitout").addEventListener("click", () => {
if (dialogOffen()) return;
MENUE_AUF = false;
senden("/api/sitout", {an: !zustand.sitout}).then(laden);
});
document.getElementById("sitout_next").addEventListener("click", () => {
if (dialogOffen()) return;
MENUE_AUF = false;
senden("/api/sitout", {an: true}).then(laden);
});
// Am eigenen Platz steht das Kreuz erst vom Platz auf (leave_Seat, Guthaben zurück), dann schliesst es:
// /api/schliessen schreibt quit_table (wie der Client) und schliesst das Ziel per CDP.
document.getElementById("spielkreuz").addEventListener("click", async () => {
if (zustand && zustand.held_sitz !== null) await senden("/api/verlassen", {});
try { await senden("/api/schliessen", {}); } catch (e) { /* Seite schon zu */ }
window.close();
});
// --- Profil-Dialog ----------------------------------------------------------------------------
window.__dialog = null; // "profil" | "profil_kompakt" | null - nur Prüfhilfe, der Laeufer liest das nicht (kein DOM am Tisch)
const PROFIL_FLAECHE = [0.265, 0.068, 0.735, 0.975];
let profilNr = null, profilFarbe = "";
const dialogOffen = () => !!(zustand && zustand.dialog === "profil"); // nur das grosse schluckt Klicks
function profilAnordnen() {
const f = document.getElementById("profilfeld"), r = rahmen();
f.style.left = (PROFIL_FLAECHE[0] * r.w - r.rand) + "px";
f.style.top = (PROFIL_FLAECHE[1] * r.h - r.oben) + "px";
f.style.width = ((PROFIL_FLAECHE[2] - PROFIL_FLAECHE[0]) * r.w) + "px";
f.style.height = ((PROFIL_FLAECHE[3] - PROFIL_FLAECHE[1]) * r.h) + "px";
}
function kompaktZeichnen() {
const el = document.getElementById("kompakt");
const d = zustand && zustand.dialog === "profil_kompakt" ? zustand.profil: null;
el.hidden = !d;
if (!d) return;
const st = d.stats, m = SCHILD[d.sitz] || [0.5, 0.5];
el.innerHTML = `<div>${d.name}</div><b>VPIP ${st.vpip}%</b><b>PFR ${st.pfr}%</b><b>3-BET ${st.threeBet}%</b><b>C-BET ${st.cbet}%</b>`;
setzeStelle(el, m[0] + (0.5 - m[0]) * 0.35, Math.min(m[1] - 0.12, 0.70)); // über dem Schild, nie auf der Leiste
}
function profilZeichnen() {
kompaktZeichnen();
const d = zustand && zustand.dialog === "profil" ? zustand.profil: null;
window.__dialog = d ? "profil": (zustand && zustand.dialog) || null;
document.getElementById("profil").style.display = d ? "block": "none";
if (!d) { profilNr = null; return; }
if (profilNr !== d.nr) { // frisch geöffnet: Werte und leeres Notizfeld
profilNr = d.nr; profilFarbe = "";
document.getElementById("p-name").textContent = d.name;
const st = d.stats;
for (const k of ["vpip", "pfr", "threeBet", "foldToThreeBet", "cbet", "foldToCbet", "steal", "checkRaise"])
document.getElementById("s-" + k).textContent = st[k] + "%";
document.getElementById("s-wtsd").textContent = st.wtsd + "%";
document.getElementById("s-wsd").textContent = st.wsd + "%";
document.getElementById("b-wtsd").style.width = st.wtsd + "%";
const w = document.getElementById("b-wsd");
w.style.left = Math.max(0, st.wtsd - 10) + "%"; w.style.width = Math.min(20, 100 - Math.max(0, st.wtsd - 10)) + "%";
document.getElementById("p-notiz").value = ""; profilZaehler();
for (const f of document.querySelectorAll(".p-farbe")) f.classList.toggle("an", f.dataset.farbe === "");
}
profilAnordnen();
}
function profilZaehler() {
document.getElementById("p-zaehler").textContent = document.getElementById("p-notiz").value.length + "/250";
}
async function profilSchliessen() {
await senden("/api/profil", {zu: true});
await laden();
}
// der Backdrop schluckt jeden Klick: nichts darunter reagiert, auch ein Klick daneben schliesst nicht
document.getElementById("profil").addEventListener("click", e => e.stopPropagation());
document.getElementById("profilkreuz").addEventListener("click", profilSchliessen);
document.getElementById("p-notiz").addEventListener("input", profilZaehler);
document.getElementById("p-save").addEventListener("click", () => {
senden("/api/profil", {speichern: true, note: document.getElementById("p-notiz").value, farbe: profilFarbe});
});
for (const f of document.querySelectorAll(".p-farbe")) f.addEventListener("click", () => {
profilFarbe = f.dataset.farbe;
for (const g of document.querySelectorAll(".p-farbe")) g.classList.toggle("an", g === f);
});
// Tasten: der Client vergleicht KeyCodes (TableMenuController.Update) - die Seite meldet nur,
// die Wirkung entscheidet der Server. Tasten haben keinen Trefferbereich. Ob Escape am // Client schliesst, ist nicht gemessen; das entscheidet der Schalter (esc_schliesst).
// Zahlen des Clients (Debug-Port-Weg) und die der physischen Tasten (Mac-Tastatur) dazu.
const TASTEN = {99: "c", 102: "f", 107: "k", 115: "s", 116: "t", 44: "komma", 13: "return",
27: "escape", 276: "links", 275: "rechts", 37: "links", 39: "rechts",
67: "c", 70: "f", 75: "k", 83: "s", 84: "t", 188: "komma", 36: "return"};
addEventListener("keydown", e => {
const n = TASTEN[e.keyCode !== undefined ? e.keyCode: e.which];
if (n) senden("/api/taste", {taste: n}).then(laden);
});
window.bedienerZeigt = laden; // vom Server angestossen, wenn POST /api/bediener kommt
addEventListener("resize", () => anordnen());
laden();
setInterval(laden, 250);
setInterval(uhrTicken, 100);
</script>
</body>
</html>