34 lines
1.0 KiB
JavaScript
34 lines
1.0 KiB
JavaScript
// ==UserScript==
|
|
// @name Paste Enabler
|
|
// @version 0.0.1
|
|
// @description Re-enables paste functionality on websites
|
|
// @author Evan Reichard
|
|
// @match *://*/*
|
|
// @grant GM.registerMenuCommand
|
|
// @noframes
|
|
// @run-at document-start
|
|
// ==/UserScript==
|
|
|
|
(function() {
|
|
'use strict';
|
|
|
|
const enablePasteFunction = function() {
|
|
const events = ['paste', 'copy', 'cut'];
|
|
events.forEach(function(event) {
|
|
document.addEventListener(event, function(e) {
|
|
e.stopImmediatePropagation();
|
|
return true;
|
|
}, true);
|
|
});
|
|
|
|
document.querySelectorAll('input, textarea').forEach(function(el) {
|
|
el.setAttribute('oncopy', 'return true');
|
|
el.setAttribute('onpaste', 'return true');
|
|
el.setAttribute('oncut', 'return true');
|
|
el.removeAttribute('readonly');
|
|
});
|
|
};
|
|
|
|
// Register the menu command
|
|
GM.registerMenuCommand("Enable Paste", enablePasteFunction, "p");
|
|
})(); |