From 46ce940f8bb71454740741affe9cd82ee799e01f Mon Sep 17 00:00:00 2001 From: Tor Andersson Date: Sun, 10 Apr 2022 12:27:04 +0200 Subject: 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. --- public/common/play.js | 21 ++++++++++++++------- 1 file changed, 14 insertions(+), 7 deletions(-) (limited to 'public') 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"); -- cgit v1.2.3