Enable Copy Paste Everywhere

Force enable copy, paste, cut, select text, and right-click on all websites

θα χρειαστεί να εγκαταστήσετε μια επέκταση όπως το Tampermonkey, το Greasemonkey ή το Violentmonkey για να εγκαταστήσετε αυτόν τον κώδικα.

You will need to install an extension such as Tampermonkey to install this script.

θα χρειαστεί να εγκαταστήσετε μια επέκταση όπως το Tampermonkey ή το Violentmonkey για να εγκαταστήσετε αυτόν τον κώδικα.

θα χρειαστεί να εγκαταστήσετε μια επέκταση όπως το Tampermonkey ή το Userscripts για να εγκαταστήσετε αυτόν τον κώδικα.

You will need to install an extension such as Tampermonkey to install this script.

Θα χρειαστεί να εγκαταστήσετε μια επέκταση διαχείρισης κώδικα χρήστη για να εγκαταστήσετε αυτόν τον κώδικα.

(Έχω ήδη έναν διαχειριστή κώδικα χρήστη, επιτρέψτε μου να τον εγκαταστήσω!)

You will need to install an extension such as Stylus to install this style.

You will need to install an extension such as Stylus to install this style.

You will need to install an extension such as Stylus to install this style.

You will need to install a user style manager extension to install this style.

You will need to install a user style manager extension to install this style.

You will need to install a user style manager extension to install this style.

(Έχω ήδη έναν διαχειριστή στυλ χρήστη, επιτρέψτε μου να τον εγκαταστήσω!)

// ==UserScript==
// @name         Enable Copy Paste Everywhere
// @namespace    https://tampermonkey.net/
// @version      1.0
// @description  Force enable copy, paste, cut, select text, and right-click on all websites
// @author       You
// @match        *://*/*
// @grant        none
// @run-at       document-start
// @license MIT
// ==/UserScript==

(function () {
    'use strict';

    // Stop sites from blocking events
    const events = [
        'copy',
        'cut',
        'paste',
        'selectstart',
        'contextmenu',
        'keydown',
        'mousedown',
        'mouseup'
    ];

    events.forEach(event => {
        document.addEventListener(event, e => {
            e.stopPropagation();
        }, true);
    });

    // Remove inline event handlers
    function removeHandlers(element) {
        if (!element) return;
        events.forEach(event => {
            element[`on${event}`] = null;
        });
    }

    // Apply to document and body
    removeHandlers(document);
    removeHandlers(document.body);

    // Force CSS to allow selection
    const style = document.createElement('style');
    style.innerHTML = `
        * {
            user-select: text !important;
            -webkit-user-select: text !important;
            -moz-user-select: text !important;
            -ms-user-select: text !important;
        }
    `;
    document.documentElement.appendChild(style);

    // Observe DOM changes and clean new elements
    const observer = new MutationObserver(mutations => {
        mutations.forEach(mutation => {
            mutation.addedNodes.forEach(node => {
                if (node.nodeType === 1) {
                    removeHandlers(node);
                }
            });
        });
    });

    observer.observe(document, { childList: true, subtree: true });

})();