您需要先安装一个扩展,例如 篡改猴、Greasemonkey 或 暴力猴,之后才能安装此脚本。
您需要先安装一个扩展,例如 篡改猴 或 暴力猴,之后才能安装此脚本。
您需要先安装一个扩展,例如 篡改猴 或 暴力猴,之后才能安装此脚本。
您需要先安装一个扩展,例如 篡改猴 或 Userscripts ,之后才能安装此脚本。
您需要先安装一款用户脚本管理器扩展,例如 Tampermonkey,才能安装此脚本。
您需要先安装用户脚本管理器扩展后才能安装此脚本。
Unblock text selection, copy, right-click and remove overlay blockers on all sites
当前为
// ==UserScript== // @name Copy & Select Unlocker // @namespace http://shinobu-scripts.local/ // @version 2.1 // @description Unblock text selection, copy, right-click and remove overlay blockers on all sites // @author Shinobu // @match *://*/* // @run-at document-end // @license GPLv3 // ==/UserScript== (function() { 'use strict'; // Add CSS to allow text selection function injectSelectionStyles() { const css = '* { user-select: text !important; -webkit-user-select: text !important; -moz-user-select: text !important; -ms-user-select: text !important; } [style*="user-select: none"], [style*="user-select:none"] { user-select: text !important; }'; const styleEl = document.createElement('style'); styleEl.textContent = css; document.head.appendChild(styleEl); } // Remove full-page overlays function removeOverlays() { document.querySelectorAll('div, section').forEach(el => { const st = getComputedStyle(el); if ((st.position === 'fixed' || st.position === 'absolute') && el.offsetWidth >= window.innerWidth * 0.9 && el.offsetHeight >= window.innerHeight * 0.9) { el.remove(); } }); } // Observe and clean overlays function observeOverlays() { const obs = new MutationObserver(removeOverlays); obs.observe(document, { childList: true, subtree: true }); removeOverlays(); } // Restore native selection events function restoreEvents() { ['onselectstart', 'onmousedown', 'ondragstart'].forEach(evt => { document[evt] = null; }); if (window.getSelection().empty) { window.getSelection().empty = () => {}; } } // Prevent blocking handlers function stopPropagation(e) { e.stopImmediatePropagation(); } // Initialise all features function init() { injectSelectionStyles(); document.addEventListener('contextmenu', stopPropagation, true); document.addEventListener('selectstart', stopPropagation, true); document.addEventListener('copy', stopPropagation, true); document.addEventListener('keydown', e => { if ((e.ctrlKey || e.metaKey) && e.key.toLowerCase() === 'c') { e.stopImmediatePropagation(); } }, true); restoreEvents(); observeOverlays(); console.log('Copy & Select Liberator active'); } if (document.readyState === 'loading') { window.addEventListener('load', init); } else { init(); } })();