Skip to content

Instantly share code, notes, and snippets.

@emlyn
Last active September 28, 2024 22:14
Show Gist options
  • Save emlyn/e8a626ad794d36eb0856655c32bcf955 to your computer and use it in GitHub Desktop.
Save emlyn/e8a626ad794d36eb0856655c32bcf955 to your computer and use it in GitHub Desktop.
// ==UserScript==
// @name Don't F With Paste
// @description Stop idiots who think they're clever
// @downloadURL https://gist.github.com/emlyn/e8a626ad794d36eb0856655c32bcf955/raw/dontfwithpaste.user.js
// @updateURL https://gist.github.com/emlyn/e8a626ad794d36eb0856655c32bcf955/raw/dontfwithpaste.user.js
// @namespace https://gist.github.com/emlyn
// @version 0.2
// @author Emlyn Corrin
// @match http*://*/*
// @grant none
// ==/UserScript==
(function() {
'use strict';
// Don't run on these hosts:
const blacklist = new Set(['docs.google.com']);
const allowPaste = function(e){
e.stopImmediatePropagation();
return true;
};
if (!blacklist.has(window.location.host)) {
document.addEventListener('paste', allowPaste, true);
}
})();
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment