summaryrefslogtreecommitdiff
path: root/public/join.js
diff options
context:
space:
mode:
authorTor Andersson <tor@ccxvii.net>2022-01-02 17:59:07 +0100
committerTor Andersson <tor@ccxvii.net>2022-01-06 12:40:25 +0100
commit74166074606cdba810b1b42f87af8cbe0bab6519 (patch)
treeb88170560eb9dcd584766c300792fb6457ee91de /public/join.js
parent72ebf85bc7f3a5f8fdf37e96a319ccbb8ea5768d (diff)
downloadserver-74166074606cdba810b1b42f87af8cbe0bab6519.tar.gz
Add game replay functionality.
Handle missing replay data. Add replay/rematch/exit buttons on game-over. Set 'player' to active player during replays. Replace space with underscore in role class names. Fix critical undo bug! Set game_over state during replays. Fix jumpy view in battle replays. Nuke undo states from all actions, not just 'undo'. Log play and replay page requests. Clean up client.js and allow selecting replay viewpoint. Add debug mode to replay prompt showing active, state, and next action. Init client roles from HTML structure. Remove unused rematch functions. Drop /info/ prefix on game pages. Update body role classList when replay viewpoint changes.
Diffstat (limited to 'public/join.js')
-rw-r--r--public/join.js5
1 files changed, 4 insertions, 1 deletions
diff --git a/public/join.js b/public/join.js
index 24e10ab..eef3833 100644
--- a/public/join.js
+++ b/public/join.js
@@ -68,11 +68,14 @@ function start_event_source() {
});
evtsrc.addEventListener("deleted", function (evt) {
console.log("DELETED");
- window.location.href = '/info/' + game.title_id;
+ window.location.href = '/' + game.title_id;
});
evtsrc.onerror = function (err) {
window.message.innerHTML = "Disconnected from server...";
};
+ window.addEventListener('beforeunload', function (evt) {
+ evtsrc.close();
+ });
}
}