From 327acfe1124cdafc5eb460a039222a160f867ba3 Mon Sep 17 00:00:00 2001 From: Tor Andersson Date: Wed, 17 Nov 2021 13:39:16 +0100 Subject: Simplify URL for playing games. --- public/join.js | 11 ++++------- 1 file changed, 4 insertions(+), 7 deletions(-) (limited to 'public/join.js') diff --git a/public/join.js b/public/join.js index ce3d0d0..898113b 100644 --- a/public/join.js +++ b/public/join.js @@ -60,7 +60,7 @@ function start_event_source() { evtsrc.addEventListener("game", function (evt) { console.log("GAME:", evt.data); game = JSON.parse(evt.data); - if (game.status > 1) { + if (game.status > 0) { clearInterval(timer); evtsrc.close(); } @@ -85,9 +85,6 @@ function is_solo() { } function update() { - window.game_status.textContent = ["Open","Active","Finished","Abandoned"][game.status]; - window.game_result.textContent = game.result || "\u2014"; - for (let i = 0; i < roles.length; ++i) { let role = roles[i]; let role_id = "role_" + role.replace(/ /g, "_"); @@ -103,7 +100,7 @@ function update() { else element.className = ""; if (player.user_id === user_id) - element.innerHTML = `Play`; + element.innerHTML = `Play`; else element.innerHTML = player.name; } else { @@ -129,7 +126,7 @@ function update() { else message.innerHTML = "Waiting for players to join..."; } else { - message.innerHTML = `Observe`; + message.innerHTML = `Observe`; } if (game.owner_id === user_id) { @@ -150,7 +147,7 @@ function update() { window.onload = function () { update(); - if (game.status < 2) { + if (game.status === 0) { start_event_source(); timer = setInterval(start_event_source, 15000); } -- cgit v1.2.3