Make Input Events Passive

Make input event listeners passive

K instalaci tototo skriptu si budete muset nainstalovat rozšíření jako Tampermonkey, Greasemonkey nebo Violentmonkey.

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

K instalaci tohoto skriptu si budete muset nainstalovat rozšíření jako Tampermonkey nebo Violentmonkey.

K instalaci tohoto skriptu si budete muset nainstalovat rozšíření jako Tampermonkey nebo Userscripts.

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

K instalaci tohoto skriptu si budete muset nainstalovat manažer uživatelských skriptů.

(Už mám manažer uživatelských skriptů, nechte mě ho nainstalovat!)

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.

(Už mám manažer uživatelských stylů, nechte mě ho nainstalovat!)

// ==UserScript==
// @name         Make Input Events Passive
// @namespace    http://tampermonkey.net/
// @version      0.1
// @description  Make input event listeners passive
// @author       https://github.com/zzarcon/default-passive-events
// @include      *
// @run-at       document-start
// @license      MIT
// ==/UserScript==

(function() {

    var e,t=["scroll","wheel","touchstart","touchmove","touchenter","touchend","touchleave","mouseout","mouseleave","mousemove","mouseenter","mousewheel","mouseover"];
    if(function(){
        var e=!1;
        try{
            var t=Object.defineProperty({},"passive",{get:function(){e=!0}});
            window.addEventListener("test",null,t)
            window.removeEventListener("test",null,t)}
        catch(e){}return e}())
    {var o=EventTarget.prototype.addEventListener;
     e=o
     EventTarget.prototype.addEventListener=function(o,r,n){
         var s,a="object"==typeof n&&null!==n,i=a?n.capture:n;
         (n=a?function(e){
             var t=Object.getOwnPropertyDescriptor(e,"passive");
             return t&&!0!==t.writable&&void 0===t.set?Object.assign({},e):e}(n):{}).passive=void 0!==(s=n.passive)?s:-1!==t.indexOf(o)&&!0
         n.capture=void 0!==i&&i
         e.call(this,o,r,n)}
     EventTarget.prototype.addEventListener._original=e}


})();