GISTS/web/userscripts/stp-middle-click-hyjacking.user.js

20 lignes
Pas d'EOL
915 o
JavaScript

// ==UserScript==
// @name Stop Middle Click Hijacking
// @description Prevent sites from hijacking the middle mouse button for their own purposes
// @icon http://www.rjlsoftware.com/software/entertainment/finger/icons/finger.gif
// @version 0.2a
// @license GNU General Public License v3
// @copyright 2014, Nickel
// @grant none
// @include *
// @namespace https://greasyfork.org/users/10797
// @downloadURL https://git.dess.ga/Albirew/GISTS/raw/branch/main/web/userscripts/stp-middle-click-hyjacking.user.js
// @updateURL https://git.dess.ga/Albirew/GISTS/raw/branch/main/web/userscripts/stp-middle-click-hyjacking.user.js
// ==/UserScript==
(function(){
//Adapted from Chrome extension (written by petergrabs@yahoo.com)
//TODO: would event.preventDefault() also work??
document.addEventListener("click", function(e){ e.button===1 && e.stopPropagation(); }, true);
})();