1
0
mirror of https://github.com/gorhill/uBlock.git synced 2024-07-05 11:37:01 +02:00

Updated Static filter syntax (markdown)

gwarser 2020-03-06 20:12:23 +01:00
parent 6a9021bed0
commit 261ea3043d

@ -24,6 +24,8 @@ The reason it is not supported is to be sure that users explicitly disable uBO t
Note: it [still works](https://github.com/gorhill/uBlock/issues/1754) to negate [strict blocking](./Strict-blocking) when explicitly enabled by blocking filter `document` option.
***
#### `genericblock`
Not supported.
@ -34,6 +36,8 @@ This option is not supported because using such filter option would cause large
For instance, when used for a specific site, the `genericblock` option would cause all the filters in hosts files to be disabled, including those from the malware lists. EasyPrivacy and other anti-tracking lists also contain countless so-called "generic" filters, and as a consequence these would also end up being disabled.
***
#### ~`elemhide`~
**Supported** starting with uBO [1.23.0](https://github.com/gorhill/uBlock/commit/23c4c80136ba4974a6444488ef8162ba75b0cb84), also aliased as `ehide`.
@ -48,6 +52,8 @@ uBO v1.16.0 and above supports pre-parsing directives. Pre-parsing directives ar
The pre-parsing directives are executed before a list content is parsed, and influence the final content of a filter list.
***
#### `!#include [file name]`
The `!#include` directive allows to import another filter list in place where the directive appears. The purpose is to allow filter list maintainers to create filters which are specific to uBO, while keeping their list compatible with other blockers. Other blockers will ignore the `!#include` directive, because it will be seen as a comment and thus discarded. uBO will attempt to load the resource found at `[file name]` (the sub-list) and load its content into the current list.
@ -62,6 +68,8 @@ Incorrect usage:
- `!#include https://github.com/uBlockOrigin/uAssets/blob/master/filters/filters.txt`
- `!#include ../filters.txt`
***
#### `!#if [condition]`
The `!#if` directive allows filter list maintainers to create areas in a filter list which will be parsed **only** if certain conditions are met (or not met). For example this can be used to create filters which are specific to a particular browser.
@ -119,6 +127,8 @@ So in uBO, any entry which can be read as a valid hostname, will be assumed to b
example.com/*
***
#### `*` aka "all URLs"
The wildcard character `*` can be used to apply a filter to **all** URLs. This is not recommended though, unless you further narrow the filter using filter options. Examples:
@ -128,14 +138,20 @@ The wildcard character `*` can be used to apply a filter to **all** URLs. This i
Usually, it is far more convenient to use [dynamic filtering rules](./Dynamic-filtering) in lieu of such generic static filters.
***
#### `1p`
Equivalent to [`first-party`](#first-party) uBO option, which in turn is negated `third-party` [option](https://adblockplus.org/filters#options) (`~third-party`). For convenience.
***
#### `3p`
Equivalent to `third-party` [option](https://adblockplus.org/filters#options). For convenience.
***
#### `all`
New in [1.19.7b](https://github.com/gorhill/uBlock/commit/1888033070003cd5e6a3687a4029448bf41fccea).
@ -155,6 +171,8 @@ semantic when using only `||bet365.com^`.
See also [#2385](https://github.com/gorhill/uBlock/issues/2385)
***
#### `badfilter`
To disable an existing filter. Sometimes, disabling an existing blocking filter is better than creating an exception filter. Just for example sake, let's say that a mind-absent filter list maintainer added the following filter in his list:
@ -184,16 +202,22 @@ Will be processed in a special manner:
- The logger will always report these special filters with only a
single hostname in the `domain=` option.
***
#### `css`
Equivalent to `stylesheet` [option](https://adblockplus.org/filters#options). For convenience.
***
#### `document`
For _block_ filters only. This is _type_ option (like `image` or `script`) which specifies _main frame_ (a.k.a. the root document) of a web page. Usually not necessary, because uBO implies it for filters specifying only host part of the URL. This will cause web pages which match the filter to be subjected to [strict blocking](./Strict-blocking).
See also: [`all`](#all)
***
#### `elemhide`
Alias: `ehide`.
@ -202,6 +226,8 @@ Before uBO [1.23.0](https://github.com/gorhill/uBlock/commit/23c4c80136ba4974a64
Option for exception filters only. Turns off all cosmetic filtering on matching pages.
***
#### `empty`
New in [1.21.7b7](https://github.com/gorhill/uBlock/commit/3e5c9e00ab3603ae0c02e08b007b084404bbb71d).
@ -212,14 +238,20 @@ When `empty` is used, only network requests which are meant to return a text res
See also: [`mp4`](#mp4), [`redirect`](#redirect)
***
#### `first-party`
Equivalent to `~third-party` [option](https://adblockplus.org/filters#options). Provided strictly for convenience (0.9.9.0).
***
#### `frame`
Equivalent to `subdocument` [option](https://adblockplus.org/filters#options). For convenience.
***
#### `generichide`
Alias: `ghide`.
@ -228,6 +260,8 @@ Option for exception filters only. Turns off _generic_ cosmetic filtering on mat
Generic cosmetic filters, are hiding filters which apply to all pages - `##.ad-class`.
***
#### `important`
The filter option `important` means to ignore all _exception_ filters (those prefixed with `@@`).
@ -236,14 +270,20 @@ It applies only to network _block_ filters. The `important` option will allow yo
Example: `||google-analytics.com^$important,third-party` will block all network requests to `google-analytics.com`, disregarding any existing network _exception_ filters. Another example: `||twitter.com^$important,third-party`. Etc.
***
#### `inline-script`
To specifically disable inline script tags in a main page via CSP: `||example.com^$inline-script`.
***
#### `inline-font`
To specifically disable inline font tags in a main page via CSP: `||example.com^$inline-font`.
***
#### `mp4`
New in [1.21.7b8](https://github.com/gorhill/uBlock/commit/68ae847ba385c09c5efa511d18a18a4753af47be).
@ -252,10 +292,14 @@ The `mp4` filter option will be converted to `redirect=noopmp4-1s` internally, a
See also: [`empty`](#empty), [`redirect`](#redirect)
***
#### `popunder`
To block "popunders" windows/tabs, where original page is redirected to advertisement and desired content is loaded in newly created one. To be used in the same manner as the `popup` filter option, except that it will block popunders.
***
#### `redirect`
To cause a blocked network request to be redirected to a local "neutered" version of the resource. The "neutered" resource must be referenced using a resource token. The resources are defined in [uAssets/filters/resources.txt](https://github.com/uBlockOrigin/uAssets/blob/master/filters/resources.txt). Special, reserved token `none` can be used to disable specific redirect filters.
@ -273,6 +317,8 @@ A source hostname should always be specified, so the `domain=` option is strongl
<sub>__*__ redirections applied to all destinations (starting with `*`) cannot be narrowed by `first-party` or `~third-party` option [#3590](https://github.com/gorhill/uBlock/issues/3590)</sub>
***
#### `redirect-rule`
New in [1.21.7b3](https://github.com/gorhill/uBlock/commit/aa73f292eced0d34a2a2989b1b27ace1214a2809).
@ -289,6 +335,8 @@ The above filter will result in a block filter `||example.com/ads.js$script` **a
The above filter will not cause a block filter to be created, only a redirect directive will be created. Standalone redirect directives are useful when the blocking of a resource is optional but we still want the resource to be redirected should it ever be blocked by whatever mean - whether through a separate block filter, a dynamic filtering rule, etc.
***
#### `specifichide`
Alias: `shide`.
@ -299,6 +347,8 @@ Option for exception filters only. Turns off _specific_ cosmetic filtering on ma
Specific cosmetic filters, are filters which apply only to pages in domains specified in filter - `example.com##.ad-class`.
***
#### `xhr`
Equivalent to `xmlhttprequest` [option](https://adblockplus.org/filters#options). For convenience.
@ -312,6 +362,8 @@ Static extended filters are all of the form:
The most common type of static extended filters are cosmetic filters, also known as "element hiding filters" in Adblock Plus.
***
#### Entity
All static extended filters can be declared to apply to a specific _entity_. For example:
@ -324,6 +376,8 @@ Examples: `google.*` will apply to all similar Google domain names: `google.com
Since the base domain name is used to derive the name of the "entity", `google.evil.biz` would **not** match `google.*`.
***
#### Specific-generic
New in [1.24.5rc0](https://github.com/gorhill/uBlock/commit/3fab7bfdb4f892f3d33159fd53ccf1d5342a090a).
@ -356,6 +410,8 @@ Related issue: [#803](https://github.com/uBlockOrigin/uBlock-issues/issues/803).
See [detailed documentation](./Procedural-cosmetic-filters).
***
#### `:style()`
Related issue: [Support cosmetic filters with explicit style properties](https://github.com/gorhill/uBlock/issues/781).