From ff936d110603d594037a66940520f136828f0a03 Mon Sep 17 00:00:00 2001 From: Guido Date: Thu, 6 Aug 2026 19:09:00 +0200 Subject: [PATCH] Anti-Cheat: Tab-Wechsel beendet den Lauf; Admin-Panel breiter - visibilitychange -> gameOver, sobald der Tab versteckt/gewechselt wird (verhindert das "Pausieren im Hintergrund"-Spicken, da rAF im Hintergrund gedrosselt wird) - Admin .wrap max-width 1000 -> 1240 (Spielertabelle weniger gequetscht) Co-Authored-By: Claude Opus 4.8 --- public/admin.html | 2 +- public/js/app.js | 6 ++++++ 2 files changed, 7 insertions(+), 1 deletion(-) diff --git a/public/admin.html b/public/admin.html index b05ef1c..aebbcd2 100644 --- a/public/admin.html +++ b/public/admin.html @@ -8,7 +8,7 @@ body { margin:0; background:var(--bg); color:var(--text); font-family:system-ui,-apple-system,Segoe UI,Roboto,sans-serif; } a { color:var(--pink); } h1 { color:var(--pink); margin:0; font-size:22px; } - .wrap { max-width:1000px; margin:0 auto; padding:18px; } + .wrap { max-width:1240px; margin:0 auto; padding:18px; } input, button, select { font:inherit; } input[type=password], input[type=text], input[type=number] { background:var(--panel2); border:1px solid var(--border); color:var(--text); diff --git a/public/js/app.js b/public/js/app.js index 2caf1b7..7214a81 100644 --- a/public/js/app.js +++ b/public/js/app.js @@ -165,6 +165,12 @@ function stopModeWatch() { } } +// Anti-Cheat: Tab-Wechsel/Verstecken beendet den laufenden Lauf sofort (sonst pausiert +// der Browser die Spielschleife im Hintergrund -> man koennte in Ruhe "spicken"). +document.addEventListener('visibilitychange', () => { + if (document.hidden && state && state.running) gameOver(); +}); + function fieldSize() { const r = $('field').getBoundingClientRect(); return { w: r.width, h: r.height };