From 9e068aa062bb07f1f1b8704beffefbcaba260eb7 Mon Sep 17 00:00:00 2001 From: Tor Andersson Date: Fri, 24 Feb 2023 11:59:40 +0100 Subject: Use URL search params instead of funky colon separated arguments. --- public/join.js | 16 ++++++++-------- 1 file changed, 8 insertions(+), 8 deletions(-) (limited to 'public/join.js') diff --git a/public/join.js b/public/join.js index d140230..5bb8b9c 100644 --- a/public/join.js +++ b/public/join.js @@ -23,20 +23,20 @@ function start() { } function join(role) { - post(`/join/${game.game_id}/${role}`) + post(`/join/${game.game_id}/${encodeURIComponent(role)}`) } function part(role) { let warning = "Are you sure you want to LEAVE this game?" if (game.status === 0 || window.confirm(warning)) - post(`/part/${game.game_id}/${role}`) + post(`/part/${game.game_id}/${encodeURIComponent(role)}`) } function kick(role) { let player = players.find(p => p.role === role) let warning = `Are you sure you want to KICK player ${player.name} (${role}) from this game?` if (game.status === 0 || window.confirm(warning)) - post(`/part/${game.game_id}/${role}`) + post(`/part/${game.game_id}/${encodeURIComponent(role)}`) } let blink_title = document.title @@ -128,14 +128,14 @@ function update() { switch (game.status) { case 2: if (player.user_id === user_id) - element.innerHTML = `${player.name}` + element.innerHTML = `${player.name}` else element.innerHTML = player.name break case 1: element.classList.toggle("is_active", is_active(player, role)) if (player.user_id === user_id) - element.innerHTML = `${player.name}\u274c` + element.innerHTML = `${player.name}\u274c` else if (game.owner_id === user_id) element.innerHTML = `${player.name}\u274c` else @@ -181,11 +181,11 @@ function update() { else message.innerHTML = "Waiting for players to join..." } else if (game.status === 1) { - message.innerHTML = `Observe` + message.innerHTML = `Observe` } else if (game.status === 2) { - message.innerHTML = `Review` + message.innerHTML = `Review` } else { - message.innerHTML = `Enter` + message.innerHTML = `Enter` } if (game.owner_id === user_id) { -- cgit v1.2.3