is there more detailed filter writing documentation?

Posting here is no longer possible, please use the forum of a filter list project, such as EasyList
Locked
Zorak

is there more detailed filter writing documentation?

Post by Zorak »

Can someone point me at a more complete syntax for filter writing documentation, specifically for element hiding? "Writing Adblock Plus filters" is very terse and only provides brief examples.

I am trying to block this div:

<div style="float: left; text-align: center; background-color: #fff; border: 1px solid #ccc; width: 364px;">

I could use this filter:

#div(style*=width:364px)

but then I block all 364 pixel wide divs.

Based on the documentation it seems like this ought to work too:

#div(style*=width:364px)(style*=text-align: center)

but it doesn't. I thought you could have multiple criteria and they would be ANDed together?

This doesn't work either:

#div(style*=background-color: #fff)

maybe because of the # before fff? Is there a way to escape the #?
Wladimir Palant

Post by Wladimir Palant »

Element Hiding Helper extension should help - it makes writing element hiding filters much easier. See http://adblockplus.org/en/elemhidehelper#using

Your filters don't work because the style attribute is "special" - it is rewritten when the browser displays the page. So what you should hide is:

Code: Select all

<div style="border: 1px solid rgb(204, 204, 204); float: left; text-align: center; background-color: rgb(255, 255, 255); width: 364px;">
That's also something Element Hiding Helper solves - it works on the current state of the web page rather than the source code.
Zorak

Post by Zorak »

Hrm. I'm willing to believe that the underlying representation of the web page is as you say it is, with the rewritten style attribute and your code sample, but I'm still not sure how to translate that into an actual rule. Any attempts to put that entire style rule (with semicolons and parentheses etc.) cause the "Add filter" dialog to think I am entering an Advertisement filter, not an Element hiding rule. So clearly there is some syntactical foul-up going on.

I'd rather not use the extension -- I'm a do-it-yourselfer and even if the extension would help I'd still like to see a more detailed description of the rule syntax :-)
Zorak

Post by Zorak »

OK, despite my protestations, I went ahead and added the Helper, and am now happily blocking the div in question.

I'd still like to see more detailed docs though :-)

Thanks for your assistance!
User avatar
cuzz
Posts: 30
Joined: Thu Oct 11, 2007 3:59 am
Location: redwood deck
Contact:

Post by cuzz »

I'd like to see a community wiki.. there are so many talented people here with a passion!
Locked