Suggestion for next Adblock release

Everything about using Adblock Plus on Mozilla Firefox, Thunderbird and SeaMonkey
Post Reply
Toad King

Suggestion for next Adblock release

Post by Toad King »

I've noticed that for the DIV element blocking only works once the page finished loading. On sites with a lot of images and other media or slow bandwidth, the delay is very noticable. I looked in the extension code and found the problem in the component.js file on line 80:

Code: Select all

wnd.addEventListener( "load", this.onLoad, false ); // initiate DIV checking
You should change this from a "load" event to a "DOMContentLoaded" event. The "DOMContentLoaded" event fires after all of the markup of the page is loaded, not after all of the media on the page as well.
User avatar
mcm
Posts: 359
Joined: Sat Jun 10, 2006 2:36 am

Post by mcm »

Thanks for the suggestion. BTW where did you find out about that event? I don't see it here:
http://www.xulplanet.com/references/ele ... dlers.html
IceDogg
Posts: 909
Joined: Fri Jun 09, 2006 11:22 pm

Post by IceDogg »

So, this works? Because I tried it out and it doesn't work well on Digg.. for that one at the top. It still removes it after the whole page loads.
Toad King

Post by Toad King »

Forgot where I found it, it was in some person's blog. Apparently, it's a Gecko Engine-only event that was added to find a way around the "load" event only firing after EVERYTHING on the page loads.
Mugros

Post by Mugros »

I changed it and it works great. I always didn't like all DIVs were removed after everything else has loaded. This makes the whole page jump at the end.
And now the DIVs also appear in the blockable list sooner. Before i also had to wait until everything was loaded or the DIVs where missing.

Now i have to look where i can install this event in RIP :) It behaves the same. UPDATE: RIP already uses DOMContentLoaded and removes while media is loaded :)

Another suggestion:
I just wish that i could do DIV blocking by class and id. AB+ drops the class if an id is present. This is bad.
example:
<div id="topContent" class="typical_ad_class">

a generic filter like #DIV(typical_ad_class) doesn't filter this DIV.
It appears in the list as ...#DIV(topContent) and can only be filtered by the ID which doesn't make sense for adblocking.
IceDogg
Posts: 909
Joined: Fri Jun 09, 2006 11:22 pm

Post by IceDogg »

Can you give an example of a site that this works on? Please. I'm sure you right and all, I just want to see and the sites I visit must load very few pictures/media. Thanks. I'd just like to see how this works. I'm trying to learn things about this stuff, but it's slow going.
Mugros

Post by Mugros »

IceDogg wrote:Can you give an example of a site that this works on? Please. I'm sure you right and all, I just want to see and the sites I visit must load very few pictures/media. Thanks. I'd just like to see how this works. I'm trying to learn things about this stuff, but it's slow going.
You can take any popular website that has div. For testing you also remove non-ad divs.
http://www.heise.de/
The div left of the logo is filled with an ad.
With the patched AB+ the room collapses as soon as the html is loaded. The tab in forefox may still be loading the images.
Without this patch, the whole page with images and embedded objects will be loaded and when all is loaded the div collapses.
You probably won't notice this on light pages, if you have the images in the cache or if you have a fast connection.
I have dial-up and cann see the difference immediatly.

You could also install the RIP-extension. It also removes divs while the content is loaded. Block one div with the unpatched AB+ and another on the page with RIP. The second will collapse soon, the first at the end of the loading process.
IceDogg
Posts: 909
Joined: Fri Jun 09, 2006 11:22 pm

Post by IceDogg »

Ok thanks Mugros, It works like you all say on that site. I guess sites like Digg.com, at the top, just have more HTML code or something. Because it works the same with or without that change. Which is to say the site loads and you can see the div then it collapses after the site is done.
Mugros

Post by Mugros »

of course, because the digg pages almost have no images but i can still see the effect if there are many icons
IceDogg
Posts: 909
Joined: Fri Jun 09, 2006 11:22 pm

Post by IceDogg »

Yep. Thanks for the link so I could see it work.
Post Reply