Greasy Fork

Greasy Fork is available in English.

还原对于选中复制限制

还原对于选中复制限制,通杀大部分网站

您需要先安装一款用户脚本管理器扩展,例如 Tampermonkey 篡改猴Greasemonkey 油猴子Violentmonkey 暴力猴,才能安装此脚本。

您需要先安装一款用户脚本管理器扩展,例如 Tampermonkey 篡改猴,才能安装此脚本。

您需要先安装一款用户脚本管理器扩展,例如 Tampermonkey 篡改猴Violentmonkey 暴力猴,才能安装此脚本。

您需要先安装一款用户脚本管理器扩展,例如 Tampermonkey 篡改猴Userscripts ,才能安装此脚本。

您需要先安装一款用户脚本管理器扩展,例如 Tampermonkey 篡改猴,才能安装此脚本。

您需要先安装一款用户脚本管理器扩展后才能安装此脚本。

(我已经安装了用户脚本管理器,让我安装!)

您需要先安装一款用户样式管理器扩展,比如 Stylus,才能安装此样式。

您需要先安装一款用户样式管理器扩展,比如 Stylus,才能安装此样式。

您需要先安装一款用户样式管理器扩展,比如 Stylus,才能安装此样式。

您需要先安装一款用户样式管理器扩展后才能安装此样式。

您需要先安装一款用户样式管理器扩展后才能安装此样式。

您需要先安装一款用户样式管理器扩展后才能安装此样式。

(我已经安装了用户样式管理器,让我安装!)

// ==UserScript==
// @name        还原对于选中复制限制
// @name:en     Remove the limitation on copy and selection
// @namespace   Violentmonkey Scripts
// @match       *://*/*
// @grant       none
// @version     1.1
// @author      wray
// @license     GPLV3
// @description 还原对于选中复制限制,通杀大部分网站
// @description:en Remove the limitation on copy and selection. suitable for almost all websites
// ==/UserScript==

(function () {
    /**
     * 还原所有修改
     */
    const fixAll = 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));
    };
    window.onload = fixAll;
    window.addEventListener('popstate', fixAll);
    window.addEventListener('hashchange', fixAll);
})();