From 307544777d6be62c02c4ae0810b4dc3fd9c6094f Mon Sep 17 00:00:00 2001 From: Geoffrey Allott Date: Sat, 6 Mar 2021 08:23:36 +0000 Subject: [PATCH] disable fold action and change "call" to "check" when chips_to_call is 0 --- site/modules/poker.js | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/site/modules/poker.js b/site/modules/poker.js index 08fda65..8606470 100644 --- a/site/modules/poker.js +++ b/site/modules/poker.js @@ -83,8 +83,8 @@ export class TexasHoldEm { this.svg.append(this.call_control); const call_control_label = document.createElementNS(svgns, "text"); - const call_control_text = document.createTextNode("Call"); - call_control_label.append(call_control_text); + this.call_control_text = document.createTextNode("Call"); + call_control_label.append(this.call_control_text); call_control_label.setAttribute("x", "385"); call_control_label.setAttribute("y", "470"); call_control_label.classList.add("call-control-label"); @@ -124,8 +124,9 @@ export class TexasHoldEm { } redraw_players() { - this.fold_control.classList.toggle("active", this.active === this.username); + this.fold_control.classList.toggle("active", this.active === this.username && this.chips_to_call() > 0); this.call_control.classList.toggle("active", this.active === this.username); + this.call_control_text.textContent = this.active === this.username && this.chips_to_call() == 0 ? "Check" : "Call"; this.bet_control.classList.toggle("active", this.active === this.username); for (const [username, [user, stack, active, bet]] of this.user_icons) { if (!this.seats.has(username)) { -- 2.34.1