Left: | ||
Right: |
OLD | NEW |
---|---|
1 title=Writing Adblock Plus filters | 1 title=Writing Adblock Plus filters |
2 | 2 |
3 | 3 |
4 <p>{{s1 Current Adblock Plus versions allow you to "tweak" your filters in many different ways. This document explains the choices that you have and how they ca n be used.}}</p> | 4 <p>{{s1 Current Adblock Plus versions allow you to "tweak" your filters in many different ways. This document explains the choices that you have and how they ca n be used.}}</p> |
5 | 5 |
6 <p>{{s2 <em>Disclaimer</em>: All filter examples given here are really only ex amples and are not meant to be used.}}</p> | 6 <p>{{s2 <em>Disclaimer</em>: All filter examples given here are really only ex amples and are not meant to be used.}}</p> |
7 | 7 |
8 <h2 id="introduction">{{s3 Introduction to Adblock Plus filters}}</h2> | 8 <h2 id="introduction">{{s3 Introduction to Adblock Plus filters}}</h2> |
9 | 9 |
10 <p>{{s4 The options described in this section should be enough for users who h ave to create a filter occasionally.}}</p> | 10 <p>{{s4 The options described in this section should be enough for users who h ave to create a filter occasionally.}}</p> |
11 | 11 |
12 <h3 id="basic">{{s5 Basic filter rules}}</h3> | 12 <h3 id="basic">{{s5 Basic filter rules}}</h3> |
13 | 13 |
14 <p>{{s6 The most trivial filter you can define is of course the address of ban ner you want to block. However, often this address changes every time you open a page. For example it could be <code><fix>http://example.com/ads/banner123.gif</ fix></code> where 123 is a random number. Here blocking the complete address won 't help you, you need a more general filter — like <code><fix>http://example.com /ads/banner*.gif</fix></code>. Or maybe even <code><fix>http://example.com/ads/* </fix></code>.}}</p> | 14 <p>{{s6 The most trivial filter you can define is of course the address of ban ner you want to block. However, often this address changes every time you open a page. For example it could be <code><fix>http://example.com/ads/banner123.gif</ fix></code> where 123 is a random number. Here blocking the complete address won 't help you, you need a more general filter — like <code><fix>http://example.com /ads/banner*.gif</fix></code>. Or maybe even <code><fix>http://example.com/ads/* </fix></code>.}}</p> |
15 | 15 |
16 <p>{{s7 <em>Note</em>: Make sure that you are not replacing too much by wildca rds. The filter <code><fix>http://example.com/*</fix></code> will definitely blo ck all banners but it will also block everything else from example.com that you still might want to see.}}</p> | 16 <p>{{s7 <em>Note</em>: Make sure that you are not replacing too much by wildca rds. The filter <code><fix>http://example.com/*</fix></code> will definitely blo ck all banners but it will also block everything else from example.com that you still might want to see.}}</p> |
17 | 17 |
18 <h3 id="whitelist">{{s8 Defining exception rules}}</h3> | 18 <h3 id="whitelist">{{s8 Defining exception rules}}</h3> |
19 | 19 |
20 <p>{{s9 Sometimes you will notice that one of your filters that is usually wor king quite well blocks in some case blocks something that it shouldn't be blocki ng. You don't want to remove this filter but you still don't want it to match in this one case.}}</p> | 20 <p>{{s9 Once in a while you may notice that one of your filters, that normally works well, is blocking something that it shouldn't block. You don't want to re move this filter but you still don't want it to match in this one case.}}</p> |
juliandoucette
2017/02/21 15:24:08
This change doesn't match the change proposed in t
juliandoucette
2017/04/05 11:47:29
1. Please reply to comments inline instead of usin
| |
21 | 21 |
22 <p>{{s10 That's what exception rules are good for — they allow you to define c ases where filters shouldn't be applied. For example if you are unhappy with you r filter <code><fix>adv</fix></code> blocking <code><fix>http://example.com/advi ce.html</fix></code>, you can define an exception rule <code><fix>@@advice</fix> </code>. Exception rules are no different from filter rules, you can use wildcar ds or regular expressions. You only have to precede them by <code><fix>@@</fix>< /code> to indicate an exception rule.}}</p> | 22 <p>{{s10 That's what exception rules are good for — they allow you to define c ases where filters shouldn't be applied. For example if you are unhappy with you r filter <code><fix>adv</fix></code> blocking <code><fix>http://example.com/advi ce.html</fix></code>, you can define an exception rule <code><fix>@@advice</fix> </code>. Exception rules are no different from filter rules, you can use wildcar ds or regular expressions. You only have to precede them by <code><fix>@@</fix>< /code> to indicate an exception rule.}}</p> |
23 | 23 |
24 <p>{{s11 Exception rules can do more. If you specify <code><fix>$document</fix ></code> option you will get an exception for the entire page. For example, if y our exception rule is <code><fix>@@||example.com^$document</fix></code> and you open some page from example.com — Adblock Plus will be entirely disabled on this page and nothing will be blocked.}}</p> | 24 <p>{{s11 Exception rules can do more. If you specify <code><fix>$document</fix ></code> option you will get an exception for the entire page. For example, if y our exception rule is <code><fix>@@||example.com^$document</fix></code> and you open some page from example.com — Adblock Plus will be entirely disabled on this page and nothing will be blocked.}}</p> |
25 | 25 |
26 <h3 id="anchors">{{s12 Matching at beginning/end of an address}}</h3> | 26 <h3 id="anchors">{{s12 Matching at beginning/end of an address}}</h3> |
27 | 27 |
28 <p>{{s13 Usually Adblock Plus treats every filter as if it had a wildcard at i ts beginning and end, e.g. there is not difference between the filters <code><fi x>ad</fix></code> and <code><fix>*ad*</fix></code>. While this is usually unprob lematic, sometimes you wish that the filter you defined only matches at the begi nning or end of an address. For example you might want to block all Flash, but i f you add the filter <code><fix>swf</fix></code> the address <code><fix>http://e xample.com/swf/index.html</fix></code> will also be blocked.}}</p> | 28 <p>{{s13 Usually Adblock Plus treats every filter as if it had a wildcard at i ts beginning and end, e.g. there is not difference between the filters <code><fi x>ad</fix></code> and <code><fix>*ad*</fix></code>. While this is usually unprob lematic, sometimes you wish that the filter you defined only matches at the begi nning or end of an address. For example you might want to block all Flash, but i f you add the filter <code><fix>swf</fix></code> the address <code><fix>http://e xample.com/swf/index.html</fix></code> will also be blocked.}}</p> |
29 | 29 |
30 <p>{{s14 Solution to this problem: add a pipe symbol to the filter to show tha t there should be definitely the end of the address at this point. For example t he filter <code><fix>swf|</fix></code> will block <code><fix>http://example.com/ annoyingflash.swf</fix></code> but not <code><fix>http://example.com/swf/index.h tml</fix></code>. And the filter <code>|http://baddomain.example/</code> will bl ock <code>http://baddomain.example/banner.gif</code> but not <code>http://gooddo main.example/analyze?http://baddomain.example</code>.}}</p> | 30 <p>{{s14 Solution to this problem: add a pipe symbol to the filter to show tha t there should be definitely the end of the address at this point. For example t he filter <code><fix>swf|</fix></code> will block <code><fix>http://example.com/ annoyingflash.swf</fix></code> but not <code><fix>http://example.com/swf/index.h tml</fix></code>. And the filter <code>|http://baddomain.example/</code> will bl ock <code>http://baddomain.example/banner.gif</code> but not <code>http://gooddo main.example/analyze?http://baddomain.example</code>.}}</p> |
(...skipping 239 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
270 {{s110 The data used for creating the signature is a concatenated list of requ est variables (namely URI, host and user agent) separated by the <code><fix>NUL< /fix></code> character "\0". For example:}} | 270 {{s110 The data used for creating the signature is a concatenated list of requ est variables (namely URI, host and user agent) separated by the <code><fix>NUL< /fix></code> character "\0". For example:}} |
271 </p> | 271 </p> |
272 | 272 |
273 <pre> | 273 <pre> |
274 /index.html?q=foo\0www.example.com\0Mozilla/5.0 (X11; Ubuntu; Linux x86_64; rv :30.0) Gecko/20100101 Firefox/30.0 | 274 /index.html?q=foo\0www.example.com\0Mozilla/5.0 (X11; Ubuntu; Linux x86_64; rv :30.0) Gecko/20100101 Firefox/30.0 |
275 </pre> | 275 </pre> |
276 | 276 |
277 <p> | 277 <p> |
278 {{s111 Finally, generate the signature for this string by using the signature algorithm SEC_OID_ISO_SHA_WITH_RSA_SIGNATURE (default when using OpenSSL).}} | 278 {{s111 Finally, generate the signature for this string by using the signature algorithm SEC_OID_ISO_SHA_WITH_RSA_SIGNATURE (default when using OpenSSL).}} |
279 </p> | 279 </p> |
OLD | NEW |