Stop Middle Click Hijacking

Prevent sites from hijacking the middle mouse button for their own purposes

  1. // ==UserScript==
  2. // @name Stop Middle Click Hijacking
  3. // @description Prevent sites from hijacking the middle mouse button for their own purposes
  4. // @version 0.1
  5. // @license GNU General Public License v3
  6. // @copyright 2014, Nickel
  7. // @grant none
  8. // @include *://www.youtube.com/*
  9. // @namespace https://greasyfork.org/users/10797
  10. // ==/UserScript==
  11.  
  12. (function(){
  13. //Adapted from Chrome extension (written by petergrabs@yahoo.com)
  14. //TODO: would event.preventDefault() also work??
  15.  
  16. document.addEventListener("click", function(e){ e.button===1 && e.stopPropagation(); }, true);
  17. })();