map-making.app hide UI

Press `h` to hide the UI

K instalaci tototo skriptu si budete muset nainstalovat rozšíření jako Tampermonkey, Greasemonkey nebo Violentmonkey.

K instalaci tohoto skriptu si budete muset nainstalovat rozšíření jako Tampermonkey nebo Violentmonkey.

K instalaci tohoto skriptu si budete muset nainstalovat rozšíření jako Tampermonkey nebo Violentmonkey.

K instalaci tohoto skriptu si budete muset nainstalovat rozšíření jako Tampermonkey nebo Userscripts.

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

K instalaci tohoto skriptu si budete muset nainstalovat manažer uživatelských skriptů.

(Už mám manažer uživatelských skriptů, nechte mě ho nainstalovat!)

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.

(Už mám manažer uživatelských stylů, nechte mě ho nainstalovat!)

// ==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;
}