summaryrefslogtreecommitdiff
path: root/public/common/client.js
diff options
context:
space:
mode:
Diffstat (limited to 'public/common/client.js')
-rw-r--r--public/common/client.js19
1 files changed, 15 insertions, 4 deletions
diff --git a/public/common/client.js b/public/common/client.js
index 7237c0a..28b4f8e 100644
--- a/public/common/client.js
+++ b/public/common/client.js
@@ -457,11 +457,17 @@ function send_restart(scenario) {
}
function on_game_over(game_over) {
- if (player && player != "Observer") {
+ if (player) {
+ let exit_button = document.querySelector("#exit_button");
+ if (exit_button) {
+ if (game_over || player == "Observer")
+ exit_button.classList.remove("hide");
+ else
+ exit_button.classList.add("hide");
+ }
let rematch_button = document.querySelector("#rematch_button");
- if (rematch_button)
- {
- if (game_over)
+ if (rematch_button) {
+ if (game_over && player != "Observer")
rematch_button.classList.remove("hide");
else
rematch_button.classList.add("hide");
@@ -474,3 +480,8 @@ function send_rematch() {
let game = params.get("game");
window.location = '/rematch/' + game;
}
+
+function send_exit() {
+ let title = window.location.pathname.split("/")[1];
+ window.location = '/info/' + title;
+}