Don't Fuck With Paste

Paste in any input field! Don't let stupid web design stop you. Code "borrowed" from the "Don't Fuck With Paste" webextension by Aaron Raimist

  1. // ==UserScript==
  2. // @name Don't Fuck With Paste
  3. // @namespace DontFuckWithPaste@NeckBeardedDragon
  4. // @version 0.1
  5. // @description Paste in any input field! Don't let stupid web design stop you. Code "borrowed" from the "Don't Fuck With Paste" webextension by Aaron Raimist
  6. // @author NeckBeardedDragon
  7. // @include *
  8. // @grant none
  9. // ==/UserScript==
  10.  
  11. (function() {
  12. 'use strict';
  13. const exclude = `https?://.*?\.facebook\.com/.*
  14. https?://.*?\.messenger\.com/.*
  15. https?://.*?.google.com/.*
  16. https?://.*?.?github.com/.*
  17. https?://imgur.com/.*`;
  18. const include =`.*`;
  19.  
  20. const allowCopyAndPaste = function(e) {
  21. e.stopImmediatePropagation();
  22. return true;
  23. };
  24. const excludes = new RegExp(exclude.split('\n').join('|'));
  25. const includes = new RegExp(include.split('\n').join('|'));
  26. const location = window.location.href;
  27. if (includes.test(location) && !excludes.test(location)) {
  28. document.addEventListener('copy', allowCopyAndPaste, true);
  29. document.addEventListener('paste', allowCopyAndPaste, true);
  30. }
  31.  
  32. })();