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 234 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
245 <h4>:-abp-properties()</h4> | 245 <h4>:-abp-properties()</h4> |
246 <p> | 246 <p> |
247 {{ abp-properties-1 <code><fix>:-abp-properties(properties)</fix></code> will
select elements based upon stylesheet properties. For example <code><fix>:-abp-p
roperties(width:300px;height:250px;)</fix></code> will select elements that have
a corresponding CSS rule in a stylesheet which sets the <code><fix>width</fix><
/code> and <code><fix>height</fix></code> to the values <code><fix>300px</fix></
code> and <code><fix>250px</fix></code> respectively. Property names are matched
case-insensitively. Furthermore, wildcards can be used so that <code><fix>:-abp
-properties(width:*px;height:250px;)</fix></code> will match any width specified
in pixels and a height of 250 pixels. }} | 247 {{ abp-properties-1 <code><fix>:-abp-properties(properties)</fix></code> will
select elements based upon stylesheet properties. For example <code><fix>:-abp-p
roperties(width:300px;height:250px;)</fix></code> will select elements that have
a corresponding CSS rule in a stylesheet which sets the <code><fix>width</fix><
/code> and <code><fix>height</fix></code> to the values <code><fix>300px</fix></
code> and <code><fix>250px</fix></code> respectively. Property names are matched
case-insensitively. Furthermore, wildcards can be used so that <code><fix>:-abp
-properties(width:*px;height:250px;)</fix></code> will match any width specified
in pixels and a height of 250 pixels. }} |
248 </p> | 248 </p> |
249 <p> | 249 <p> |
250 {{ abp-properties-2 You can also use <a href="https://developer.mozilla.org/en
-US/docs/Web/JavaScript/Guide/Regular_Expressions">regular expressions</a> by su
rrounding the properties expression with "/". For example, <code><fix>:-abp-prop
erties(/width:30[2-8]px;height:250px;/)</fix></code> will match widths between 3
02 and 308 pixels and a height of 250 pixels. }} | 250 {{ abp-properties-2 You can also use <a href="https://developer.mozilla.org/en
-US/docs/Web/JavaScript/Guide/Regular_Expressions">regular expressions</a> by su
rrounding the properties expression with "/". For example, <code><fix>:-abp-prop
erties(/width:30[2-8]px;height:250px;/)</fix></code> will match widths between 3
02 and 308 pixels and a height of 250 pixels. }} |
251 </p> | 251 </p> |
252 <p> | 252 <p> |
253 {{ abp-properties-3 <em>Note</em>: The <a href="https://adblockplus.org/develo
pment-builds/new-css-property-filter-syntax">older syntax</a> for the CSS proper
ty filters is deprecated and will be automatically converted to the new format&n
bsp;. The syntax to select the style properties remain the same. For example, <c
ode><fix>[-abp-properties='width:300px;height:250px;']</fix></code> will be conv
erted to <code><fix>:-abp-properties(width:300px;height:250px;)</fix></code>. }} | 253 {{ abp-properties-3 <em>Note</em>: The <a href="https://adblockplus.org/develo
pment-builds/new-css-property-filter-syntax">older syntax</a> for the CSS proper
ty filters is deprecated and will be automatically converted to the new format&n
bsp;. The syntax to select the style properties remain the same. For example, <c
ode><fix>[-abp-properties='width:300px;height:250px;']</fix></code> will be conv
erted to <code><fix>:-abp-properties(width:300px;height:250px;)</fix></code>. }} |
254 </p> | 254 </p> |
| 255 <p> |
| 256 {{ abp-properties-4 <code><fix>:-abp-properties()</fix></code> will also selec
t elements using the style properties found in their pseudo-elements, like <code
><fix>::before</fix></code> and <code><fix>::after</fix></code>. For example, <c
ode><fix>:-abp-properties(content:'Advertisment')</fix></code> will match elemen
ts where the string <em>Advertisment</em> is found in either their <code><fix>::
before</fix></code> or <code><fix>::after</fix></code> pseudo element. }} |
| 257 </p> |
255 <h4>:-abp-has()</h4> | 258 <h4>:-abp-has()</h4> |
256 <p> | 259 <p> |
257 {{ abp-has-1 <code><fix>:-abp-has(selector)</fix></code> will select elements
based on their content. For example <code><fix>:-abp-has(> div > a.advertiser)</
fix></code> will select elements that contain as a direct descendant a <code><fi
x><div></fix></code> that contains an <code><fix><a></fix></code> wi
th the class <code><fix>advertiser</fix></code>. The inner selector can be relat
ive to the element scope, and can use any of the pseudo-selectors, including <co
de><fix>:-abp-has()</fix></code> and will determine whether the selection will o
ccur. }} | 260 {{ abp-has-1 <code><fix>:-abp-has(selector)</fix></code> will select elements
based on their content. For example <code><fix>:-abp-has(> div > a.advertiser)</
fix></code> will select elements that contain as a direct descendant a <code><fi
x><div></fix></code> that contains an <code><fix><a></fix></code> wi
th the class <code><fix>advertiser</fix></code>. The inner selector can be relat
ive to the element scope, and can use any of the pseudo-selectors, including <co
de><fix>:-abp-has()</fix></code> and will determine whether the selection will o
ccur. }} |
258 </p> | 261 </p> |
259 <h4>:-abp-contains()</h4> | 262 <h4>:-abp-contains()</h4> |
260 <p> | 263 <p> |
261 {{ abp-contains-1 <code><fix>:-abp-contains(text)</fix></code> will select ele
ments based on their text content. For example, <code><fix>div.sidebar > span:-a
bp-contains(Advertisment)</fix></code> will select the <code><fix><span><
/fix></code> elements within a <code><fix><div></fix></code>, with a class
of <code><fix>sidebar</fix></code> that contains the word "Advertisment". In pr
actice, you'd want to combine this with a <code><fix>:-abp-has()</fix></code> to
select the outer container — something like <code><fix>div.sidebar > div:-abp-h
as(span:-abp-contains(Advertisment))</fix></code> to select the container that w
ould contain an advertisement label. }} | 264 {{ abp-contains-1 <code><fix>:-abp-contains(text)</fix></code> will select ele
ments based on their text content. For example, <code><fix>div.sidebar > span:-a
bp-contains(Advertisment)</fix></code> will select the <code><fix><span><
/fix></code> elements within a <code><fix><div></fix></code>, with a class
of <code><fix>sidebar</fix></code> that contains the word "Advertisment". In pr
actice, you'd want to combine this with a <code><fix>:-abp-has()</fix></code> to
select the outer container — something like <code><fix>div.sidebar > div:-abp-h
as(span:-abp-contains(Advertisment))</fix></code> to select the container that w
ould contain an advertisement label. }} |
262 </p> | 265 </p> |
263 | 266 |
264 <h3 id="elemhide_exceptions">{{s99 Exception rules}}</h3> | 267 <h3 id="elemhide_exceptions">{{s99 Exception rules}}</h3> |
(...skipping 31 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
296 {{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:}} | 299 {{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:}} |
297 </p> | 300 </p> |
298 | 301 |
299 <pre> | 302 <pre> |
300 /index.html?q=foo\0www.example.com\0Mozilla/5.0 (X11; Ubuntu; Linux x86_64; rv
:30.0) Gecko/20100101 Firefox/30.0 | 303 /index.html?q=foo\0www.example.com\0Mozilla/5.0 (X11; Ubuntu; Linux x86_64; rv
:30.0) Gecko/20100101 Firefox/30.0 |
301 </pre> | 304 </pre> |
302 | 305 |
303 <p> | 306 <p> |
304 {{s111 Finally, generate the signature for this string by using the signature
algorithm SEC_OID_ISO_SHA_WITH_RSA_SIGNATURE (default when using OpenSSL).}} | 307 {{s111 Finally, generate the signature for this string by using the signature
algorithm SEC_OID_ISO_SHA_WITH_RSA_SIGNATURE (default when using OpenSSL).}} |
305 </p> | 308 </p> |
OLD | NEW |