Here is the full Greasemonkey script to remove a model screen/page that pops-up or blocks the actual web content when the adblocker is enabled in firefox. But its not removing the model screen.
/**
// ==UserScript==
// @name test
// @namespace test
// @include *
// @version 1
// @grant none
// ==/UserScript==
if (document.getElementsByClassName('tmask')[0]) {
document.getElementsByClassName('tmask')[0].style.display = 'none';
document.getElementsByClassName('tbox')[0].style.display = 'none';
}
**/
However when the modal page pop-up and if I open the "Web Developer > Web Console" and execute these lines
if (document.getElementsByClassName('tmask')[0]) {
document.getElementsByClassName('tmask')[0].style.display = 'none';
document.getElementsByClassName('tbox')[0].style.display = 'none';
}
It works i.e it removes the modal webpage and lets me read the web contents.
Any help is appreciated. Let me know if more information is needed.
var interval;
function go()
{
if (document.getElementsByClassName('tmask')[0]) {
document.getElementsByClassName('tmask')[0].style.display = 'none';
document.getElementsByClassName('tbox')[0].style.display = 'none';
clearInterval(interval);
}
}
window.addEventListener( 'load', function( event )
{
if( window.top == window.self ) //don't run in frames
{
interval = setInterval( go, 500 );
}
}, false );
My guess is you're not waiting for the page to load, thus your script runs before 'tmask' actually exists.