Remove Eurogamer Ads

Remove the annoying ads at Eurogamer.net that are loaded via javascript hackery if it detects an adblocker is installed!

You will need to install an extension such as Tampermonkey, Greasemonkey or Violentmonkey to install this script.

You will need to install an extension such as Tampermonkey to install this script.

You will need to install an extension such as Tampermonkey or Violentmonkey to install this script.

You will need to install an extension such as Tampermonkey or Userscripts to install this script.

You will need to install an extension such as Tampermonkey to install this script.

You will need to install a user script manager extension to install this script.

(I already have a user script manager, let me install it!)

You will need to install an extension such as Stylus to install this style.

You will need to install an extension such as Stylus to install this style.

You will need to install an extension such as Stylus to install this style.

You will need to install a user style manager extension to install this style.

You will need to install a user style manager extension to install this style.

You will need to install a user style manager extension to install this style.

(I already have a user style manager, let me install it!)

// ==UserScript==
// @name         Remove Eurogamer Ads
// @namespace    http://tampermonkey.net/
// @version      0.1
// @description  Remove the annoying ads at Eurogamer.net that are loaded via javascript hackery if it detects an adblocker is installed!
// @author       Bubbafatass
// @match        http://www.eurogamer.net/*
// @grant        none
// @run-at       document-begin
// ==/UserScript==

(function() {
    var scriptnodes = document.getElementsByTagName("script");
    for( var i = 0; i < scriptnodes.length; ++i )
    {
        if( scriptnodes[i].innerHTML.indexOf("advertContainer") > -1)
        {
            //console.log("Found script node " + scriptnodes[i]);
            scriptnodes[i].parentNode.removeChild(scriptnodes[i]);
        }
    }
    var advcont = document.getElementsByClassName("advertContainer");
    while( advcont !== null && advcont.length > 0 )
    {
        //console.log("Found advert container with length " + advcont.length);
        for( i = advcont.length - 1; i >= 0; --i )
        {
            //console.log(advcont[i]);
            advcont[i].parentNode.removeChild(advcont[i]);
        }
        advcont = document.getElementsByClassName("advertContainer");
    }
    advcont = document.getElementsByClassName("advertContainer");
    //console.log("Found advert container with length " + advcont.length);
    
    var notifbar = document.getElementsByClassName("notif-bar");
    while( notifbar !== null && notifbar.length > 0 )
    {
        //console.log("Found notifbar with length " + notifbar.length);
        for( i = notifbar.length - 1; i >= 0; --i )
        {
            //console.log(notifbar[i]);
            notifbar[i].parentNode.removeChild(notifbar[i]);
        }
        notifbar = document.getElementsByClassName("notif-bar");
    }
    advcont = document.getElementsByClassName("notif-bar");
    //console.log("Found notifbar with length " + advcont.length);
    
    var div = document.getElementById("page-wrapper");
    if( div )
    {
        //console.log("Found " + div + " divs");
        div.removeAttribute("style");
        //console.log("Div style: " + div.style);
    }
    else
    {
       // console.log("Failed to find div");
    }
    // Your code here...
})();