whitelisting/negating DIV elements

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

whitelisting/negating DIV elements

Post by wrbl »

Hi, I'm using Adblock Plus 0.7.1.1.
There is a site containing a few DIVs, some of which are ads I'd like to hide. The problem is that all ads lack an id attribute while all normal elements have an id; however, neither Adblock nor CSS selectors seem to support negative matches.
So I thought I could work around this problem by using the following two filters:

Code: Select all

example.com#div(class=foo)
@@example.com#div(class=foo)(id^=)
i.e. hide all DIVs with a certain class but whitelist those that have an id.
This doesn't work. Is it possible to combine whitelisting and element hiding at all? Is there another way to do this (besides writing a greasemonkey script)?
User avatar
Peng
Posts: 518
Joined: Fri Jun 09, 2006 8:14 pm
Location: Central Florida
Contact:

Post by Peng »

Yeah, whitelisting doesn't work for element hiding filters. I dunno if there's another way to do this, unfortunately.
Matt Nordhoff
ziutek

Post by ziutek »

You can use the CSS3 :not() selector. Something like this (untested!):

Code: Select all

example.com##div[class="foo"]:not([id])
Wladimir Palant

Post by Wladimir Palant »

Right, ziutek's suggestion should work.
wrbl

Post by wrbl »

Thanks, it worked!
Could you add a link to the CSS3 selector spec to the adblock documentation? I think this would help people with similar problems.
User avatar
Stupid Head
Posts: 214
Joined: Sat Aug 26, 2006 8:11 pm
Location: USA

Post by Stupid Head »

wrbl wrote:Could you add a link to the CSS3 selector spec to the adblock documentation?
There already is: http://adblockplus.org/en/filters#elemhide_css
Wladimir Palant

Post by Wladimir Palant »

No, I am linking to the CSS2 implementation because it is fully implemented in Gecko. A link to CSS3 would cause too much confusion.
sheepy
Posts: 147
Joined: Sat Jun 17, 2006 8:44 pm

Post by sheepy »

Be warned that CSS3 spec is not complete, and many selectors are not implemented.

http://www.w3.org/TR/css3-selectors/
Locked