Greasy Fork

Greasy Fork is available in English.

还原对于选中复制限制

2024/6/23 01:40:07

当前为 2024-06-22 提交的版本,查看 最新版本

// ==UserScript==
// @name        还原对于选中复制限制
// @namespace   Violentmonkey Scripts
// @match       *://*/*
// @grant       none
// @version     1.0
// @author      wray
// @license     GPLV3
// @description 2024/6/23 01:40:07
// ==/UserScript==

(function () {
    /**
     * 还原所有修改
     */
    window.onload = function () {
        function fixChanges() {
            // 修复选中限制
            const styleTag = document.createElement('style');
            styleTag.innerHTML = '* {user-select: auto !important;}';
            document.head.appendChild(styleTag);
            // 修复按键限制
            ['onkeyup', 'onkeydown', 'onkeypress', 'onmousedown', 'onselectstart', 'oncontextmenu'].forEach(event => {
                window[event] = null;
                document[event] = null;
            });
            // 清空计时器
            window.clearInterval(fixChangesInterval);
        }
        const fixChangesInterval = window.setInterval(fixChanges, window.Math.ceil(Math.random() * 128));
    };
})();