Skip to content

Instantly share code, notes, and snippets.

@airtonix
Created September 26, 2023 02:19
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save airtonix/e5485d588fd7b9cde286ebf38bb87906 to your computer and use it in GitHub Desktop.
Save airtonix/e5485d588fd7b9cde286ebf38bb87906 to your computer and use it in GitHub Desktop.
Disable autoscroll UserScript
// ==UserScript==
// @name Disable Auto Scroll
// @namespace http://tampermonkey.net/
// @version 0.1
// @description Disable mouse middle button completely. As a result it does not activate browser auto scroll. Open hyperlink in a new tab with middle button click still works.
// @match *://*/*
// @grant none
// ==/UserScript==
(function() {
'use strict';
document.addEventListener("mousedown", function(mouseEvent) {
if (mouseEvent.button != 1) {
return;
}
mouseEvent.preventDefault();
mouseEvent.stopPropagation();
});
})();
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment