您需要先安装一个扩展,例如 篡改猴、Greasemonkey 或 暴力猴,之后才能安装此脚本。
您需要先安装一个扩展,例如 篡改猴 或 暴力猴,之后才能安装此脚本。
您需要先安装一个扩展,例如 篡改猴 或 暴力猴,之后才能安装此脚本。
您需要先安装一个扩展,例如 篡改猴 或 Userscripts ,之后才能安装此脚本。
您需要先安装一款用户脚本管理器扩展,例如 Tampermonkey,才能安装此脚本。
您需要先安装用户脚本管理器扩展后才能安装此脚本。
Simple map fullscreen toggle with M key
当前为
// ==UserScript== // @name Map Fullscreen // @namespace bennoghg // @match https://map-making.app/* // @grant GM_addStyle // @version 4.0.0 // @author BennoGHG // @description Simple map fullscreen toggle with M key // @run-at document-idle // ==/UserScript== (function() { 'use strict'; // State management let fullEnabled = false; // Fullscreen toggle functions function enableFullscreen() { const container = document.querySelector('.gm-style')?.parentElement; if (!container) return; if (container.requestFullscreen) container.requestFullscreen(); fullEnabled = true; } function disableFullscreen() { if (document.fullscreenElement) document.exitFullscreen(); fullEnabled = false; } // Exit fullscreen when Street View opens function checkStreetView() { if (!fullEnabled) return; const pano = document.querySelector('.gm-iv-viewer, .gm-iv-container, [aria-label*="Street View"]'); if (pano) disableFullscreen(); } new MutationObserver(checkStreetView).observe(document.body, { childList: true, subtree: true }); document.body.addEventListener('click', e => { if (fullEnabled && e.target.closest('a[href*="cbll="]')) disableFullscreen(); }); // Check if user is typing in a text field function isTypingInTextField() { const activeElement = document.activeElement; if (!activeElement) return false; const tagName = activeElement.tagName.toLowerCase(); const inputType = activeElement.type?.toLowerCase(); // Check for input fields, textareas, and contenteditable elements return ( tagName === 'input' && ( inputType === 'text' || inputType === 'search' || inputType === 'email' || inputType === 'url' || inputType === 'password' || inputType === 'number' || !inputType // Default input type is text ) ) || tagName === 'textarea' || activeElement.contentEditable === 'true' || activeElement.isContentEditable; } // Keyboard shortcuts document.addEventListener('keydown', e => { // Only respond to M/m key and only if not typing in a text field if ((e.key === 'm' || e.key === 'M') && !isTypingInTextField()) { e.preventDefault(); // Prevent any default behavior fullEnabled ? disableFullscreen() : enableFullscreen(); } }); })();
QingJ © 2025
镜像随时可能失效,请加Q群300939539或关注我们的公众号极客氢云获取最新地址