From 3d03b9f0bb09dfef092d6836b2c8dc0a81654582 Mon Sep 17 00:00:00 2001 From: Dmitriy Seregin Date: Wed, 2 Aug 2023 00:51:28 +0400 Subject: [PATCH 1/7] fixes --- .../ad-filtering/create-own-filters.md | 30 ++++++++++--------- 1 file changed, 16 insertions(+), 14 deletions(-) diff --git a/docs/general/ad-filtering/create-own-filters.md b/docs/general/ad-filtering/create-own-filters.md index af596908c1f..28a33660fc3 100644 --- a/docs/general/ad-filtering/create-own-filters.md +++ b/docs/general/ad-filtering/create-own-filters.md @@ -608,7 +608,7 @@ The rule corresponds to the main frame document requests, i.e. HTML documents th By default, AdGuard does not block the requests that are loaded in the browser tab (e.g. "main frame bypass"). The idea is not to prevent pages from loading as the user clearly indicated that they want this page to be loaded. However, if the `$document` modifier is specified explicitly, AdGuard does not use that logic and prevents the page load. Instead, it responds with a "blocking page". -If this modifier is used with an exclusion rule (`@@`), it completely disables blocking on corresponding pages. It is equivalent to using `$elemhide`, `$content`, `$urlblock`, `$jsinject`, `$extension` modifiers simultaneously. +If this modifier is used with an exclusion rule (`@@`), it completely disables blocking on corresponding pages. It is equivalent to using `$elemhide`, `$content`, `$urlblock`, `$jsinject`, `$extension` modifiers simultaneously but only if this modifier is written in the rule and not added hidden, for example in rule `@@example.com$removeheader` which implicitly adds `$document`. **Examples** @@ -2072,7 +2072,9 @@ All allowed content types: * [`$xmlhttprequest`](#xmlhttprequest-modifier); This also includes rules that implicitly add the modifier `$document`: -* [`$popup`](#popup-modifier); +* [`$popup`](#popup-modifier), +* [`$removeparam`](#removeparam-modifier), +* [`$removeheader`](#removeheader-modifier); Or special exceptions that implicitly add `$document,subdocument`: * [`$content`](#content-modifier), @@ -2134,7 +2136,7 @@ Each of which adds `10^4` to the priority. As well as exception with [`$document modifier`](#document-modifier): because it's an alias for `$elemhide,content,jsinject,urlblock,extension`. It will add `10^4` for each modifier from [the top list](#priority-category-4), `10^4 * 5` in total. -In addition, each of these exceptions implicitly adds the two allowed content-type modifiers `$document,subdocument`. +In addition, each of these exceptions implicitly adds the two allowed content-type modifiers `$document,subdocument`, but not when these exceptions are obtained by using the `$document` alias. For this case `$subdocument` should be provided explicitly: `@@||example.com$document,subdocument`. #### Allowlist rules {#priority-category-5} @@ -2174,19 +2176,19 @@ Weight of the rule: base weight + weight of the modifier from [category 1](#prio `||example.org^$removeparam=p` -Weight of the rule: base weight + 0, since $removeparam [is not involved](#priority-category-extra) in the priority calculation: -`1 + 0 = 1`. +Weight of the rule: base weight + 0, since $removeparam [is not involved](#priority-category-extra) in the priority calculation + implicitly added allowed content type `document`, [category 2](#priority-category-2): +`1 + 0 + (50 + 50 / 1) = 101`. **Example 4** `||example.org^$document,redirect=nooptext` Rule weight: base weight + allowed content type, [category 3](#priority-category-3) + $redirect from [category 6](#priority-category-6): -`1 + (100 + 100 / 1) + 1000 = 1201`. +`1 + (50 + 50 / 1) + 1000 = 1101`. **Example 5** -`@@||example.org^$removeparam=p,document` +`@@||example.org^$removeparam=p,subdocument` Rule weight: base weight + allowlist rule, [category 5](#priority-category-5) + 0 because $removeparam [is not involved](#priority-category-extra) in the priority calculation + allowed content type, [category 2](#priority-category-2): `1 + 10000 + 0 + (50 + 50 / 1) = 10101`. @@ -2195,30 +2197,30 @@ Rule weight: base weight + allowlist rule, [category 5](#priority-category-5) + `@@||example.com/ad/*$domain=example.org|example.net,important` -Rule weight: base weight + allowlist rule, [category 5](#priority-category-5) + important rule, [category 7](#priority-category-7) + allowed domains, [category 3](#priority-category-3): -`1 + 10000 + 1000000 + (100 + 100 / 2) = 1010152`. +Rule weight: base weight + allowlist rule, [category 5](#priority-category-5) + allowed domains, [category 3](#priority-category-3) + important rule, [category 7](#priority-category-7): +`1 + 100000 + 1000000 + (100 + 100 / 2) = 1100151`. **Example 7** -`@@||example.org^$document` without additional modifiers is an alias for +`@@||example.org^$document` is an alias for `@@||example.com^$elemhide,content,jsinject,urlblock,extension` -Rule weight: base weight + specific exceptions, [category 4](#priority-category-4) + two allowed content types (document and subdocument), [category 2](#priority-category-2): -`1 + 10000 * 4 + (50 + 50 / 2) = 40076`. +Rule weight: base weight + allowlist rule, [category 5](#priority-category-5) + five specific exceptions, [category 4](#priority-category-4) + two allowed content types (document and subdocument), [category 2](#priority-category-2): +`1 + 100000 + 10000 * 5 + (50 + 50 / 2) = 50076`. **Example 8** `*$script,domain=a.com,denyallow=x.com|y.com` Rule weight: base weight + allowed content type, [category 2](#priority-category-2) + allowed domain, [category 3](#priority-category-3) + denyallow, [category 1](#priority-category-1): -`1 + (50 + 50/1) + (100 + 100 / 1) + 1 = 303`. +`1 + (50 + 50 / 1) + (100 + 100 / 1) + 1 = 302`. **Example 9** `||example.com^$all` (alias to `||example.com^$document,subdocument,image,script,media,etc. + $popup`) Rule weight: base weight + allowed content types, [category 2](#priority-category-2): -`1 + (50 + 50/12) = 55`. +`1 + (50 + 50/12) = 55.17 = 56` because rounding up is applied. # Non-basic rules From bf8b3477da278cc5d7fbf1af2f4ccbac69ede090 Mon Sep 17 00:00:00 2001 From: Dmitry Seregin <105th@users.noreply.github.com> Date: Wed, 2 Aug 2023 14:04:27 +0400 Subject: [PATCH 2/7] Update docs/general/ad-filtering/create-own-filters.md Co-authored-by: Helen <58733007+el-termikael@users.noreply.github.com> --- docs/general/ad-filtering/create-own-filters.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/docs/general/ad-filtering/create-own-filters.md b/docs/general/ad-filtering/create-own-filters.md index 28a33660fc3..0a90bd9b359 100644 --- a/docs/general/ad-filtering/create-own-filters.md +++ b/docs/general/ad-filtering/create-own-filters.md @@ -608,7 +608,7 @@ The rule corresponds to the main frame document requests, i.e. HTML documents th By default, AdGuard does not block the requests that are loaded in the browser tab (e.g. "main frame bypass"). The idea is not to prevent pages from loading as the user clearly indicated that they want this page to be loaded. However, if the `$document` modifier is specified explicitly, AdGuard does not use that logic and prevents the page load. Instead, it responds with a "blocking page". -If this modifier is used with an exclusion rule (`@@`), it completely disables blocking on corresponding pages. It is equivalent to using `$elemhide`, `$content`, `$urlblock`, `$jsinject`, `$extension` modifiers simultaneously but only if this modifier is written in the rule and not added hidden, for example in rule `@@example.com$removeheader` which implicitly adds `$document`. +When used with an exclusion rule (`@@`), this modifier completely disables blocking on the corresponding pages. It is equivalent to using the `$elemhide`, `$content`, `$urlblock`, `$jsinject`, `$extension` modifiers simultaneously, but only if this modifier is written in the rule and not added hidden, for example in the rule `@@example.com$removeheader`, which implicitly adds `$document`. **Examples** From 07522a66691b2a230e41423c570c39cc82107aad Mon Sep 17 00:00:00 2001 From: Dmitry Seregin <105th@users.noreply.github.com> Date: Wed, 2 Aug 2023 14:04:37 +0400 Subject: [PATCH 3/7] Update docs/general/ad-filtering/create-own-filters.md Co-authored-by: Helen <58733007+el-termikael@users.noreply.github.com> --- docs/general/ad-filtering/create-own-filters.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/docs/general/ad-filtering/create-own-filters.md b/docs/general/ad-filtering/create-own-filters.md index 0a90bd9b359..90068bf4cc4 100644 --- a/docs/general/ad-filtering/create-own-filters.md +++ b/docs/general/ad-filtering/create-own-filters.md @@ -2136,7 +2136,7 @@ Each of which adds `10^4` to the priority. As well as exception with [`$document modifier`](#document-modifier): because it's an alias for `$elemhide,content,jsinject,urlblock,extension`. It will add `10^4` for each modifier from [the top list](#priority-category-4), `10^4 * 5` in total. -In addition, each of these exceptions implicitly adds the two allowed content-type modifiers `$document,subdocument`, but not when these exceptions are obtained by using the `$document` alias. For this case `$subdocument` should be provided explicitly: `@@||example.com$document,subdocument`. +In addition, each of these exceptions implicitly adds the two allowed content-type modifiers `$document,subdocument`, but not when these exceptions are obtained using the `$document` alias. In this case, `$subdocument` should be specified explicitly: `@@||example.com$document,subdocument`. #### Allowlist rules {#priority-category-5} From ba9b86b0400ae874700729487b299738e61086ef Mon Sep 17 00:00:00 2001 From: Dmitry Seregin <105th@users.noreply.github.com> Date: Wed, 2 Aug 2023 14:04:43 +0400 Subject: [PATCH 4/7] Update docs/general/ad-filtering/create-own-filters.md Co-authored-by: Helen <58733007+el-termikael@users.noreply.github.com> --- docs/general/ad-filtering/create-own-filters.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/docs/general/ad-filtering/create-own-filters.md b/docs/general/ad-filtering/create-own-filters.md index 90068bf4cc4..dfda07f2eba 100644 --- a/docs/general/ad-filtering/create-own-filters.md +++ b/docs/general/ad-filtering/create-own-filters.md @@ -2220,7 +2220,7 @@ Rule weight: base weight + allowed content type, [category 2](#priority-category `||example.com^$all` (alias to `||example.com^$document,subdocument,image,script,media,etc. + $popup`) Rule weight: base weight + allowed content types, [category 2](#priority-category-2): -`1 + (50 + 50/12) = 55.17 = 56` because rounding up is applied. +`1 + (50 + 50/12) = 55.17 = 56` due to rounding. # Non-basic rules From eeff301079d3adcc1baebe4965e4e799bb4ad96f Mon Sep 17 00:00:00 2001 From: Dmitry Seregin <105th@users.noreply.github.com> Date: Fri, 4 Aug 2023 14:51:41 +0400 Subject: [PATCH 5/7] Update docs/general/ad-filtering/create-own-filters.md Co-authored-by: Nikita Gorskikh <57908117+ngorskikh@users.noreply.github.com> --- docs/general/ad-filtering/create-own-filters.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/docs/general/ad-filtering/create-own-filters.md b/docs/general/ad-filtering/create-own-filters.md index dfda07f2eba..b19d612a76e 100644 --- a/docs/general/ad-filtering/create-own-filters.md +++ b/docs/general/ad-filtering/create-own-filters.md @@ -608,7 +608,7 @@ The rule corresponds to the main frame document requests, i.e. HTML documents th By default, AdGuard does not block the requests that are loaded in the browser tab (e.g. "main frame bypass"). The idea is not to prevent pages from loading as the user clearly indicated that they want this page to be loaded. However, if the `$document` modifier is specified explicitly, AdGuard does not use that logic and prevents the page load. Instead, it responds with a "blocking page". -When used with an exclusion rule (`@@`), this modifier completely disables blocking on the corresponding pages. It is equivalent to using the `$elemhide`, `$content`, `$urlblock`, `$jsinject`, `$extension` modifiers simultaneously, but only if this modifier is written in the rule and not added hidden, for example in the rule `@@example.com$removeheader`, which implicitly adds `$document`. +When used with an exclusion rule (`@@`), this modifier completely disables blocking on the corresponding pages. It is equivalent to using the `$elemhide`, `$content`, `$urlblock`, `$jsinject`, `$extension` modifiers simultaneously, but only if this modifier is written in the rule and not added implicitly, for example in the rule `@@example.com$removeheader`, which implicitly adds `$document`. **Examples** From ed4e342b1854bb8651b4cbcbf267fcdf4f953704 Mon Sep 17 00:00:00 2001 From: Dmitry Seregin <105th@users.noreply.github.com> Date: Fri, 4 Aug 2023 16:04:42 +0400 Subject: [PATCH 6/7] Update docs/general/ad-filtering/create-own-filters.md Co-authored-by: Nikita Gorskikh <57908117+ngorskikh@users.noreply.github.com> --- docs/general/ad-filtering/create-own-filters.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/docs/general/ad-filtering/create-own-filters.md b/docs/general/ad-filtering/create-own-filters.md index b19d612a76e..b23b542d7e7 100644 --- a/docs/general/ad-filtering/create-own-filters.md +++ b/docs/general/ad-filtering/create-own-filters.md @@ -2206,7 +2206,7 @@ Rule weight: base weight + allowlist rule, [category 5](#priority-category-5) + `@@||example.com^$elemhide,content,jsinject,urlblock,extension` Rule weight: base weight + allowlist rule, [category 5](#priority-category-5) + five specific exceptions, [category 4](#priority-category-4) + two allowed content types (document and subdocument), [category 2](#priority-category-2): -`1 + 100000 + 10000 * 5 + (50 + 50 / 2) = 50076`. +`1 + 100000 + 10000 * 5 + (50 + 50 / 2) = 150076`. **Example 8** From cf42e291abf4c65df5b6ff289fe4daed2293f2b6 Mon Sep 17 00:00:00 2001 From: Dmitriy Seregin Date: Fri, 4 Aug 2023 16:07:55 +0400 Subject: [PATCH 7/7] added link --- docs/general/ad-filtering/create-own-filters.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/docs/general/ad-filtering/create-own-filters.md b/docs/general/ad-filtering/create-own-filters.md index b23b542d7e7..4dc346a1733 100644 --- a/docs/general/ad-filtering/create-own-filters.md +++ b/docs/general/ad-filtering/create-own-filters.md @@ -2220,7 +2220,7 @@ Rule weight: base weight + allowed content type, [category 2](#priority-category `||example.com^$all` (alias to `||example.com^$document,subdocument,image,script,media,etc. + $popup`) Rule weight: base weight + allowed content types, [category 2](#priority-category-2): -`1 + (50 + 50/12) = 55.17 = 56` due to rounding. +`1 + (50 + 50/12) = 55.17 = 56` due to [rounding](#priority-computation). # Non-basic rules