Greasy Fork is available in English.
Re-enable copy, paste, cut, text selection, and right-click on restrictive websites.
// ==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
});
})();