P
P
President422015-03-19 21:13:05
css
President42, 2015-03-19 21:13:05

Userscript to disable player blocking on filmsonline.com.ua?

On filmsonline.com.ua , when Adblock is enabled, a warning blocking the player pops up on top of the player: "You are using our player with an ad blocker enabled!
We ask you to put our player in the blocker exception, otherwise we will not be able to further support it"
Of course, you can just get into the source code of the page and remove the block with a warning, but I would like to format it in the form of UserCSS / UserJS.
First I tried adding UserCSS to the page with Stylish - no effect. I thought that perhaps the styles for this block are generated by scripts after the page is loaded, so Stylish does not work. I wrote this UserJS using CustomJS:

document.body.addEventListener("click", function() {
    sheet = (function() {
        	var style = document.createElement("style");
    
    	    style.appendChild(document.createTextNode(""));
    
        	document.head.appendChild(style);
    
        	return style.sheet;
    })();

    sheet.insertRule("a-overlay, a-head, a-body, a-container, a-bounceInDown { display: none !important; }", 0);
    console.log("Success!");
});

(binding to a click anywhere on the page -- to make sure my script runs after the script showing the alert)
But nothing works. That is, the notification "Sucsess" appears in the console, and if you write in the rule inserted by the script body {display: none}, then on click the page is cleared. Why is it not possible to remove ads in this way?
PS For some reason, these blocks are not searched for document.querySelectorAll('.a-overlay')and document.getElementsByClassName('a-overlay'). At the same time, there is no Cyrillic alphabet in the class names, I checked, everything is in Latin.

Answer the question

In order to leave comments, you need to log in

1 answer(s)
A
asdz, 2015-03-20
@President42

Because you are doing document.getElementsByClassName('a-overlay') on the page, and this element is in a frame. The script should look like this:

// ==UserScript==
//@include http://*.moviki.ru/*
// ==/UserScript==
var elem = document.getElementsByClassName('a-overlay')[0];
  elem.parentNode.removeChild(elem);

the truth is still a 10 second empty window will appear.

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question