lets you hide all ui in the location preview with H
// ==UserScript==
// @name Map-Making Hide UI
// @namespace https://greasyfork.org/en/users/1501889
// @version 13.12
// @description lets you hide all ui in the location preview with H
// @author Clemens
// @match https://*.map-making.app/*
// @icon https://map-making.app/favicon.ico
// @run-at document-idle
// @license MIT
// ==/UserScript==
(function() {
'use strict';
const style = document.createElement('style');
style.textContent = `
.map-controls-hidden {
display: none !important;
}
`;
document.head.appendChild(style);
function findRootControlContainer() {
return document.querySelector('.location-preview__panorama');
}
function toggleControls() {
const rootContainer = findRootControlContainer();
if (!rootContainer) {
return;
}
const appControlsContainer = rootContainer.querySelector('.embed-controls');
const googleControlSelectors = [
'.gm-style-cc',
'.gmnoprint',
'.gm-svpc',
'.gm-bundled-control',
'.LGLeeN-keyboard-shortcuts-view',
'.gm-iv-container',
'.SLHIdE-sv-links-control'
];
const elementsToToggle = [];
if (appControlsContainer) {
elementsToToggle.push(appControlsContainer);
}
rootContainer.querySelectorAll(googleControlSelectors.join(', ')).forEach(el => {
elementsToToggle.push(el);
});
const panoViewport = rootContainer.querySelector('.gm-style div[tabindex="0"]');
if (panoViewport) {
const embeddedUIElements = panoViewport.querySelectorAll('div, svg, a, button, [role="button"]');
embeddedUIElements.forEach(el => {
if (el !== panoViewport) {
if (el.tagName !== 'CANVAS') {
elementsToToggle.push(el);
}
}
});
}
const uniqueControls = [...new Set(elementsToToggle)];
uniqueControls.forEach(el => {
el.classList.toggle('map-controls-hidden');
});
}
document.addEventListener('keydown', function(event) {
if (event.key === 'h' || event.key === 'H') {
const targetTagName = event.target.tagName;
if (targetTagName === 'INPUT' || targetTagName === 'TEXTAREA' || event.target.isContentEditable) {
return;
}
event.preventDefault();
toggleControls();
}
});
})();