Last active
December 25, 2016 22:12
-
-
Save maziara/e15091e275e9f018aa71a5fcd5c5389f to your computer and use it in GitHub Desktop.
A TamperMonkey script for disabling the click popups that advertisers use on the whole document.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// ==UserScript== | |
// @name Disable DocumentClick | |
// @namespace https://github.com/maziara/DisableDocumentClick | |
// @updateURL https://raw.githubusercontent.com/maziara/DisableDocumentClick/master/DisableDocumentClick.js | |
// @version 0.1 | |
// @description Disabling the click popups that advertisers use on the whole document. | |
// @author Maziara | |
// @include * | |
// @grant none | |
// ==/UserScript== | |
(function() { | |
var counter = 0; | |
var i = setInterval(function(){ | |
// do your thing | |
//console.log(document.onclick); | |
if (typeof(document.onclick) == "function"){ | |
disableDocumentClick(); | |
} | |
if (typeof(document.mousedown) == "function"){ | |
disableDocumentMouseDown(); | |
} | |
counter++; | |
if(counter === 30) { | |
clearInterval(i); | |
} | |
}, 200); | |
function disableDocumentClick(){ | |
console.log("***** document.click event detected. Disabling..."); | |
document.onclick = undefined; | |
} | |
function disableDocumentMouseDown(){ | |
console.log("***** document.click event detected. Disabling..."); | |
document.mousedown = undefined; | |
} | |
})(); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment