Enable Copy Paste and Right Click

This script forcefully removes all JavaScript restrictions to enable text selection, copy-paste (Ctrl+C, Ctrl+V), and right-click (context menu) on restrictive websites.

За да инсталирате този скрипт, трябва да имате инсталирано разширение като Tampermonkey, Greasemonkey или Violentmonkey.

За да инсталирате този скрипт, трябва да инсталирате разширение, като например Tampermonkey .

За да инсталирате този скрипт, трябва да имате инсталирано разширение като Tampermonkey или Violentmonkey.

За да инсталирате този скрипт, трябва да имате инсталирано разширение като Tampermonkey или Userscripts.

За да инсталирате скрипта, трябва да инсталирате разширение като Tampermonkey.

За да инсталирате този скрипт, трябва да имате инсталиран скриптов мениджър.

(Вече имам скриптов мениджър, искам да го инсталирам!)

За да инсталирате този стил, трябва да инсталирате разширение като Stylus.

За да инсталирате този стил, трябва да инсталирате разширение като Stylus.

За да инсталирате този стил, трябва да инсталирате разширение като Stylus.

За да инсталирате този стил, трябва да имате инсталиран мениджър на потребителски стилове.

За да инсталирате този стил, трябва да имате инсталиран мениджър на потребителски стилове.

За да инсталирате този стил, трябва да имате инсталиран мениджър на потребителски стилове.

(Вече имам инсталиран мениджър на стиловете, искам да го инсталирам!)

// ==UserScript==
// @name         Enable Copy Paste and Right Click
// @namespace    https://greatest.deepsurf.us/en/users/1461725-scriptninja
// @version      1.0.0
// @description  This script forcefully removes all JavaScript restrictions to enable text selection, copy-paste (Ctrl+C, Ctrl+V), and right-click (context menu) on restrictive websites.
// @author       ScriptNinja
// @license      MIT
// @match        *://*/*
// @icon         https://www.google.com/s2/favicons?domain=greatest.deepsurf.us
// @grant        none
// @run-at       document-start
// ==/UserScript==

(function() {
    'use strict';

    // 1. Function to clear event listeners and attributes
    function clearEventListeners() {
        // Clear common event handlers on document
        document.oncontextmenu = null;
        document.oncopy = null;
        document.oncut = null;
        document.onpaste = null;
        document.onselectstart = null;
        document.onkeydown = null;

        // Clear event handlers on body (if body exists)
        if (document.body) {
            document.body.oncontextmenu = null;
            document.body.oncopy = null;
            document.body.oncut = null;
            document.body.onpaste = null;
            document.body.onselectstart = null;
            document.body.removeAttribute('oncopy');
            document.body.removeAttribute('onselectstart');
            document.body.removeAttribute('oncontextmenu');
        }

        // 2. Force default action (allow) on events during the Capturing Phase
        var allowAction = function(e){
            e.stopImmediatePropagation();
            return true;
        };

        // Add event listeners to override restrictions
        document.addEventListener('contextmenu', allowAction, true);
        document.addEventListener('copy', allowAction, true);
        document.addEventListener('paste', allowAction, true);
        document.addEventListener('cut', allowAction, true);
        document.addEventListener('selectstart', allowAction, true);
        document.addEventListener('keydown', allowAction, true);

        // 3. Override CSS property `user-select: none` using !important
        var style = document.createElement('style');
        style.type = 'text/css';
        style.innerHTML = '* { -webkit-user-select: text !important; -moz-user-select: text !important; -ms-user-select: text !important; user-select: text !important; }';
        if (document.head) {
            document.head.appendChild(style);
        }
    }

    // Run immediately before the page loads any other scripts (@run-at document-start)
    clearEventListeners();

    // Run again after the page loads and multiple times with a delay to catch late-loading scripts
    window.addEventListener('load', clearEventListeners);
    setTimeout(clearEventListeners, 1000);
    setTimeout(clearEventListeners, 3000);
    setTimeout(clearEventListeners, 5000);
})();