Force Copy/Paste Everywhere

Re-enable copy, paste, cut, text selection, and right-click on restrictive websites.

이 스크립트를 설치하려면 Tampermonkey, Greasemonkey 또는 Violentmonkey와 같은 확장 프로그램이 필요합니다.

이 스크립트를 설치하려면 Tampermonkey와 같은 확장 프로그램을 설치해야 합니다.

이 스크립트를 설치하려면 Tampermonkey 또는 Violentmonkey와 같은 확장 프로그램이 필요합니다.

이 스크립트를 설치하려면 Tampermonkey 또는 Userscripts와 같은 확장 프로그램이 필요합니다.

이 스크립트를 설치하려면 Tampermonkey와 같은 확장 프로그램이 필요합니다.

이 스크립트를 설치하려면 유저 스크립트 관리자 확장 프로그램이 필요합니다.

(이미 유저 스크립트 관리자가 설치되어 있습니다. 설치를 진행합니다!)

Advertisement:

이 스타일을 설치하려면 Stylus와 같은 확장 프로그램이 필요합니다.

이 스타일을 설치하려면 Stylus와 같은 확장 프로그램이 필요합니다.

이 스타일을 설치하려면 Stylus와 같은 확장 프로그램이 필요합니다.

이 스타일을 설치하려면 유저 스타일 관리자 확장 프로그램이 필요합니다.

이 스타일을 설치하려면 유저 스타일 관리자 확장 프로그램이 필요합니다.

이 스타일을 설치하려면 유저 스타일 관리자 확장 프로그램이 필요합니다.

(이미 유저 스타일 관리자가 설치되어 있습니다. 설치를 진행합니다!)

Advertisement:

// ==UserScript==
// @name         Force Copy/Paste Everywhere
// @namespace    https://greasyfork.org/en/users/1573616-marito
// @version      1.0
// @description  Re-enable copy, paste, cut, text selection, and right-click on restrictive websites.
// @match        *://*/*
// @run-at       document-start
// @grant        none
// @license      Unlicense
// ==/UserScript==

(function () {
    'use strict';

    const stop = (e) => {
        e.stopImmediatePropagation();
    };

    [
        'copy',
        'cut',
        'paste',
        'contextmenu',
        'selectstart',
        'mousedown',
        'mouseup',
        'dragstart',
        'keydown',
        'keyup'
    ].forEach(event => {
        window.addEventListener(event, stop, true);
        document.addEventListener(event, stop, true);
    });

    const unlock = () => {
        document.querySelectorAll('*').forEach(el => {
            el.oncopy = null;
            el.oncut = null;
            el.onpaste = null;
            el.oncontextmenu = null;
            el.onselectstart = null;
            el.onmousedown = null;
            el.onmouseup = null;

            el.removeAttribute('oncopy');
            el.removeAttribute('oncut');
            el.removeAttribute('onpaste');
            el.removeAttribute('oncontextmenu');
            el.removeAttribute('onselectstart');

            el.style.userSelect = 'text';
            el.style.webkitUserSelect = 'text';
            el.style.MozUserSelect = 'text';
            el.style.msUserSelect = 'text';
        });
    };

    document.addEventListener('DOMContentLoaded', unlock);
    window.addEventListener('load', unlock);

    const observer = new MutationObserver(unlock);
    observer.observe(document.documentElement, {
        childList: true,
        subtree: true
    });
})();