summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--public/common/client.js19
-rw-r--r--public/images/exit-door.svg1
-rw-r--r--server.js2
3 files changed, 17 insertions, 5 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;
+}
diff --git a/public/images/exit-door.svg b/public/images/exit-door.svg
new file mode 100644
index 0000000..5e59298
--- /dev/null
+++ b/public/images/exit-door.svg
@@ -0,0 +1 @@
+<svg style="height: 512px; width: 512px;" xmlns="http://www.w3.org/2000/svg" viewBox="0 0 512 512"><g class="" style="" transform="translate(0,0)"><path d="M217 28.098v455.804l142-42.597V70.697zm159.938 26.88l.062 2.327V87h16V55zM119 55v117.27h18V73h62V55zm258 50v16h16v-16zm0 34v236h16V139zm-240 58.727V233H41v46h96v35.273L195.273 256zM244 232c6.627 0 12 10.745 12 24s-5.373 24-12 24-12-10.745-12-24 5.373-24 12-24zM137 339.73h-18V448h18zM377 393v14h16v-14zm0 32v23h16v-23zM32 471v18h167v-18zm290.652 0l-60 18H480v-18z" fill="#000" fill-opacity="1"></path></g></svg> \ No newline at end of file
diff --git a/server.js b/server.js
index c06bee0..fbad44b 100644
--- a/server.js
+++ b/server.js
@@ -649,7 +649,7 @@ const QUERY_COUNT_OPEN_GAMES = db.prepare("SELECT COUNT(*) FROM games WHERE owne
const QUERY_DELETE_GAME = db.prepare("DELETE FROM games WHERE game_id = ?");
const QUERY_REMATCH_FIND = db.prepare(`
- SELECT game_id FROM games WHERE status=0 AND description=?
+ SELECT game_id FROM games WHERE status<3 AND description=?
`).pluck();
const QUERY_REMATCH_CREATE = db.prepare(`