LEFT | RIGHT |
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 233 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
244 other cases limiting this rule to the necessary domains is preferable.}} | 244 other cases limiting this rule to the necessary domains is preferable.}} |
245 </p> | 245 </p> |
246 | 246 |
247 <h3 id="elemhide_simplified">{{s105 Simplified element hiding syntax}}</h3> | 247 <h3 id="elemhide_simplified">{{s105 Simplified element hiding syntax}}</h3> |
248 | 248 |
249 <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> | 249 <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> |
250 | 250 |
251 <h3 id="generic-specific">{{generic-specific-title Generic / Specific filters}
}</h3> | 251 <h3 id="generic-specific">{{generic-specific-title Generic / Specific filters}
}</h3> |
252 | 252 |
253 <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> | 253 <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> |
254 <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, where as both <code><fix>##div.textad</fix></c
ode> and <code><fix>~example.com##div.textad</fix></code> are generic.}}</p> | 254 <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> |
255 <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> | 255 <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> |
256 | 256 |
257 <h2 id="sitekey_server">{{s107 Implementing a sitekey on the server}}</h2> | 257 <h2 id="sitekey_server">{{s107 Implementing a sitekey on the server}}</h2> |
258 | 258 |
259 <p> | 259 <p> |
260 {{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>).}} | 260 {{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>).}} |
261 </p> | 261 </p> |
262 | 262 |
263 <p> | 263 <p> |
264 {{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.}} | 264 {{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.}} |
265 </p> | 265 </p> |
266 | 266 |
267 <p> | 267 <p> |
268 {{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:}} | 268 {{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:}} |
269 </p> | 269 </p> |
270 | 270 |
271 <pre> | 271 <pre> |
272 /index.html?q=foo\0www.example.com\0Mozilla/5.0 (X11; Ubuntu; Linux x86_64; rv
:30.0) Gecko/20100101 Firefox/30.0 | 272 /index.html?q=foo\0www.example.com\0Mozilla/5.0 (X11; Ubuntu; Linux x86_64; rv
:30.0) Gecko/20100101 Firefox/30.0 |
273 </pre> | 273 </pre> |
274 | 274 |
275 <p> | 275 <p> |
276 {{s111 Finally, generate the signature for this string by using the signature
algorithm SEC_OID_ISO_SHA_WITH_RSA_SIGNATURE (default when using OpenSSL).}} | 276 {{s111 Finally, generate the signature for this string by using the signature
algorithm SEC_OID_ISO_SHA_WITH_RSA_SIGNATURE (default when using OpenSSL).}} |
277 </p> | 277 </p> |
LEFT | RIGHT |