[Done] More flexible anchors

Various discussions related to Adblock Plus development

Postby Dr. Evil » Wed May 06, 2009 10:04 am

So would this work?
Code: Select all
*||ad_type=pop||

! replaces:
*?ad_type=pop&*
*&ad_type=pop&*
*&ad_type=pop|


I think this would be useful anywhere, not only at the end of a filter... (Though the double pipe might not be the best choice for this if there are still enough letters available which have to be encoded in an uri.)
Dr. Evil
 
Posts: 194
Joined: Fri Sep 08, 2006 3:51 pm

Postby Wladimir Palant » Wed May 06, 2009 10:43 am

Dr. Evil wrote:So would this work?
Code: Select all
*||ad_type=pop||

! replaces:
*?ad_type=pop&*
*&ad_type=pop&*
*&ad_type=pop|


No, with the current definition || would be accepted at the end of the expression only. However, I do agree that this one probably cannot be called an anchor at all, it is a placeholder for a separator character (like * is a placeholder for any characters). Looking at the US keyboard layout, there aren't that many options. So maybe "^adtype=pop^", "||example.com^" and "||example.com/foo^"?
Wladimir Palant
ABP Developer
 
Posts: 8395
Joined: Fri Jun 09, 2006 6:59 pm
Location: Cologne, Germany

Postby Fox » Wed May 06, 2009 4:45 pm

Wladimir Palant wrote:So maybe "^adtype=pop^", "||example.com^" and "||example.com/foo^"?

That sounds great.
Fox
 
Posts: 300
Joined: Sat Jun 10, 2006 3:05 pm
Location: Finland

Postby Ares2 » Wed May 06, 2009 5:14 pm

Wladimir Palant wrote:* Filter composer should be able to use flexible anchors (should that be the default for all suggestions?)

I don't think it should be default, many sites use a different subdomain for their ads and currently the third option (http://ads.example.com/*) is what you want to block then and not the whole site (||example.com/*).

Wladimir Palant wrote:"||example.com^"

That would be very nice for adservers. :)
Ares2
 
Posts: 1275
Joined: Fri Feb 15, 2008 1:47 pm

Postby Wladimir Palant » Wed May 06, 2009 5:43 pm

Ares2, the default suggestion would be "||ads.example.com/foo/" for "http://ads.example.com/foo/bar". I already thought about this and it should definitely keep the entire site name. Maybe one exception: for "http://www.example.com/foo/bar" it should drop "www." and suggest "||example.com/foo/".
Wladimir Palant
ABP Developer
 
Posts: 8395
Joined: Fri Jun 09, 2006 6:59 pm
Location: Cologne, Germany

Postby Adblock Plus Fan » Wed May 06, 2009 5:44 pm

