map-making.app hide UI

Press `h` to hide the UI

当前为 2025-05-20 提交的版本,查看 最新版本

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

"use strict";

let style;
let hidden;

document.addEventListener("keydown", (e) => {
  if (e.keyCode === 72 && !hidden) return hide();
  if (e.keyCode === 72 && 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() {
  if (style) style.remove();
  hidden = false;
}