Oversized Flashkit Advert

22nd July 2005

Ok, I usually don’t have a problem with adverts on websites, but ever since Flashkit upgraded their forums to vbulletin 3 the advert that appears alongside the header is getting ridiculous. So I decided to “Take back the web” and wrote a script for Opera’s User JavaScript that tries to remove it.

After prompting in this thread I converted the script into Greasemonkey syntax to allow it to run using both User JavaScript in Opera and the Greasemonkey extension for Firefox.

The problem with the advert can be seen in the screenshot — users browsing at 1024 by 768 can’t see any content without having to scroll.

The HUGE advert fills most of the height of the screen

The script attempts to leave the other banner adverts intact whilst removing the advert that appears alongside the banner. It does this by searching for links containing URLs that look like adverts then climbing the DOM tree to find the table element that contains the link. If this table is over 200 pixels high it gets removed and the script exits.

This seems to get the advert most of the time — though would be likely to break should something change in how flashkit displays the adverts. If you’d like to use if feel free to download it. Please let me know how you get on I’ve never written anything for Greasemonkey before ;)

It was also mentioned that it would be good if it could remove all the banner adverts. I guess this could be done by editing the following section of the script,

if (n.nodeName.toLowerCase() != 'html') {
    var h = parseInt(document.defaultView.getComputedStyle(n,
         null).getPropertyValue('height')); 
    if (h > 200) {
        n.style.display = 'none';
        break;
    }
}

To remove the check on the table height and to continue checking all the other links after the advert has been removed. These changes would leave just,

if (n.nodeName.toLowerCase() != 'html') {
    n.style.display = 'none';
}

Permalink. Posted on 22nd July 2005 in Browsers, JavaScript.

Comments

There are currently no comments for this item.

Sorry, comments for this item are currently closed.

Of Interest

Hangouts

Listening