allow_paste_in_browser_without_interaction

10/26/2023, 4:16:51 PM

You will need to install an extension such as Tampermonkey, Greasemonkey or Violentmonkey to install this script.

You will need to install an extension such as Tampermonkey or Violentmonkey to install this script.

You will need to install an extension such as Tampermonkey or Violentmonkey to install this script.

You will need to install an extension such as Tampermonkey or Userscripts to install this script.

You will need to install an extension such as Tampermonkey to install this script.

You will need to install a user script manager extension to install this script.

(I already have a user script manager, let me install it!)

You will need to install an extension such as Stylus to install this style.

You will need to install an extension such as Stylus to install this style.

You will need to install an extension such as Stylus to install this style.

You will need to install a user style manager extension to install this style.

You will need to install a user style manager extension to install this style.

You will need to install a user style manager extension to install this style.

(I already have a user style manager, let me install it!)

// ==UserScript==
// @name        allow_paste_in_browser_without_interaction
// @namespace   Violentmonkey Scripts
// @include     *
// @grant       none
// @version     0.0.1
// @author      liudonghua123
// @license MIT
// @description 10/26/2023, 4:16:51 PM
// ==/UserScript==

(function allow_paste_in_browser_without_interaction() {

    // https://superuser.com/questions/919625/how-to-paste-text-into-input-fields-that-block-it
    const forceBrowserDefault = function(e){
        e.stopImmediatePropagation();
        return true;
    };
  
    document.addEventListener('copy', forceBrowserDefault, true);
    document.addEventListener('cut', forceBrowserDefault, true);
    document.addEventListener('paste', forceBrowserDefault, true);
})();