// ==UserScript== // @name 解除复制限制 // @version 0.1 // @author 0 // @namespace 0 // @match *://*/* // @run-at document-start // @description 解除网页对右键、选中、复制的限制 // @grant GM_registerMenuCommand // @license CC0-1.0 // ==/UserScript== (function() {'use strict'; const css = `*{user-select:text!important;-webkit-user-select:text!important;-webkit-touch-callout:default!important;touch-action:auto!important}`; const style = document.createElement('style'); style.textContent = css; document.documentElement.append(style); const events = ['copy', 'cut', 'contextmenu', 'selectstart']; function stopEvent(e) { e.stopImmediatePropagation(); } function EBK() { events.forEach(type => { window.addEventListener(type, stopEvent, true); }); } function DBK() { events.forEach(type => { window.removeEventListener(type, stopEvent, true); }); } EBK(); GM_registerMenuCommand("关闭限制解除(恢复原站功能)", DBK); GM_registerMenuCommand("开启限制解除", EBK); })();