Create a gist now

Instantly share code, notes, and snippets.

Webページのホイールスクロールが勝手にスムーススクロールになるやつの対策
// ==UserScript==
// @name Anti MouseWheelEvent Killer
// @description blocking window.mousewheel events
// @namespace https://gist.github.com/epser/
// @version 0.1
// @author eps_r
// @include http://*/*
// @include https://*/*
// @grant none
// @updateURL https://gist.github.com/epser/435a6bc6271fa63a467c1f1e3851a04d/raw/a66d5c2001abf68f55077cbaee1b25d2ed0bf987/anti_mousewheelevent_killer.user.js
// @downloadURL https://gist.github.com/epser/435a6bc6271fa63a467c1f1e3851a04d/raw/a66d5c2001abf68f55077cbaee1b25d2ed0bf987/anti_mousewheelevent_killer.user.js
// @run-at document-start
// ==/UserScript==
(function() {
'use strict';
var add = window.addEventListener;
var fuck = function() {
window.addEventListener = function() {
if(arguments[0] === "mousewheel" ||
arguments[0] === "wheel" ||
arguments[0] === "onmousewheel" ||
arguments[0] === "onwheel" ||
arguments[0] === "DOMMouseScroll"
) {
console.debug("Blocked window.mousewheel event.");
} else {
add.apply(this, arguments);
}
};
};
fuck();
// document.addEventListener("DOMContentLoaded", fuck);
// document.addEventListener("readystatechange", fuck);
// add("load", fuck);
})();
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment