NOTICE: By continued use of this site you understand and agree to the binding Terms of Service and Privacy Policy.
// ==UserScript== // @name Disable private events (ultimate right-click enabler) // @namespace http://tampermonkey.net/ // @version 0.2 // @description This disables events which most normal websites shouldn't need (mouse events, key up and down, etc). These events leak private information and overrides are annoying (websites prevents right-clicks). // @author K3A // @include * // @grant none // @run-at document-start // @downloadURL https://raw.githubusercontent.com/k3a/userscripts.js/master/block-priv-events.user.js // @license GNU GPL v3 // ==/UserScript== function pe_before() { // Inspired by https://gist.github.com/alessioalex/fc536ef87713d0a9ed89 // get HTMLDivElement, HTMLImageElement, HTMLUListElement, HTMLElement, HTMLDocument, ... var _interfaces = Object.getOwnPropertyNames(window).filter(function(i) { return /^HTML/.test(i); }).map(function(i) { return window[i]; }); var eventsToFilter = {}; eventsToFilter.mouseenter = true; eventsToFilter.mouseover = true; eventsToFilter.mousemove = true; eventsToFilter.mousedown = true; eventsToFilter.mouseup = true; eventsToFilter.contextmenu = true; eventsToFilter.wheel = true; eventsToFilter.mouseleave = true; eventsToFilter.mouseout = true; eventsToFilter.select = true; eventsToFilter.touchstart = true; eventsToFilter.touchmove = true; eventsToFilter.touchleave = true; eventsToFilter.touchenter = true; eventsToFilter.touchend = true; eventsToFilter.touchcancel = true; eventsToFilter.keyup = true; eventsToFilter.keypress = true; eventsToFilter.keydown = true; eventsToFilter.focus = true; eventsToFilter.blur = true; eventsToFilter.cut = true; eventsToFilter.copy = true; eventsToFilter.paste = true; for (var i = 0; i < _interfaces.length; i++) { (function(original) { _interfaces[i].prototype.addEventListener = function(type, listener, useCapture) { if (eventsToFilter[type] === true) { console.log('BLOCKED addEventListener ' + type, listener, useCapture); } else { return original.apply(this, arguments); } }; })(_interfaces[i].prototype.addEventListener); } } function pe_after() { document.onmouseup = null; document.onmousedown = null; document.oncontextmenu = null; var els = document.getElementsByTagName('*'); for (var i = 0; i < els.length; i++) { var el = els[i]; el.onmouseup = null; el.onmousedown = null; el.oncontextmenu = null; } } (function() { document.addEventListener ("DOMContentLoaded", pe_after); pe_before(); })();