diff options
author | Tor Andersson <tor@ccxvii.net> | 2022-04-10 12:27:04 +0200 |
---|---|---|
committer | Tor Andersson <tor@ccxvii.net> | 2022-04-15 14:34:52 +0200 |
commit | 46ce940f8bb71454740741affe9cd82ee799e01f (patch) | |
tree | cb564b849adea8db0aea127ab999dbefc8e4e0b6 /public | |
parent | 8eb1b2f8c4565be28531a057a747cda14512f444 (diff) | |
download | server-46ce940f8bb71454740741affe9cd82ee799e01f.tar.gz |
Add Go Home menu item to the main cogwheel menu.
Remove Fullscreen menu item since the fullscreen API doesn't work in Safari,
and browsers already have good shortcuts for going fullscreen.
Diffstat (limited to 'public')
-rw-r--r-- | public/common/play.js | 21 |
1 files changed, 14 insertions, 7 deletions
diff --git a/public/common/play.js b/public/common/play.js index b91e4a0..cba9870 100644 --- a/public/common/play.js +++ b/public/common/play.js @@ -456,13 +456,6 @@ try { /* MAP ZOOM */ -function toggle_fullscreen() { - if (document.fullscreen) - document.exitFullscreen(); - else - document.documentElement.requestFullscreen(); -} - function toggle_log() { document.querySelector("aside").classList.toggle("hide"); zoom_map(); @@ -851,3 +844,17 @@ window.addEventListener("load", function () { if (params.mode === "play") connect_play(); }); + +function init_home_menu(link, text) { + let popup = document.querySelector(".menu_popup"); + let sep = document.createElement("div"); + sep.className = "menu_separator"; + popup.insertBefore(sep, popup.firstChild); + let item = document.createElement("div"); + item.className = "menu_item"; + item.onclick = () => window.open(link, "_self"); + item.textContent = text; + popup.insertBefore(item, popup.firstChild); +} + +init_home_menu("/games/active", "Go Home"); |