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> |
(...skipping 253 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
264 cannot change.}} {{s102 For example, the rule <code><fix>##div.textad</fix></c
ode> can be | 264 cannot change.}} {{s102 For example, the rule <code><fix>##div.textad</fix></c
ode> can be |
265 disabled on <code><fix>example.com</fix></code> using the exception rule | 265 disabled on <code><fix>example.com</fix></code> using the exception rule |
266 <code><fix>example.com#@#div.textad</fix></code>.}} {{s103 The combination of
these two | 266 <code><fix>example.com#@#div.textad</fix></code>.}} {{s103 The combination of
these two |
267 rules has exactly the same effect as the single rule | 267 rules has exactly the same effect as the single rule |
268 <code><fix>~example.com##div.textad</fix></code>.}} {{s104 It is recommended t
hat you use | 268 <code><fix>~example.com##div.textad</fix></code>.}} {{s104 It is recommended t
hat you use |
269 exception rules only when you cannot change an overly general element hiding r
ule, in all the | 269 exception rules only when you cannot change an overly general element hiding r
ule, in all the |
270 other cases limiting this rule to the necessary domains is preferable.}} | 270 other cases limiting this rule to the necessary domains is preferable.}} |
271 {{ exception-rules These exceptions will be applied to <a href="#elemhide-emul
ation">advanced pseudo-selector rules</a> as well. }} | 271 {{ exception-rules These exceptions will be applied to <a href="#elemhide-emul
ation">advanced pseudo-selector rules</a> as well. }} |
272 </p> | 272 </p> |
273 | 273 |
274 <h3 id="elemhide_simplified">{{s105 Simplified element hiding syntax}}</h3> | |
275 | |
276 <p>{{s106 Adblock Plus supports simplified element hiding syntax (e.g. <code><
fix>#div(id=foo)</fix></code>) for backwards compatibility only. Using this synt
ax is discouraged, usual CSS selectors are preferred. Support for this syntax mi
ght be removed at some point.}}</p> | |
277 | |
278 <h3 id="generic-specific">{{generic-specific-title Generic / Specific filters}
}</h3> | 274 <h3 id="generic-specific">{{generic-specific-title Generic / Specific filters}
}</h3> |
279 | 275 |
280 <p>{{generic-specific-explanation-p1 With the <code><fix>$generichide</fix></c
ode> and <code><fix>$genericblock</fix></code> filter options the distinction be
tween generic and specific filters becomes important.}}</p> | 276 <p>{{generic-specific-explanation-p1 With the <code><fix>$generichide</fix></c
ode> and <code><fix>$genericblock</fix></code> filter options the distinction be
tween generic and specific filters becomes important.}}</p> |
281 <p>{{generic-specific-explanation-p2 We classify a filter to be <strong>specif
ic</strong> if it matches one or more domains or matches a sitekey. If a filter
has no domains specified (or only domain exceptions) and no sitekey then it coun
ts as <strong>generic</strong>. For example, <code><fix>example.com##div.textad<
/fix></code> is a specific filter, whereas both <code><fix>##div.textad</fix></c
ode> and <code><fix>~example.com##div.textad</fix></code> are generic.}}</p> | 277 <p>{{generic-specific-explanation-p2 We classify a filter to be <strong>specif
ic</strong> if it matches one or more domains or matches a sitekey. If a filter
has no domains specified (or only domain exceptions) and no sitekey then it coun
ts as <strong>generic</strong>. For example, <code><fix>example.com##div.textad<
/fix></code> is a specific filter, whereas both <code><fix>##div.textad</fix></c
ode> and <code><fix>~example.com##div.textad</fix></code> are generic.}}</p> |
282 <p>{{generic-specific-explanation-p3 Note that with blocking rules the domain
must be specified under the $domain option for them to be considered specific. F
or example, <code><fix>||example.com^</fix></code> is considered generic whereas
<code><fix>*/ads/*$domain=example.com</fix></code> is site-specific.}}</p> | 278 <p>{{generic-specific-explanation-p3 Note that with blocking rules the domain
must be specified under the $domain option for them to be considered specific. F
or example, <code><fix>||example.com^</fix></code> is considered generic whereas
<code><fix>*/ads/*$domain=example.com</fix></code> is site-specific.}}</p> |
283 | 279 |
284 <h2 id="sitekey_server">{{s107 Implementing a sitekey on the server}}</h2> | 280 <h2 id="sitekey_server">{{s107 Implementing a sitekey on the server}}</h2> |
285 | 281 |
286 <p> | 282 <p> |
287 {{s108 For a <a href="#options">sitekey-restricted filter</a> to apply, a webp
age needs to return base64-encoded versions of the public key and a signature wh
ich Adblock Plus can validate. Currently, this means including them in both the
HTTP response header (<code><fix>X-Adblock-Key: abcdpublickeydcba_abcdsignatured
cba</fix></code>) and the root tag of the document (<code><fix><html data-adb
lockkey="abcdpublickeydcba_abcdsignaturedcba"></fix></code>).}} | 283 {{s108 For a <a href="#options">sitekey-restricted filter</a> to apply, a webp
age needs to return base64-encoded versions of the public key and a signature wh
ich Adblock Plus can validate. Currently, this means including them in both the
HTTP response header (<code><fix>X-Adblock-Key: abcdpublickeydcba_abcdsignatured
cba</fix></code>) and the root tag of the document (<code><fix><html data-adb
lockkey="abcdpublickeydcba_abcdsignaturedcba"></fix></code>).}} |
288 </p> | 284 </p> |
289 | 285 |
290 <p> | 286 <p> |
291 {{s109 First you need to create a private RSA key (preferably 512 bit to keep
the transfer volume low) and then a DER representation of the public key.}} | 287 {{s109 First you need to create a private RSA key (preferably 512 bit to keep
the transfer volume low) and then a DER representation of the public key.}} |
292 </p> | 288 </p> |
293 | 289 |
294 <p> | 290 <p> |
295 {{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:}} | 291 {{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:}} |
296 </p> | 292 </p> |
297 | 293 |
298 <pre> | 294 <pre> |
299 /index.html?q=foo\0www.example.com\0Mozilla/5.0 (X11; Ubuntu; Linux x86_64; rv
:30.0) Gecko/20100101 Firefox/30.0 | 295 /index.html?q=foo\0www.example.com\0Mozilla/5.0 (X11; Ubuntu; Linux x86_64; rv
:30.0) Gecko/20100101 Firefox/30.0 |
300 </pre> | 296 </pre> |
301 | 297 |
302 <p> | 298 <p> |
303 {{s111 Finally, generate the signature for this string by using the signature
algorithm SEC_OID_ISO_SHA_WITH_RSA_SIGNATURE (default when using OpenSSL).}} | 299 {{s111 Finally, generate the signature for this string by using the signature
algorithm SEC_OID_ISO_SHA_WITH_RSA_SIGNATURE (default when using OpenSSL).}} |
304 </p> | 300 </p> |
OLD | NEW |