diff options
author | Tor Andersson <tor@ccxvii.net> | 2022-10-06 00:40:54 +0200 |
---|---|---|
committer | Tor Andersson <tor@ccxvii.net> | 2022-10-06 00:40:54 +0200 |
commit | abfeff003020d0435219e24c14a5029cda4eba0f (patch) | |
tree | 429a6e4cd65b3fe55285f2e32de707da217d5a08 | |
parent | 2af642fd74f0e7582759eabb26e489bf1ac37c78 (diff) | |
download | server-abfeff003020d0435219e24c14a5029cda4eba0f.tar.gz |
Make main menu links actual links.
-rw-r--r-- | public/common/play.css | 6 | ||||
-rw-r--r-- | public/common/play.js | 18 |
2 files changed, 20 insertions, 4 deletions
diff --git a/public/common/play.css b/public/common/play.css index 02a667d..8e23a91 100644 --- a/public/common/play.css +++ b/public/common/play.css @@ -189,6 +189,7 @@ footer { } .menu_item { padding: 4px 8px; + cursor: pointer; } .menu_item:hover { background-color: black; @@ -197,6 +198,11 @@ footer { .menu_item:hover img { filter: invert(100%); } +a.menu_item { + display: block; + text-decoration: none; + color: black; +} /* TOOL BAR */ diff --git a/public/common/play.js b/public/common/play.js index 25f237a..ec7cd9b 100644 --- a/public/common/play.js +++ b/public/common/play.js @@ -1010,10 +1010,20 @@ function add_main_menu_item(text, onclick) { popup.insertBefore(item, sep) } +function add_main_menu_item_link(text, url) { + let popup = document.querySelector(".menu_popup") + let sep = document.getElementById("main_menu_separator") + let item = document.createElement("a") + item.className = "menu_item" + item.href = url + item.textContent = text + popup.insertBefore(item, sep) +} + init_main_menu() -if (params.role !== "Observer") { - add_main_menu_item("Go home", () => window.open("/games/active", "_self")) - add_main_menu_item("Go to next game", () => window.open("/games/next", "_self")) +if (params.mode === "play" && params.role !== "Observer") { + add_main_menu_item_link("Go home", "/games/active") + add_main_menu_item_link("Go to next game", "/games/next") } else { - add_main_menu_item("Go home", () => window.open("/", "_self")) + add_main_menu_item_link("Go home", "/") } |