Created
January 26, 2025 16:10
-
-
Save evanreichard/df124524d8b20b79508afd35bcc42e08 to your computer and use it in GitHub Desktop.
enable-paste.user.js
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// ==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"); | |
})(); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment