diff options
-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", "/") } |