diff options
author | Tor Andersson <tor@ccxvii.net> | 2023-02-24 11:59:40 +0100 |
---|---|---|
committer | Tor Andersson <tor@ccxvii.net> | 2023-02-24 13:39:07 +0100 |
commit | 9e068aa062bb07f1f1b8704beffefbcaba260eb7 (patch) | |
tree | 38a39f22bd44a068b2f6e048367d0b0b1a250e1b /public/join.js | |
parent | d097e2db5862177d1c30cbf7df0e8143e67d901d (diff) | |
download | server-9e068aa062bb07f1f1b8704beffefbcaba260eb7.tar.gz |
Use URL search params instead of funky colon separated arguments.
Diffstat (limited to 'public/join.js')
-rw-r--r-- | public/join.js | 16 |
1 files changed, 8 insertions, 8 deletions
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 = `<a href="/${game.title_id}/play:${game.game_id}:${role}">${player.name}</a>` + element.innerHTML = `<a href="/${game.title_id}/play.html?game=${game.game_id}&role=${encodeURIComponent(role)}">${player.name}</a>` 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 = `<a href="/${game.title_id}/play:${game.game_id}:${role}">${player.name}</a><a class="red" href="javascript:part('${role}')">\u274c</a>` + element.innerHTML = `<a href="/${game.title_id}/play.html?game=${game.game_id}&role=${encodeURIComponent(role)}">${player.name}</a><a class="red" href="javascript:part('${role}')">\u274c</a>` else if (game.owner_id === user_id) element.innerHTML = `${player.name}<a class="red" href="javascript:kick('${role}')">\u274c</a>` else @@ -181,11 +181,11 @@ function update() { else message.innerHTML = "Waiting for players to join..." } else if (game.status === 1) { - message.innerHTML = `<a href="/${game.title_id}/play:${game.game_id}">Observe</a>` + message.innerHTML = `<a href="/${game.title_id}/play.html?game=${game.game_id}">Observe</a>` } else if (game.status === 2) { - message.innerHTML = `<a href="/${game.title_id}/play:${game.game_id}">Review</a>` + message.innerHTML = `<a href="/${game.title_id}/play.html?game=${game.game_id}">Review</a>` } else { - message.innerHTML = `<a href="/${game.title_id}/play:${game.game_id}">Enter</a>` + message.innerHTML = `<a href="/${game.title_id}/play.html?game=${game.game_id}">Enter</a>` } if (game.owner_id === user_id) { |