Greasy Fork

Greasy Fork is available in English.

【最强】解除禁止复制和粘贴限制(全网页通用)

破解所有网站【禁止复制】和【禁止粘贴】,没错,是所有网站,什么【学习通】、【pta】啥的禁止粘贴,【CSDN】啥的禁止复制!!使用方法:安装完毕后打开目标网页,就可以正常使用了。然后没了,有疑问或者反馈都可以发我邮箱啊:[email protected]

当前为 2024-11-05 提交的版本,查看 最新版本

// ==UserScript==
// @name         【最强】解除禁止复制和粘贴限制(全网页通用)
// @namespace    http://jiangning_sama/pojie_cpoy.net/
// @version      6.71.0
// @description  破解所有网站【禁止复制】和【禁止粘贴】,没错,是所有网站,什么【学习通】、【pta】啥的禁止粘贴,【CSDN】啥的禁止复制!!使用方法:安装完毕后打开目标网页,就可以正常使用了。然后没了,有疑问或者反馈都可以发我邮箱啊:[email protected]
// @author       江宁sama
// @match        *://*/* 
// @grant        none
// @license      MIT
// ==/UserScript==

(function () {
    'use strict';
    function unlockCopyPaste() {
        document.body.removeAttribute('onselectstart');
        document.body.style.userSelect = 'auto';
        document.documentElement.style.userSelect = 'auto';
        document.querySelectorAll('*').forEach((el) => {
            el.style.userSelect = 'auto';
            el.style.pointerEvents = 'auto';
            el.removeAttribute('oncopy');
            el.removeAttribute('oncut');
            el.removeAttribute('onpaste');
            el.removeAttribute('oncontextmenu');
            el.removeAttribute('onmousedown');
            el.removeAttribute('onselectstart');
            el.oncopy = null;
            el.oncut = null;
            el.onpaste = null;
            el.oncontextmenu = null;
            el.onmousedown = null;
            el.onselectstart = null;
            if (el.classList.contains('hljs-button') && el.dataset.title === "登录复制") {
                el.style.display = 'none'; 
            }
        });
        const eventTypes = ['copy', 'cut', 'paste', 'contextmenu', 'selectstart', 'mousedown'];
        eventTypes.forEach((eventType) => {
            document.addEventListener(eventType, (e) => e.stopPropagation(), true);
        });
        console.log("已解除页面的禁止复制和粘贴限制");
    }

    function init() {
        unlockCopyPaste();
    }
    setInterval(init, 3000);
})();