Rietveld Code Review Tool
Help | Bug tracker | Discussion group | Source code

Side by Side Diff: pages/filters.html

Issue 29501555: Issue 2373 - Add/change a sentence on filters page regarding EHH removing tag names by default (Closed) Base URL: https://hg.adblockplus.org/web.adblockplus.org
Patch Set: Created July 31, 2017, 10:47 a.m.
Left:
Right:
Use n/p to move between diff chunks; N/P to move between comments.
Jump to:
View unified diff | Download patch
« no previous file with comments | « no previous file | no next file » | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
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 189 matching lines...) Expand 10 before | Expand all | Expand 10 after
200 &lt;div id=&quot;sponsorad&quot;&gt; 200 &lt;div id=&quot;sponsorad&quot;&gt;
201 Really cheap tofu, click here! 201 Really cheap tofu, click here!
202 &lt;/div&gt; 202 &lt;/div&gt;
203 &lt;textad&gt; 203 &lt;textad&gt;
204 Only here you get the best tofu! 204 Only here you get the best tofu!
205 &lt;/textad&gt; 205 &lt;/textad&gt;
206 </pre> 206 </pre>
207 207
208 <p>{{s84 You need to download the web page so you will necessarily download th e advertisements. All you can do here is to hide the advertisement so you don't need to see it. That's what element hiding is meant for.}}</p> 208 <p>{{s84 You need to download the web page so you will necessarily download th e advertisements. All you can do here is to hide the advertisement so you don't need to see it. That's what element hiding is meant for.}}</p>
209 209
210 <p>{{s85 The first advertisement above is contained inside a div element with class attribute "textad". The following rule will hide exactly this combination: <code><fix>##div.textad</fix></code>. Here ## marks an element hiding rule whil e the rest is a selector identifying the elements that need to be hidden. You ca n hide elements by their id attribute similarly, <code><fix>##div#sponsorad</fix ></code> will hide the second advertisement. You don't need to specify the eleme nt name, the rule <code><fix>##*#sponsorad</fix></code> will work just as well. And you can hide elements by element name only, e.g. <code><fix>##textad</fix></ code> for the third advertisement.}}</p> 210 <p>{{s85 The first advertisement above is contained inside an element with cla ss attribute "textad". The following rule will hide exactly any such element: <c ode><fix>##.textad</fix></code>. Here ## marks an element hiding rule while the rest is a selector identifying the elements that need to be hidden. You can hide elements by their id attribute similarly, <code><fix>###sponsorad</fix></code> will hide the second advertisement. And you can hide elements by element name on ly, e.g. <code><fix>##textad</fix></code> for the third advertisement.}}</p>
Wladimir Palant 2017/08/01 13:49:36 Nit: "only" doesn't make sense here any more.
ire 2017/08/02 09:56:00 Done.
211 211
212 <p>{{s86 The <a href="elemhidehelper">Element Hiding Helper extension</a> help s selecting the correct element and writing the corresponding rule without havin g to view the source code of the page. Basic HTML knowledge is useful neverthele ss.}}</p> 212 <p>{{s86 The <a href="elemhidehelper">Element Hiding Helper extension</a> help s selecting the correct element and writing the corresponding rule without havin g to view the source code of the page. Basic HTML knowledge is useful neverthele ss.}}</p>
213 213
214 <p>{{s87 <em>Note</em>: Element hiding works very differently from normal filt ers. This has the implication that no wildcards are supported in element hiding rules.}}</p> 214 <p>{{s87 <em>Note</em>: Element hiding works very differently from normal filt ers. This has the implication that no wildcards are supported in element hiding rules.}}</p>
215 215
216 <h3 id="elemhide_domains">{{s88 Limiting rules to certain domains}}</h3> 216 <h3 id="elemhide_domains">{{s88 Limiting rules to certain domains}}</h3>
217 217
218 <p>{{s89 Usually you want to hide a specific ad on one specific site, you don' t want your rule to be applied on other sites. For example the rule <code><fix># #*.sponsor</fix></code> might hide valid code on some sites. But if you write it as <code><fix>example.com##*.sponsor</fix></code> it will be applied on <code>< fix>http://example.com/</fix></code> and <code><fix>http://something.example.com /</fix></code> but not on <code><fix>http://example.org/</fix></code>. You can a lso specify multiple domains — simply separate them with commas: <code><fix>doma in1.example,domain2.example,domain3.example##*.sponsor</fix></code>.}}</p> 218 <p>{{s89 Usually you want to hide a specific ad on one specific site, you don' t want your rule to be applied on other sites. For example the rule <code><fix># #.sponsor</fix></code> might hide valid code on some sites. But if you write it as <code><fix>example.com##.sponsor</fix></code> it will be applied on <code><fi x>http://example.com/</fix></code> and <code><fix>http://something.example.com/< /fix></code> but not on <code><fix>http://example.org/</fix></code>. You can als o specify multiple domains — simply separate them with commas: <code><fix>domain 1.example,domain2.example,domain3.example##.sponsor</fix></code>.}}</p>
219 219
220 <p>{{s90 If a domain name is preceded with "~", the rule will <strong>not</str ong> be applied on pages from this domain (requires Adblock Plus 1.1 or higher). For example, <code><fix>~example.com##*.sponsor</fix></code> will be be applied on pages from any domain but "example.com" and <code><fix>example.com,~foo.exam ple.com##*.sponsor</fix></code> makes the rule apply on "example.com" domain wit h the exception of "foo.example.com" subdomain.}}</p> 220 <p>{{s90 If a domain name is preceded with "~", the rule will <strong>not</str ong> be applied on pages from this domain (requires Adblock Plus 1.1 or higher). For example, <code><fix>~example.com##.sponsor</fix></code> will be be applied on pages from any domain but "example.com" and <code><fix>example.com,~foo.examp le.com##.sponsor</fix></code> makes the rule apply on "example.com" domain with the exception of "foo.example.com" subdomain.}}</p>
221 221
222 <p>{{s91 <em>Note</em>: Due to the way how element hiding is implemented, you really can only limit it to full domain names. You cannot use any other part of the address and you cannot use <code><fix>domain</fix></code> as a replacement f or <code><fix>domain.example,domain.test</fix></code>.}}</p> 222 <p>{{s91 <em>Note</em>: Due to the way how element hiding is implemented, you really can only limit it to full domain names. You cannot use any other part of the address and you cannot use <code><fix>domain</fix></code> as a replacement f or <code><fix>domain.example,domain.test</fix></code>.}}</p>
223 223
224 <p>{{s92 <em>Note</em>: Element hiding rules with domain limitation can be use d to hide browser's user interface elements as well. For example the filter rule <code><fix>browser##menuitem#javascriptConsole</fix></code> will hide the JavaS cript Console entry in Firefox's Tools menu.}}</p> 224 <p>{{s92 <em>Note</em>: Element hiding rules with domain limitation can be use d to hide browser's user interface elements as well. For example the filter rule <code><fix>browser##menuitem#javascriptConsole</fix></code> will hide the JavaS cript Console entry in Firefox's Tools menu.}}</p>
225 225
226 <h3 id="elemhide_attributes">{{s93 Attribute selectors}}</h3> 226 <h3 id="elemhide_attributes">{{s93 Attribute selectors}}</h3>
227 227
228 <p>{{s94 Some advertisers don't make it easy for you — their text advertisemen ts have neither an id nor a class attribute. You can use other attributes to hid e those, for example <code><fix>##table[width="80%"]</fix></code> will hide tabl es with width attribute set to 80%. If you don't want to specify the full value of the attribute, <code><fix>##div[title*="adv"]</fix></code> will hide all div elements with title attribute containing the string "adv". You can also check th e beginning and the end of an attribute, for example <code><fix>##div[title^="ad v"][title$="ert"]</fix></code> will hide div elements with title starting with " adv" and ending with "ert". As you see, you can also use multiple conditions — < code><fix>table[width="80%"][bgcolor="white"]</fix></code> will match tables wit h width attribute set to 80% and bgcolor attribute set to white.}}</p> 228 <p>{{s94 Some advertisers don't make it easy for you — their text advertisemen ts have neither an id nor a class attribute. You can use other attributes to hid e those, for example <code><fix>##table[width="80%"]</fix></code> will hide tabl es with width attribute set to 80%. If you don't want to specify the full value of the attribute, <code><fix>##div[title*="adv"]</fix></code> will hide all div elements with title attribute containing the string "adv". You can also check th e beginning and the end of an attribute, for example <code><fix>##div[title^="ad v"][title$="ert"]</fix></code> will hide div elements with title starting with " adv" and ending with "ert". As you see, you can also use multiple conditions — < code><fix>table[width="80%"][bgcolor="white"]</fix></code> will match tables wit h width attribute set to 80% and bgcolor attribute set to white.}}</p>
229 229
230 <h3 id="elemhide_css">{{s95 Advanced selectors}}</h3> 230 <h3 id="elemhide_css">{{s95 Advanced selectors}}</h3>
231 231
232 <p>{{s97 In general, any CSS selector supported by Firefox can be used for ele ment hiding. For example the following rule will hide anything following a div e lement with class "adheader": <code><fix>##div.adheader + *</fix></code>. For a full list of CSS list see <a href="{{s97-link http://www.w3.org/TR/css3-selector s/}}">W3C CSS specification</a> (note that not all selectors are supported by Fi refox yet).}}</p> 232 <p>{{s97 In general, any CSS selector supported by Firefox can be used for ele ment hiding. For example the following rule will hide anything following a div e lement with class "adheader": <code><fix>##.adheader + *</fix></code>. For a ful l list of CSS list see <a href="{{s97-link http://www.w3.org/TR/css3-selectors/} }">W3C CSS specification</a> (note that not all selectors are supported by Firef ox yet).}} {{advanced-selectors-2 Please keep in mind that browsers are slower t o process these selectors than selectors based on <code><fix>class</fix></code> or <code><fix>id</fix></code> attribute only.}}</p>
233 233
234 <p>{{s98 <em>Note</em>: This functionality is for advanced users only, you sho uld be comfortable with CSS selectors to use it. Adblock Plus won't be able to c heck the syntax of the selector you are adding, if you use invalid CSS syntax yo u might break other (valid) rules you have. Check JavaScript Console for CSS err ors.}}</p> 234 <p>{{s98 <em>Note</em>: This functionality is for advanced users only, you sho uld be comfortable with CSS selectors to use it. Adblock Plus won't be able to c heck the syntax of the selector you are adding, if you use invalid CSS syntax yo u might break other (valid) rules you have. Check JavaScript Console for CSS err ors.}}</p>
235 235
236 <h3 id="elemhide-emulation">{{ elemhide-emulation-heading[heading] Extended CSS selectors (Adblock Plus specific) }}</h3> 236 <h3 id="elemhide-emulation">{{ elemhide-emulation-heading[heading] Extended CSS selectors (Adblock Plus specific) }}</h3>
237 237
238 <p> 238 <p>
239 {{ elemhide-emulation-1 Sometimes the standard CSS selectors aren't powerful e nough to hide an advertisement, for those cases we have added some new ones, nam ely <code><fix>:-abp-has()</fix></code> and <code><fix>:-abp-properties()</fix>< /code> (requires Adblock Plus 1.13.3 for Chrome and Opera or higher). }} 239 {{ elemhide-emulation-1 Sometimes the standard CSS selectors aren't powerful e nough to hide an advertisement, for those cases we have added some new ones, nam ely <code><fix>:-abp-has()</fix></code> and <code><fix>:-abp-properties()</fix>< /code> (requires Adblock Plus 1.13.3 for Chrome and Opera or higher). }}
240 </p> 240 </p>
241 <p> 241 <p>
242 {{ elemhide-emulation-2 When writing an element hiding filter that makes use o f these extended selectors you must use the <code><fix>#?#</fix></code> syntax, e.g. <code><fix>example.com#?#selector</fix></code>. But it's important to note that doing so carries a performance impact, so do so sparingly and make sure tho se filters are specific to as few domains and elements as possible. }} 242 {{ elemhide-emulation-2 When writing an element hiding filter that makes use o f these extended selectors you must use the <code><fix>#?#</fix></code> syntax, e.g. <code><fix>example.com#?#selector</fix></code>. But it's important to note that doing so carries a performance impact, so do so sparingly and make sure tho se filters are specific to as few domains and elements as possible. }}
(...skipping 11 matching lines...) Expand all
254 <h4>:-abp-has()</h4> 254 <h4>:-abp-has()</h4>
255 <p> 255 <p>
256 {{ 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>&lt;div&gt;</fix></code> that contains an <code><fix>&lt;a&gt;</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. }} 256 {{ 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>&lt;div&gt;</fix></code> that contains an <code><fix>&lt;a&gt;</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. }}
257 </p> 257 </p>
258 258
259 <h3 id="elemhide_exceptions">{{s99 Exception rules}}</h3> 259 <h3 id="elemhide_exceptions">{{s99 Exception rules}}</h3>
260 260
261 <p> 261 <p>
262 {{s100 Exception rules can disable existing rules on particular domains.}} {{s 101 These are mostly 262 {{s100 Exception rules can disable existing rules on particular domains.}} {{s 101 These are mostly
263 useful to filter subscription authors who are extending another filter subscri ption that they 263 useful to filter subscription authors who are extending another filter subscri ption that they
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>##.textad</fix></code > 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#@#.textad</fix></code>.}} {{s103 The combination of the se 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##.textad</fix></code>.}} {{s104 It is recommended that 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> 274 <h3 id="elemhide_simplified">{{s105 Simplified element hiding syntax}}</h3>
275 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> 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 277
278 <h3 id="generic-specific">{{generic-specific-title Generic / Specific filters} }</h3> 278 <h3 id="generic-specific">{{generic-specific-title Generic / Specific filters} }</h3>
279 279
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> 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>
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> 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##.textad</fi x></code> is a specific filter, whereas both <code><fix>##.textad</fix></code> a nd <code><fix>~example.com##.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> 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>
283 283
284 <h2 id="sitekey_server">{{s107 Implementing a sitekey on the server}}</h2> 284 <h2 id="sitekey_server">{{s107 Implementing a sitekey on the server}}</h2>
285 285
286 <p> 286 <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>&lt;html data-adb lockkey="abcdpublickeydcba_abcdsignaturedcba"&gt;</fix></code>).}} 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>&lt;html data-adb lockkey="abcdpublickeydcba_abcdsignaturedcba"&gt;</fix></code>).}}
288 </p> 288 </p>
289 289
290 <p> 290 <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.}} 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.}}
292 </p> 292 </p>
293 293
294 <p> 294 <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:}} 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:}}
296 </p> 296 </p>
297 297
298 <pre> 298 <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 299 /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> 300 </pre>
301 301
302 <p> 302 <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).}} 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).}}
304 </p> 304 </p>
OLDNEW
« no previous file with comments | « no previous file | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld