From d0175eec70debe3fbabf1869f420e92c7313c2ad Mon Sep 17 00:00:00 2001 From: Tor Andersson Date: Sat, 10 Jul 2021 00:53:29 +0200 Subject: Fix yellow "your turn" coloring in join and profile pages. --- public/join.js | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) (limited to 'public/join.js') diff --git a/public/join.js b/public/join.js index b0b93cf..19efcde 100644 --- a/public/join.js +++ b/public/join.js @@ -71,6 +71,12 @@ function start_event_source() { } } +function is_your_turn(player, role) { + if (player.user_id === user_id) + return (game.active_role === role || game.active_role === "Both" || game.active_role === "All"); + return false; +} + function update() { window.game_status.textContent = ["Open","Active","Finished","Abandoned"][game.status]; window.game_result.textContent = game.result || "\u2014"; @@ -85,7 +91,7 @@ function update() { let element = document.getElementById(role_id); if (player) { if (game.status > 0) { - if (game.active_role === role || game.active_role === "Both" || game.active_role === "All") + if (is_your_turn(player, role)) element.className = "is_your_turn"; else element.className = ""; -- cgit v1.2.3