Дискусии » Заявки за създаване
Disable Clicking anywhere on the page opens a new tab with ads
Here's a script for the first site:
v2
// ==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);
}
};
})();
Thanks a lot.
Hmm I noticed the scripts block pressing on the play button of the videos so there is no way to load them.
Can't reproduce. The video play button works for me (Chrome+Tampermonkey).
I downloaded chrome just to test this and I got the same results the only thing is that if I right clicked then I was able to do the rest till the event triggered again then I would have to right click again to enable the left click. (Chrome 52.0.2743.82 x86 stable).
If you were able to press the play button might have been cause you got lucky and the event didn't trigger on page load or something. Try going to the homepage and then open an other link to an episode.
Indeed. Dunno why it worked the first time, probably some cookies were set. This time I think I've nailed it, see the v2 code above.
Works great for the most part. On options 5, 6 and 7 of the example page below the pop up opens almost every time when you click anywhere on the video space (seems to be something related with the type of player they use). Thanks a lot again for the new version.
Ex page http://animeflv.net/ver/nanatsu-no-taizai-17.html
Yeah, the iframes contain blocking divs inside.
v3:
// ==UserScript==
// @name prevent pop-ad
// @include http://animeflv.net/*
// @include http://embed.nowvideo.sx/embed*
// @include http://embed.novamov.com/embed*
// @include http://www.auroravid.to/embed*
// @include http://embed.videoweed.es/embed*
// @include http://www.bitvid.sx/embed*
// @include http://mz.yourupload.com/rotate/yourupload/*
// @include http://www.mp4upload.com/embed*
// @run-at document-start
// @grant none
// ==/UserScript==
(function() {
document.addEventListener('DOMContentLoaded', function() {
try { jQuery._data(document, 'events').mouseup = null; } catch(e) {}
window.oncontextmenu = null;
document.head.insertAdjacentHTML('beforeend',
'<style>div[style*="z-index"], div[style*="fixed"] { pointer-events:none!important }</style>');
});
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);
}
};
})();
Seems to work great now. Thank you so much.
BTW do you know if it's possible to change the user agent and vendor version with userscript?
Is it possible to use this with https://gomovies.to/
The navigator.userAgent property is read-only based on the test I just did.
See gnblizz's comment below:
Object.defineProperty(navigator, "userAgent", {value: 'fake browser'});
Disable Clicking anywhere on the page opens a new tab with ads
On some pages whenever you click on anything it triggers the opening of a new tab with publicity. The publicity is blocked by an ad block addon and the new tab briefly displays as data: some random numbers and letters and closes after a second or 2 and it's very bothersome specially on some sites on which this happens very frequently. Is there a way to block it from ever opening?
I've tried many adblock filters and asked help from the ABP community and Ublock community but they couldn't do anything about it.
Tried messing with cookies to see if the timer was recorded as a cookie one could edit but that wasn't the case.
Some examples of those kinds of pages are: http://animeflv.net/ , http://gorillavid.in/s6nrdihcyboz
This is the script the animeflv page uses (the most bothersome one) : http://pastebin.com/WndgXM0u