Created
May 14, 2019 09:40
-
-
Save alekc/04e8c8883af1cccc13dcf3935ce80097 to your computer and use it in GitHub Desktop.
tampermonkey remove click under js.
This file contains 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
Object.defineProperty(navigator, "userAgent", {value: 'fake browser'}); | |
// ==UserScript== | |
// @name prevent pop-ad | |
// @include http://animeflv.net/* | |
// @run-at document-start | |
// @grant none | |
// ==/UserScript== | |
(function() { | |
document.addEventListener('DOMContentLoaded', function() { | |
jQuery._data(document, 'events').mouseup = null; | |
window.oncontextmenu = null; | |
var lastCleanup = Date.now(); | |
var timeoutCleanup; | |
new MutationObserver(function cleanUp(mutations) { | |
if (Date.now() - lastCleanup < 100) | |
return setTimeout(cleanUp, 111); | |
lastCleanup = Date.now(); | |
if (timeoutCleanup) | |
clearTimeout(timeoutCleanup); | |
[].forEach.call(document.querySelectorAll('div[style*="z-index"]'), function(e) { | |
if (e.style.zIndex > 10000000) | |
e.style.cssText = 'width:0; height:0'; | |
}); | |
}).observe(document, {subtree:true, childList:true}); | |
}); | |
var __addEventListener = window.addEventListener; | |
window.addEventListener = document.addEventListener = function(type, fn, capture) { | |
console.log(this, type, fn); // debug logging | |
if (/^(ceop|click|mousedown|mouseup|mousemove|contextmenu)$/.test(type)) { | |
console.log('Prevented', type, 'registration on', this, fn); | |
} else { | |
__addEventListener.call(this, type, fn, capture); | |
} | |
}; | |
})(); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment