Force Enable Right-Click & Selection

Restore right-click, text selection, and copy-paste on sites that try to block them.

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

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

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

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

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

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

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

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

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

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

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

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

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

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

// ==UserScript==
// @name         Force Enable Right-Click & Selection
// @namespace    https://github.com/EdwardDK
// @version      1.0
// @description  Restore right-click, text selection, and copy-paste on sites that try to block them.
// @author       EdwardDK
// @match        *://*/*
// @grant        none
// @run-at       document-start
// @license MIT
// ==/UserScript==

(function() {
    'use strict';

    const eventsToRestore = [
        'contextmenu', 'copy', 'cut', 'paste',
        'mousedown', 'mouseup', 'selectstart', 'dragstart'
    ];

    const bypass = (e) => {
        e.stopPropagation(); 
    };

    eventsToRestore.forEach(eventType => {
        document.addEventListener(eventType, bypass, true);
    });
    const style = document.createElement('style');
    style.innerHTML = `
        * {
            -webkit-user-select: auto !important;
            -moz-user-select: auto !important;
            -ms-user-select: auto !important;
            user-select: auto !important;
        }
    `;
    document.documentElement.appendChild(style);

    console.log("Right-click & Selection restrictions have been bypassed.");
})();