Skip to content
This repository has been archived by the owner on Feb 6, 2023. It is now read-only.

Commit

Permalink
Add non-basic 'url' modifier description (#1121)
Browse files Browse the repository at this point in the history
  • Loading branch information
sxgunchenko authored Sep 16, 2022
1 parent 39f19df commit 80ad24a
Show file tree
Hide file tree
Showing 2 changed files with 48 additions and 0 deletions.
24 changes: 24 additions & 0 deletions 01.general/02.how-to-create-your-own-ad-filters/docs.en.md
Original file line number Diff line number Diff line change
Expand Up @@ -105,6 +105,7 @@ visible: true
* [$app](#non-basic-rules-modifiers-app)
* [$domain](#non-basic-rules-modifiers-domain)
* [$path](#non-basic-rules-modifiers-path)
* [$url](#non-basic-rules-modifiers-url)
* [Information for filters maintainers](#for_maintainers)
* [Pre-processor directives](#pre_processor)
* [Hints](#hints)
Expand Down Expand Up @@ -2305,6 +2306,29 @@ path=pattern

> **Compatibility with different versions of AdGuard.** Rules with `$path` modifier are supported by AdGuard for Windows, Mac, Android, and AdGuard Browser extension for Chrome, Firefox, Edge.
<a id="non-basic-rules-modifiers-url"></a>

### url

`$url` modifier limits the rule application area to URLs matching the specified mask.

#### Syntax

```
url = pattern
```

where `pattern` is pretty much the same as [`pattern` of the basic rules](#basic-rules-syntax) assuming that [some characters](#non-basic-rules-modifiers-syntax) must be escaped.
The [special characters](#basic-rules-special-characters) and [regular expressions](#regexp-support) are supported as well.

#### Examples

* `[$url=||example.com/ads/*]##.textad` — hides a `div` with a class `textad` at addresses like `http://example.com/ads/banner.jpg` and even `http://subdomain.example.com/ads/otherbanner.jpg`.
* `[$url=||example.org^]###adblock` — hides an element with attribute `id` equals `adblock` at `example.org` and its subdomains.
* `[$url=/\[a-z\]+\\.example\\.com^/]##.textad` — this rule hides `div` elements of the class `textad` for all domains matching the regular expression `[a-z]+\.example\.com^`.

> **Compatibility with different versions of AdGuard.** Rules with the `$url` modifier are supported by AdGuard for Windows, Mac, and Android, **running CoreLibs version 1.11 or later**.
<a id="for_maintainers"></a>
## Information for filters maintainers

Expand Down
24 changes: 24 additions & 0 deletions 01.general/02.how-to-create-your-own-ad-filters/docs.ru.md
Original file line number Diff line number Diff line change
Expand Up @@ -105,6 +105,7 @@ visible: true
* [$app](#non-basic-modifiers-app)
* [$domain](#non-basic-rules-modifiers-domain)
* [$path](#non-basic-rules-modifiers-path)
* [$url](#non-basic-rules-modifiers-url)
* [Информация для разработчиков фильтров](#for_maintainers)
* [Директивы пре-процессора](#pre_processor)
* [Hints](#hints)
Expand Down Expand Up @@ -2285,6 +2286,29 @@ path=pattern

> **Совместимость с разными версиями AdGuard.** Правила с модификатором `$path` поддерживаются в AdGuard для Windows, Mac, Android и Браузерном расширении AdGuard для Chrome, Firefox, Edge.
<a id="non-basic-rules-modifiers-path"></a>

### url

Модификатор `$url` ограничивает действие правила запросами, URL которых соответствует указанной маске.

#### Синтаксис

```
url = pattern
```

где `pattern` — маска адреса, синтаксис которой соответсвует [маске адреса (`pattern`) базовых правил](#basic-rules-syntax) за исключением того, что [некоторые символы](#non-basic-rules-modifiers-syntax) должны быть экранированны.
[Специальные символы](#basic-rules-special-characters) и [регулярные выражения](#regexp-support) также поддерживаются.

#### Примеры

* `[$url=||example.com/ads/*]##.textad` — скрывает `div` с классом `textad` в запросах, например, к `http://example.com/ads/banner.jpg` и `http://subdomain.example.com/ads/otherbanner.jpg`.
* `[$url=||example.org^]###adblock` — скрывает элемент с атрибутом `id` равным `adblock` в запросах к `example.org` и всем его поддоменам.
* `[$url=/\[a-z\]+\\.example\\.com^/]##.textad` — скрывает `div` с классом `textad` в запросах к доменам, соответствующих регулярному выражению `[a-z]+\.example\.com^`.

> **Совместимость с разными версиями AdGuard.** Правила с модификатором `$url` поддерживаются в AdGuard для Windows, Mac, и Android, **с CoreLibs версии 1.11 или выше**.
<a id="for_maintainers"></a>
## Информация для разработчиков фильтров

Expand Down

0 comments on commit 80ad24a

Please sign in to comment.