Ares2 wrote:I don't think it should be default, many sites use a different subdomain for their ads and currently the third option (http://ads.example.com/*) is what you want to block then and not the whole site (||example.com/*).
In that situation I only see gain in ||ads.example.com/* becoming default.
Hopefully you agree? :P
Wladimir Palant wrote:* Filter composer should be able to use flexible anchors (should that be the default for all suggestions?)
There's one disadvantage I can think of if this is implemented by default, some filters might become too short to be optimized if you remove http:// with this flexible anchor.
Solution would perhaps be:
1) suggest flexible anchor by default
2) revert back from flexible anchor if 1) isn't optimized
3) suggest flexible anchor again if 2) isn't optimized
The filter composer would need to do a few extra calculations, but I think it would be worth it.
User avatar
Adblock Plus Fan
 
Posts: 1255
Joined: Sat Feb 24, 2007 12:08 pm

Postby Wladimir Palant » Wed May 06, 2009 6:00 pm

@Fan: I wouldn't worry too much about that - the case where the user gets a very short domain name *and* wants to block everything from that domain should be very rare. In all the other cases the filter still will be long enough. So I don't think this special case is worth considering.
Wladimir Palant
ABP Developer
 
Posts: 8395
Joined: Fri Jun 09, 2006 6:59 pm
Location: Cologne, Germany

Postby Ares2 » Wed May 06, 2009 6:13 pm

Wladimir Palant wrote:Ares2, the default suggestion would be "||ads.example.com/foo/" for "http://ads.example.com/foo/bar".

OK, I thought "use flexible anchors" means actually using it. :) This way it doesn't make any difference to the current suggestions anyway (except if you drop "www" of course), so go for it.
Ares2
 
Posts: 1275
Joined: Fri Feb 15, 2008 1:47 pm

Postby Adblock Plus Fan » Wed May 06, 2009 6:22 pm

Wladimir Palant wrote:the case where the user gets a very short domain name *and* wants to block everything from that domain should be very rare.
I guess you're right, this will only happen extremely rarely.

I imagine it's mostly realistic for situations where the filterlist is already using up a lot of shortcuts for a domain without actually having the whole domain blocked. For example the way easylist handles doubleclick:
Code: Select all
.doubleclick.net/*;cue=pre;
.doubleclick.net/adi/
.doubleclick.net/adj/
.doubleclick.net/adx/
.doubleclick.net/pfadx/*;ord=
.doubleclick.net/pfadx/*.mtvi/
.doubleclick.net/pfadx/*.mtvi/
.g.doubleclick.
/ad.doubleclick.net/ad/*
There could be a theoretical shortut shortage for the user in the long run as doubleclick expands, but it's fine if the chance remains extremely low.
User avatar
Adblock Plus Fan
 
Posts: 1255
Joined: Sat Feb 24, 2007 12:08 pm

Postby Fox » Wed May 06, 2009 6:30 pm

Ares2 wrote:
Wladimir Palant wrote:Ares2, the default suggestion would be "||ads.example.com/foo/" for "http://ads.example.com/foo/bar".

OK, I thought "use flexible anchors" means actually using it. :) This way it doesn't make any difference to the current suggestions anyway (except if you drop "www" of course), so go for it.

"||ads.example.com/foo/"

Blocks:
http://ads.example.com/foo/
https://ads.example.com/foo/
mms://ads.example.com/foo/
Fox
 
Posts: 300
Joined: Sat Jun 10, 2006 3:05 pm
Location: Finland

Postby Ares2 » Wed May 06, 2009 6:40 pm


Yeah, I know I should have said "almost", but these are very rare cases. :)


BTW, will ||example.com/ also block ht*p://foo.bar.example.com/1.gif (more than 1 subdomain)?
Ares2
 
Posts: 1275
Joined: Fri Feb 15, 2008 1:47 pm

Postby Adblock Plus Fan » Wed May 06, 2009 6:53 pm

Ares2 wrote:BTW, will ||example.com/ also block ht*p://foo.bar.example.com/1.gif (more than 1 subdomain)?
Yep, it's covered by (?:[^\/]+\.)?
User avatar
Adblock Plus Fan
 
Posts: 1255
Joined: Sat Feb 24, 2007 12:08 pm

Postby Wladimir Palant » Thu May 07, 2009 7:24 am

I changed the meaning of the first "Accept pattern only:" checkbox - it would switch on both regular anchors and flexible anchors (its label changes from "at the beginning of the address" to "at the beginning of the domain name" then). But I didn't manage to come up with a proper interaction between this checkbox and suggestions that are meant to be used with flexible anchors - if the user unchecks "at the beginning of the domain name" a filter like "example.com/foo/" becomes a pretty bad one. So I ended up simply adding a fourth suggestion that would block the entire domain, e.g. "example.com^". The other three suggestions remain unchanged.
Wladimir Palant
ABP Developer
 
Posts: 8395
Joined: Fri Jun 09, 2006 6:59 pm
Location: Cologne, Germany

Postby Wladimir Palant » Thu May 07, 2009 12:23 pm

Implemented separator placeholders: http://hg.mozdev.org/adblockplus/rev/16a506483471
Changed the filter added when you click "Disable on example.com" to "@@||example.com^$document": http://hg.mozdev.org/adblockplus/rev/82ecb07f16f0
Added "example.com^" as a suggestion in filter composer: http://hg.mozdev.org/adblockplus/rev/0a0dbe7677de and http://hg.mozdev.org/adblockplus/rev/d4b92461e3ac
Made sure minimal Adblock Plus version is set correctly when exporting filters: http://hg.mozdev.org/adblockplus/rev/1ce2815bbf89

Now it should really be done, development build coming in a few minutes.
Wladimir Palant
ABP Developer
 
Posts: 8395
Joined: Fri Jun 09, 2006 6:59 pm
Location: Cologne, Germany

Previous

Return to Adblock Plus development

Who is online

Users browsing this forum: No registered users and 4 guests