// ==UserScript== // @name 万能解除复制限制 - Anti-Copy Killer // @namespace http://tampermonkey.net/ // @version 1.6 // @description 解除网页禁止复制、右键、选择等限制,支持大多数反爬和反复制网站 // @author You // @match *://*/* // @grant none // @run-at document-start // ==/UserScript== (function () { 'use strict'; // === 1. 强制允许选择 - 使用更温和的方式 === function addSelectStyle() { const style = document.createElement('style'); style.textContent = ` * { -webkit-user-select: auto !important; -moz-user-select: auto !important; -ms-user-select: auto !important; user-select: auto !important; } `; if (document.head) { document.head.appendChild(style); } else { document.addEventListener('DOMContentLoaded', () => { document.head.appendChild(style); }); } } addSelectStyle(); // === 2. 页面加载完成后执行主要解锁逻辑 === function unlockPage() { // 清除常见的限制属性 try { document.onselectstart = null; document.oncopy = null; document.oncut = null; document.onpaste = null; document.oncontextmenu = null; if (document.body) { document.body.onselectstart = null; document.body.oncopy = null; document.body.oncut = null; document.body.onpaste = null; document.body.oncontextmenu = null; } } catch (e) {} } // === 3. 支持关键快捷键 === function enableShortcuts() { document.addEventListener('keydown', function(e) { // 允许 Ctrl+A/C/V/X if (e.ctrlKey || e.metaKey) { const key = e.keyCode || e.which; if ([65, 67, 86, 88].includes(key)) { e.stopPropagation(); } } }, true); } // === 4. 移除常见的限制样式 === function removeRestrictiveStyles() { // 定期检查并移除限制性样式 setInterval(() => { const elements = document.querySelectorAll('*'); elements.forEach(el => { const style = getComputedStyle(el); if (style.userSelect === 'none') { el.style.setProperty('user-select', 'auto', 'important'); } }); }, 1000); } // === 5. 绑定事件 === if (document.readyState === 'loading') { document.addEventListener('DOMContentLoaded', function() { unlockPage(); enableShortcuts(); removeRestrictiveStyles(); }); } else { unlockPage(); enableShortcuts(); removeRestrictiveStyles(); } // 页面完全加载后再次执行 window.addEventListener('load', unlockPage); // === 6. 处理动态内容 === const observer = new MutationObserver(function(mutations) { mutations.forEach(function(mutation) { mutation.addedNodes.forEach(function(node) { if (node.nodeType === 1) { // 元素节点 // 移除新添加元素的限制 if (node.style) { if (node.style.userSelect === 'none') { node.style.userSelect = 'auto'; } } } }); }); }); // 开始观察 document.addEventListener('DOMContentLoaded', function() { observer.observe(document.body, { childList: true, subtree: true }); }); })();