map-making.app hide UI

Press `h` to hide the UI

You will need to install an extension such as Tampermonkey, Greasemonkey or Violentmonkey to install this script.

You will need to install an extension such as Tampermonkey or Violentmonkey to install this script.

You will need to install an extension such as Tampermonkey or Violentmonkey to install this script.

You will need to install an extension such as Tampermonkey or Userscripts to install this script.

You will need to install an extension such as Tampermonkey to install this script.

You will need to install a user script manager extension to install this script.

(I already have a user script manager, let me install it!)

You will need to install an extension such as Stylus to install this style.

You will need to install an extension such as Stylus to install this style.

You will need to install an extension such as Stylus to install this style.

You will need to install a user style manager extension to install this style.

You will need to install a user style manager extension to install this style.

You will need to install a user style manager extension to install this style.

(I already have a user style manager, let me install it!)

// ==UserScript==
// @name        map-making.app hide UI
// @namespace   alienperfect
// @match       https://map-making.app/*
// @grant       GM_addStyle
// @version     1.1
// @author      Alien Perfect
// @description Press `h` to hide the UI
// ==/UserScript==

"use strict";

const key = "h";
let style;
let hidden;

document.addEventListener("keydown", (e) => {
  if (e.key === key && document.activeElement.tagName !== "INPUT" && !hidden) return hide();
  if (e.key === key && hidden) return show();
});

function hide() {
  style = GM_addStyle(`
    .embed-controls {display: none !important}
    .SLHIdE-sv-links-control {display: none !important}
    [class$="gmnoprint"], [class$="gm-style-cc"] {display: none !important}
  `);

  hidden = true;
}

function show() {
  style.remove();
  hidden = false;
}