Add stylesheet class-based blocking; add per-domain rule specificity


Another more or less rip-off of Firefox's adblock. Some ads are in a <div> with a telling classname, but only on a given domain (we don't want to block all classes called "leftNav"). So it would be pretty trivial to change the rules to allow something like:
<rule action="block" target="class">leftNav</rule>
but to do so, we would want to be able to narrow by domain. So this would add two new things to <rule> elements:
1) "domain" attribute: this could be any qualified part of the domain (e.g. .com, .doubleclick.com, ads.doubleclick.com, etc). This would default to "*".
2) "target" attribute: this would default to "source" (which means script/link/image/frame sources, and OBJECT movie PARAMs (ugh), but could be set to be "class" instead (and maybe other things in the future.
If I'm going to do this, I might want to look into what the performance cost is on the current regex stuff. I am curious if I could speed things up a lot by replacing .NET's regex engine with my own handwritten globbing engine. We really only need globbing anyway, and not full regular expressions.
Closed Apr 17, 2009 at 9:49 PM by danmargo


danmargo wrote Apr 16, 2009 at 6:35 AM

Rules now can be like this:

<rule site="http://www.nytimes.com/*" applyto="div">singleAd</rule>

It's code complete and committed in the source tree. Needs more testing before a new release, I think.

wrote Apr 16, 2009 at 6:35 AM

wrote Apr 17, 2009 at 9:49 PM

wrote Feb 22, 2013 at 1:34 AM

wrote May 16, 2013 at 12:53 PM