[Done] Site-specific filters
[Done] Site-specific filters
This feature is requested from time to time: making sure a filter applies only on some sites. So here a proposal on how this could be implemented:
foo.com/ad$domain=foo.com|bar.com|~baz.bar.com
This will block anything matching "foo.com/ad" on www.foo.com or www.bar.com but not on baz.bar.com and not on www.baz.com.
Frames would be handled the same as with $third-party (or element hiding rules): if the site contains frames, the relevant domain is the domain of the frame the element is in, not the domain of the top page. That's less obvious to the user, to compensate the composer should have a "Restrict to domain" checkbox under "First/third-party only", if checked you can edit the domain in a text field (pre-filled with the current domain minus "www.").
I would like to follow the syntax of element hiding rules but comma is already reserved as an option separator which is too bad.
Opinions? Suggestions?
foo.com/ad$domain=foo.com|bar.com|~baz.bar.com
This will block anything matching "foo.com/ad" on www.foo.com or www.bar.com but not on baz.bar.com and not on www.baz.com.
Frames would be handled the same as with $third-party (or element hiding rules): if the site contains frames, the relevant domain is the domain of the frame the element is in, not the domain of the top page. That's less obvious to the user, to compensate the composer should have a "Restrict to domain" checkbox under "First/third-party only", if checked you can edit the domain in a text field (pre-filled with the current domain minus "www.").
I would like to follow the syntax of element hiding rules but comma is already reserved as an option separator which is too bad.
Opinions? Suggestions?
Last edited by Wladimir Palant on Sun Dec 21, 2008 6:31 am, edited 1 time in total.
Fanboy, that would also require a far larger effort (not to mention that I don't have any good ideas on how this would work). What I propose here can be even implemented in Adblock Plus 1.0.1 - it is fairly straightforward now that we have $third-party. Really, "but I would rather have a pony" isn't helpful.
I think this would be great, especially for whitelists.
But maybe some spaces could improve readability?
(Spaces have been forbidden since the old adblock, but with the filters stored in patterns.ini I don't see a problem in breaking this convention...)
But maybe some spaces could improve readability?
Code: Select all
example.org/someads/* on *.example.com or *.example.net
@@example.org/someads/*$object_subrequest on foo.example.net
Spaces are not a problem (comments have spaces, as do element hiding rules in the raw CSS part). Only reason they are still being removed - it helps recognizing identical filters as actually identical.
But I wouldn't want to introduce an entirely new syntax (and especially a language-dependent one). We already have options to extend the syntax, I would rather use them.
But I wouldn't want to introduce an entirely new syntax (and especially a language-dependent one). We already have options to extend the syntax, I would rather use them.
- Adblock Plus Fan
- Posts: 1255
- Joined: Sat Feb 24, 2007 11:08 am
Re: Opinions requested: Site-specific filters
This is an excellent idea Wladimir. This kind of pseudo whitelisting is even better normal whitelisting.Wladimir Palant wrote:|~baz.bar.com
With this kind of capability, small sites will no longer be able to take otherwise good filters as hostage. And we won't have to give them privileges of having real whitelists.
ABP video download trick / Want to help? Test new builds/report bugs you find.
Actually, a whitelisting would not even be necessary as you could just add "not" domains to the offending false-positive rule.
Wouldn't this work as a general blocking rule but with its own built-in domain exceptions, Wladimir?
Code: Select all
google-analytics$domain=~a.com|~b.com|~c.com
Last edited by rick752 on Mon Dec 15, 2008 5:00 pm, edited 1 time in total.
- Adblock Plus Fan
- Posts: 1255
- Joined: Sat Feb 24, 2007 11:08 am
Indeed, especially for users who have the filterDr. Evil wrote:I think this would be great, especially for whitelists.
*$third-party,script
When adding whitelists for broken sites, this restriction capability makes ABP clearly the best tool to block 3rd party scripts now.
Yep that's what I meant Rick, you can pretty much clear all of your real whitelists from Easylist now and leave them entirely to users. No more complaints from themrick752 wrote:Actually, a whitelisting would not even be necessary
ABP video download trick / Want to help? Test new builds/report bugs you find.
I think it's probably necessary at this point to devise a proper generalization of the filter syntax, rather than make a series of ad-hoc changes that could become cumbersome later on. I agree DE's suggestion is too language-specific, but it still seems rather awkward to cram all this into a $tag.Wladimir Palant wrote:Spaces are not a problem (comments have spaces, as do element hiding rules in the raw CSS part). Only reason they are still being removed - it helps recognizing identical filters as actually identical.
But I wouldn't want to introduce an entirely new syntax (and especially a language-dependent one). We already have options to extend the syntax, I would rather use them.
Even if it can't all get implemented at one go, what is needed is a syntax that can accommodate
- match-url vs match-domain perhaps something like {foo.bar} vs foo.bar
- page-restricted application as above eg
Code: Select all
{foo.org} || /bar.asp$/ >> /quux.js$/
- future content-filtering (and modifying?) capability. This is a bit trickier given the potential for truly mammoth filters. Long-string arguments should be well-distinguished and probably kept to the end for readability's sake.
- Adblock Plus Fan
- Posts: 1255
- Joined: Sat Feb 24, 2007 11:08 am
You're thinking very far ahead there with regexp usage for url restriction, it's uncertain if we will even have this url restriction feature ever. But in the event that we get this feature, I don't see what's so bad about simply extending the current syntax.Dipole Moment wrote:match-urlCode: Select all
{foo.org} || /bar.asp$/ >> /quux.js$/
Code: Select all
/quux.js$/$domain=foo.org,url=/bar.asp$/
For now, domain restriction looks like it's enough to fit our needs.
Is it realistic that we get a foo.com/ad$url= capability in the future?Wladimir Palant wrote:I would like to follow the syntax of element hiding rules but comma is already reserved as an option separator which is too bad.
If it is, then it may be better to reserve the pipe symbol for marking the end/beginning of the url restriction.
I don't know, maybe.
ABP video download trick / Want to help? Test new builds/report bugs you find.