summaryrefslogtreecommitdiff
path: root/public/join.js
diff options
context:
space:
mode:
authorTor Andersson <tor@ccxvii.net>2021-11-17 13:39:16 +0100
committerTor Andersson <tor@ccxvii.net>2021-11-17 19:05:15 +0100
commit327acfe1124cdafc5eb460a039222a160f867ba3 (patch)
tree20dc04fc3ed170881af2caf9ba0ae58a62f6020e /public/join.js
parent7b5ce7d3949755c12b663531ab5d0b3d3051de34 (diff)
downloadserver-327acfe1124cdafc5eb460a039222a160f867ba3.tar.gz
Simplify URL for playing games.
Diffstat (limited to 'public/join.js')
-rw-r--r--public/join.js11
1 files changed, 4 insertions, 7 deletions
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 = `<a href="/play/${game.game_id}/${role}">Play</a>`;
+ element.innerHTML = `<a href="/${game.title_id}/play:${game.game_id}:${role}">Play</a>`;
else
element.innerHTML = player.name;
} else {
@@ -129,7 +126,7 @@ function update() {
else
message.innerHTML = "Waiting for players to join...";
} else {
- message.innerHTML = `<a class="play" href="/play/${game.game_id}/Observer">Observe</a>`;
+ message.innerHTML = `<a href="/${game.title_id}/play:${game.game_id}">Observe</a>`;
}
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);
}