diff --git a/wiki/about-redirects.md b/wiki/about-redirects.md index e015ecc4b..e446ff986 100644 --- a/wiki/about-redirects.md +++ b/wiki/about-redirects.md @@ -1,341 +1,227 @@ -# Available Redirect resources - -- [1x1-transparent.gif](#1x1-transparent.gif) -- [2x2-transparent.png](#2x2-transparent.png) -- [3x2-transparent.png](#3x2-transparent.png) -- [32x32-transparent.png](#32x32-transparent.png) -- [noopframe](#noopframe) -- [noopcss](#noopcss) -- [noopjs](#noopjs) -- [noopjson](#noopjson) -- [nooptext](#nooptext) -- [empty](#empty) -- [noopvmap-1.0](#noopvmap-1.0) -- [noopvast-2.0](#noopvast-2.0) -- [noopvast-3.0](#noopvast-3.0) -- [noopvast-4.0](#noopvast-4.0) -- [noopmp3-0.1s](#noopmp3-0.1s) -- [noopmp4-1s](#noopmp4-1s) -- [amazon-apstag](#amazon-apstag) -- [ati-smarttag](#ati-smarttag) -- [didomi-loader](#didomi-loader) -- [fingerprintjs2](#fingerprintjs2) -- [fingerprintjs3](#fingerprintjs3) -- [gemius](#gemius) -- [google-analytics-ga](#google-analytics-ga) -- [google-analytics](#google-analytics) -- [google-ima3](#google-ima3) -- [googlesyndication-adsbygoogle](#googlesyndication-adsbygoogle) -- [googletagservices-gpt](#googletagservices-gpt) -- [matomo](#matomo) -- [metrika-yandex-tag](#metrika-yandex-tag) -- [metrika-yandex-watch](#metrika-yandex-watch) -- [naver-wcslog](#naver-wcslog) -- [noeval](#noeval) -- [pardot-1.0](#pardot-1.0) -- [prebid-ads](#prebid-ads) -- [prebid](#prebid) -- [prevent-bab](#prevent-bab) -- [prevent-bab2](#prevent-bab2) -- [prevent-fab-3.2.0](#prevent-fab-3.2.0) -- [prevent-popads-net](#prevent-popads-net) -- [scorecardresearch-beacon](#scorecardresearch-beacon) -- [set-popads-dummy](#set-popads-dummy) -- [click2load.html](#click2load.html) - -* * * - -## ⚡️ 1x1-transparent.gif - -> Added in v1.0.4. - -### Examples - -```adblock +## Available Redirect resources +* [1x1-transparent.gif](#1x1-transparent.gif) +* [2x2-transparent.png](#2x2-transparent.png) +* [3x2-transparent.png](#3x2-transparent.png) +* [32x32-transparent.png](#32x32-transparent.png) +* [noopframe](#noopframe) +* [noopcss](#noopcss) +* [noopjs](#noopjs) +* [noopjson](#noopjson) +* [nooptext](#nooptext) +* [empty](#empty) +* [noopvmap-1.0](#noopvmap-1.0) +* [noopvast-2.0](#noopvast-2.0) +* [noopvast-3.0](#noopvast-3.0) +* [noopvast-4.0](#noopvast-4.0) +* [noopmp3-0.1s](#noopmp3-0.1s) +* [noopmp4-1s](#noopmp4-1s) +* [amazon-apstag](#amazon-apstag) +* [ati-smarttag](#ati-smarttag) +* [didomi-loader](#didomi-loader) +* [fingerprintjs2](#fingerprintjs2) +* [fingerprintjs3](#fingerprintjs3) +* [gemius](#gemius) +* [google-analytics-ga](#google-analytics-ga) +* [google-analytics](#google-analytics) +* [google-ima3](#google-ima3) +* [googlesyndication-adsbygoogle](#googlesyndication-adsbygoogle) +* [googletagservices-gpt](#googletagservices-gpt) +* [matomo](#matomo) +* [metrika-yandex-tag](#metrika-yandex-tag) +* [metrika-yandex-watch](#metrika-yandex-watch) +* [naver-wcslog](#naver-wcslog) +* [noeval](#noeval) +* [pardot-1.0](#pardot-1.0) +* [prebid-ads](#prebid-ads) +* [prebid](#prebid) +* [prevent-bab](#prevent-bab) +* [prevent-bab2](#prevent-bab2) +* [prevent-fab-3.2.0](#prevent-fab-3.2.0) +* [prevent-popads-net](#prevent-popads-net) +* [scorecardresearch-beacon](#scorecardresearch-beacon) +* [set-popads-dummy](#set-popads-dummy) +* [click2load.html](#click2load.html) +* * * +### ⚡️ 1x1-transparent.gif +**Example** +``` ||example.org^$image,redirect=1x1-transparent.gif ``` - [Redirect source](../src/redirects/static-redirects.yml) - * * * -## ⚡️ 2x2-transparent.png - -> Added in v1.0.4. - -### Examples - -```adblock +### ⚡️ 2x2-transparent.png +**Example** +``` ||example.org^$image,redirect=2x2-transparent.png ``` - [Redirect source](../src/redirects/static-redirects.yml) - * * * -## ⚡️ 3x2-transparent.png - -> Added in v1.0.4. - -### Examples - -```adblock +### ⚡️ 3x2-transparent.png +**Example** +``` ||example.org^$image,redirect=3x2-transparent.png ``` - [Redirect source](../src/redirects/static-redirects.yml) - * * * -## ⚡️ 32x32-transparent.png - -> Added in v1.0.4. - -### Examples - -```adblock +### ⚡️ 32x32-transparent.png +**Example** +``` ||example.org^$image,redirect=32x32-transparent.png ``` - [Redirect source](../src/redirects/static-redirects.yml) - * * * -## ⚡️ noopframe - -> Added in v1.0.4. - -### Examples - -```adblock +### ⚡️ noopframe +**Example** +``` ||example.com^$subdocument,redirect=noopframe,domain=example.org ``` - [Redirect source](../src/redirects/static-redirects.yml) - * * * -## ⚡️ noopcss - -> Added in v1.0.4. - -### Examples - -```adblock +### ⚡️ noopcss +**Example** +``` ||example.org/style.css$stylesheet,redirect=noopcss ``` - [Redirect source](../src/redirects/static-redirects.yml) - * * * -## ⚡️ noopjs - -> Added in v1.0.4. - -### Examples - -```adblock +### ⚡️ noopjs +**Example** +``` ||example.org/advert.js$script,redirect=noopjs ``` - [Redirect source](../src/redirects/static-redirects.yml) - * * * -## ⚡️ noopjson - -> Added in v1.6.2. - -### Examples - -```adblock +### ⚡️ noopjson +**Example** +``` ||example.org/geo/location$xmlhttprequest,redirect=noopjson ``` - [Redirect source](../src/redirects/static-redirects.yml) - * * * -## ⚡️ nooptext - -> Added in v1.0.4. - -### Examples - -```adblock +### ⚡️ nooptext +**Example** +``` ||example.org/advert.js$xmlhttprequest,redirect=nooptext ``` - [Redirect source](../src/redirects/static-redirects.yml) - * * * -## ⚡️ empty - -> Added in v1.3.9. - -Pretty much the same as `nooptext`. Used for conversion of modifier `empty` -so better avoid its using in prod versions of filter lists. - -### Examples +### ⚡️ empty +Pretty much the same as `nooptext`. Used for conversion of modifier `empty` so better avoid its using in production filter lists. -```adblock +**Example** +``` ||example.org/log$redirect=empty ``` - [Redirect source](../src/redirects/static-redirects.yml) - * * * -## ⚡️ noopvmap-1.0 - -> Added in v1.1.5. - +### ⚡️ noopvmap-1.0 Redirects request to an empty VMAP response. -### Examples - -```adblock +**Example** +``` ||example.org/vmap01.xml$xmlhttprequest,redirect=noopvmap-1.0 ``` - [Redirect source](../src/redirects/static-redirects.yml) - * * * -## ⚡️ noopvast-2.0 - -> Added in v1.0.10. - +### ⚡️ noopvast-2.0 Redirects request to an empty VAST 2.0 response. -### Examples - -```adblock +**Example** +``` ||example.org/vast02.xml^$xmlhttprequest,redirect=noopvast-2.0 ``` - [Redirect source](../src/redirects/static-redirects.yml) - * * * -## ⚡️ noopvast-3.0 - -> Added in v1.0.10. - +### ⚡️ noopvast-3.0 Redirects request to an empty VAST 3.0 response. -### Examples - -```adblock +**Example** +``` ||example.org/vast03.xml^$xmlhttprequest,redirect=noopvast-3.0 ``` - [Redirect source](../src/redirects/static-redirects.yml) - * * * -## ⚡️ noopvast-4.0 - -> Added in v1.4.3. - +### ⚡️ noopvast-4.0 Redirects request to an empty VAST 4.0 response. -### Examples - -```adblock +**Example** +``` ||example.org/vast04.xml^$xmlhttprequest,redirect=noopvast-4.0 ``` - [Redirect source](../src/redirects/static-redirects.yml) - * * * -## ⚡️ noopmp3-0.1s - -> Added in v1.0.4. - -### Examples - -```adblock +### ⚡️ noopmp3-0.1s +**Example** +``` ||example.org/advert.mp3$media,redirect=noopmp3-0.1s ``` - [Redirect source](../src/redirects/static-redirects.yml) - * * * -## ⚡️ noopmp4-1s - -> Added in v1.0.4. - -### Examples - -```adblock +### ⚡️ noopmp4-1s +**Example** +``` ||example.org/advert.mp4$media,redirect=noopmp4-1s ``` - [Redirect source](../src/redirects/static-redirects.yml) - * * * -## ⚡️ amazon-apstag - -> Added in v1.2.3. +### ⚡️ amazon-apstag Mocks Amazon's apstag.js Related UBO redirect resource: -https://github.com/gorhill/uBlock/blob/master/src/web_accessible_resources/amazon_apstag.js +https://github.com/gorhill/uBlock/blob/f842ab6d3c1cf0394f95d27092bf59627262da40/src/web_accessible_resources/amazon_apstag.js -### Examples - -```adblock +**Example** +``` ||amazon-adsystem.com/aax2/apstag.js$script,redirect=amazon-apstag ``` [Redirect source](../src/redirects/amazon-apstag.js) - * * * -## ⚡️ ati-smarttag - -> Added in v1.5.0. +### ⚡️ ati-smarttag Mocks AT Internat SmartTag. https://developers.atinternet-solutions.com/as2-tagging-en/javascript-en/getting-started-javascript-en/tracker-initialisation-javascript-en/ -### Examples - -```adblock -||example.com/assets/scripts/smarttag.js$script,redirect=ati-smarttag +**Example** +``` +||bloctel.gouv.fr/assets/scripts/smarttag.js$script,redirect=ati-smarttag ``` [Redirect source](../src/redirects/ati-smarttag.js) - * * * -## ⚡️ didomi-loader - -> Added in v1.6.2. +### ⚡️ didomi-loader Mocks Didomi's CMP loader script. https://developers.didomi.io/ -### Examples - -```adblock +**Example** +``` ||sdk.privacy-center.org/fbf86806f86e/loader.js$script,redirect=didomi-loader ``` [Redirect source](../src/redirects/didomi-loader.js) - * * * -## ⚡️ fingerprintjs2 - -> Added in v1.5.0. +### ⚡️ fingerprintjs2 Mocks FingerprintJS v2 https://github.com/fingerprintjs @@ -343,19 +229,15 @@ https://github.com/fingerprintjs Related UBO redirect resource: https://github.com/gorhill/uBlock/blob/master/src/web_accessible_resources/fingerprint2.js -### Examples - -```adblock -||example.com/modules/js/lib/fgp/fingerprint2.js$script,redirect=fingerprintjs2 +**Example** +``` +||the-japan-news.com/modules/js/lib/fgp/fingerprint2.js$script,redirect=fingerprintjs2 ``` [Redirect source](../src/redirects/fingerprintjs2.js) - * * * -## ⚡️ fingerprintjs3 - -> Added in v1.6.2. +### ⚡️ fingerprintjs3 Mocks FingerprintJS v3 https://github.com/fingerprintjs @@ -363,197 +245,152 @@ https://github.com/fingerprintjs Related UBO redirect resource: https://github.com/gorhill/uBlock/blob/master/src/web_accessible_resources/fingerprint3.js -### Examples - -```adblock -||example.com/js/ufe/isomorphic/thirdparty/fp.min.js$script,redirect=fingerprintjs3 +**Example** +``` +||sephora.com/js/ufe/isomorphic/thirdparty/fp.min.js$script,redirect=fingerprintjs3 ``` [Redirect source](../src/redirects/fingerprintjs3.js) - * * * -## ⚡️ gemius - -> Added in v1.5.0. +### ⚡️ gemius Mocks Gemius Analytics. https://flowplayer.com/developers/plugins/gemius -### Examples - -```adblock -||example.org/gplayer.js$script,redirect=gemius +**Example** +``` +||gapt.hit.gemius.pl/gplayer.js$script,redirect=gemius ``` [Redirect source](../src/redirects/gemius.js) - * * * -## ⚡️ google-analytics-ga - -> Added in v1.0.10. +### ⚡️ google-analytics-ga Mocks old Google Analytics API. Related UBO redirect resource: -https://github.com/gorhill/uBlock/blob/master/src/web_accessible_resources/google-analytics_ga.js - -### Examples +https://github.com/gorhill/uBlock/blob/a94df7f3b27080ae2dcb3b914ace39c0c294d2f6/src/web_accessible_resources/google-analytics_ga.js -```adblock +**Example** +``` ||google-analytics.com/ga.js$script,redirect=google-analytics-ga ``` [Redirect source](../src/redirects/google-analytics-ga.js) - * * * -## ⚡️ google-analytics - -> Added in v1.0.10. +### ⚡️ google-analytics Mocks Google's Analytics and Tag Manager APIs. -Covers functionality of -the [obsolete googletagmanager-gtm redirect](https://github.com/AdguardTeam/Scriptlets/issues/127). +[Covers obsolete googletagmanager-gtm redirect functionality](https://github.com/AdguardTeam/Scriptlets/issues/127). Related UBO redirect resource: -https://github.com/gorhill/uBlock/blob/master/src/web_accessible_resources/google-analytics_analytics.js +https://github.com/gorhill/uBlock/blob/8cd2a1d263a96421487b39040c1d23eb01169484/src/web_accessible_resources/google-analytics_analytics.js -### Examples - -```adblock +**Example** +``` ||google-analytics.com/analytics.js$script,redirect=google-analytics -||googletagmanager.com/gtm.js$script,redirect=google-analytics +||googletagmanager.com/gtm.js$script,redirect=googletagmanager-gtm ``` [Redirect source](../src/redirects/google-analytics.js) - * * * -## ⚡️ google-ima3 - -> Added in v1.6.2. +### ⚡️ google-ima3 Mocks the IMA SDK of Google. -### Examples - -```adblock +**Example** +``` ||imasdk.googleapis.com/js/sdkloader/ima3.js$script,redirect=google-ima3 ``` [Redirect source](../src/redirects/google-ima3.js) - * * * -## ⚡️ googlesyndication-adsbygoogle - -> Added in v1.0.10. +### ⚡️ googlesyndication-adsbygoogle Mocks Google AdSense API. Related UBO redirect resource: -https://github.com/gorhill/uBlock/blob/master/src/web_accessible_resources/googlesyndication_adsbygoogle.js - -### Examples +https://github.com/gorhill/uBlock/blob/a94df7f3b27080ae2dcb3b914ace39c0c294d2f6/src/web_accessible_resources/googlesyndication_adsbygoogle.js -```adblock +**Example** +``` ||pagead2.googlesyndication.com/pagead/js/adsbygoogle.js$script,redirect=googlesyndication-adsbygoogle ``` [Redirect source](../src/redirects/googlesyndication-adsbygoogle.js) - * * * -## ⚡️ googletagservices-gpt - -> Added in v1.0.10. +### ⚡️ googletagservices-gpt Mocks Google Publisher Tag API. Related UBO redirect resource: -https://github.com/gorhill/uBlock/blob/master/src/web_accessible_resources/googletagservices_gpt.js - -### Examples +https://github.com/gorhill/uBlock/blob/a94df7f3b27080ae2dcb3b914ace39c0c294d2f6/src/web_accessible_resources/googletagservices_gpt.js -```adblock +**Example** +``` ||googletagservices.com/tag/js/gpt.js$script,redirect=googletagservices-gpt ``` [Redirect source](../src/redirects/googletagservices-gpt.js) - * * * -## ⚡️ matomo - -> Added in v1.5.0. +### ⚡️ matomo Mocks the piwik.js file of Matomo (formerly Piwik). -### Examples - -```adblock +**Example** +``` ||example.org/piwik.js$script,redirect=matomo ``` [Redirect source](../src/redirects/matomo.js) - * * * -## ⚡️ metrika-yandex-tag - -> Added in v1.0.10. +### ⚡️ metrika-yandex-tag Mocks Yandex Metrika API. https://yandex.ru/support/metrica/objects/method-reference.html -### Examples - -```adblock +**Example** +``` ||mc.yandex.ru/metrika/tag.js$script,redirect=metrika-yandex-tag ``` [Redirect source](../src/redirects/metrika-yandex-tag.js) - * * * -## ⚡️ metrika-yandex-watch - -> Added in v1.0.10. +### ⚡️ metrika-yandex-watch Mocks the old Yandex Metrika API. https://yandex.ru/support/metrica/objects/_method-reference.html -### Examples - -```adblock +**Example** +``` ||mc.yandex.ru/metrika/watch.js$script,redirect=metrika-yandex-watch ``` [Redirect source](../src/redirects/metrika-yandex-watch.js) - * * * -## ⚡️ naver-wcslog - -> Added in v1.6.2. +### ⚡️ naver-wcslog Mocks wcslog.js of Naver Analytics. -### Examples - -```adblock +**Example** +``` ||wcs.naver.net/wcslog.js$script,redirect=naver-wcslog ``` [Redirect source](../src/redirects/naver-wcslog.js) - * * * -## ⚡️ noeval - -> Added in v1.0.4. +### ⚡️ noeval Redirects request to the source which sets static properties to PopAds and popns objects. @@ -566,74 +403,57 @@ See [scriptlet description](../wiki/about-scriptlets.md#noeval). Related UBO redirect resource: https://github.com/gorhill/uBlock/wiki/Resources-Library#noeval-silentjs- -### Examples - -```adblock +**Example** +``` ||example.org/index.js$script,redirect=noeval ``` [Redirect source](../src/redirects/noeval.js) - * * * -## ⚡️ pardot-1.0 - -> Added in v1.6.55. +### ⚡️ pardot-1.0 Mocks the pd.js file of Salesforce. https://pi.pardot.com/pd.js https://developer.salesforce.com/docs/marketing/pardot/overview -### Examples - -```adblock +**Example** +``` ||pi.pardot.com/pd.js$script,redirect=pardot ||pacedg.com.au/pd.js$redirect=pardot ``` [Redirect source](../src/redirects/pardot-1.0.js) - * * * -## ⚡️ prebid-ads - -> Added in v1.6.2. +### ⚡️ prebid-ads Sets predefined constants on a page: - - `canRunAds`: `true` - `isAdBlockActive`: `false` -### Examples - -```adblock -||example.org/assets/js/prebid-ads.js$script,redirect=prebid-ads +**Example** +``` +||playerdrive.me/assets/js/prebid-ads.js$script,redirect=prebid-ads ``` [Redirect source](../src/redirects/prebid-ads.js) - * * * -## ⚡️ prebid - -> Added in v1.6.2. +### ⚡️ prebid Mocks the prebid.js header bidding suit. https://docs.prebid.org/ -### Examples - -```adblock -||example.org/bd/hb/prebid.js$script,redirect=prebid +**Example** +``` +||tmgrup.com.tr/bd/hb/prebid.js$script,redirect=prebid ``` [Redirect source](../src/redirects/prebid.js) - * * * -## ⚡️ prevent-bab - -> Added in v1.3.19. +### ⚡️ prevent-bab Prevents BlockAdblock script from detecting an ad blocker. @@ -641,21 +461,17 @@ Mostly it is used as `scriptlet`. See [scriptlet description](../wiki/about-scriptlets.md#prevent-bab). Related UBO redirect resource: -https://github.com/gorhill/uBlock/blob/master/src/web_accessible_resources/nobab.js - -### Examples +https://github.com/gorhill/uBlock/blob/a94df7f3b27080ae2dcb3b914ace39c0c294d2f6/src/web_accessible_resources/nobab.js -```adblock +**Example** +``` /blockadblock.$script,redirect=prevent-bab ``` [Redirect source](../src/redirects/prevent-bab.js) - * * * -## ⚡️ prevent-bab2 - -> Added in v1.5.0. +### ⚡️ prevent-bab2 Prevents BlockAdblock script from detecting an ad blocker. @@ -664,99 +480,75 @@ https://github.com/gorhill/uBlock/blob/master/src/web_accessible_resources/nobab See [redirect description](../wiki/about-redirects.md#prevent-bab2). -### Examples - -```adblock +**Syntax** +``` /blockadblock.$script,redirect=prevent-bab2 ``` [Redirect source](../src/redirects/prevent-bab2.js) - * * * -## ⚡️ prevent-fab-3.2.0 - -> Added in v1.0.4. +### ⚡️ prevent-fab-3.2.0 Redirects fuckadblock script to the source js file. -### Examples - -```adblock +**Example** +``` \*\/fuckadblock-$script,redirect=prevent-fab-3.2.0 ``` [Redirect source](../src/redirects/prevent-fab-3.2.0.js) - * * * -## ⚡️ prevent-popads-net - -> Added in v1.0.4. +### ⚡️ prevent-popads-net Redirects request to the source which sets static properties to PopAds and popns objects. -### Examples - -```adblock +**Example** +``` ||popads.net/pop.js$script,redirect=prevent-popads-net ``` [Redirect source](../src/redirects/prevent-popads-net.js) - * * * -## ⚡️ scorecardresearch-beacon - -> Added in v1.0.10. +### ⚡️ scorecardresearch-beacon Mocks Scorecard Research API. Related UBO redirect resource: -https://github.com/gorhill/uBlock/blob/master/src/web_accessible_resources/scorecardresearch_beacon.js - -### Examples +https://github.com/gorhill/uBlock/blob/a94df7f3b27080ae2dcb3b914ace39c0c294d2f6/src/web_accessible_resources/scorecardresearch_beacon.js -```adblock +**Example** +``` ||sb.scorecardresearch.com/beacon.js$script,redirect=scorecardresearch-beacon ``` [Redirect source](../src/redirects/scorecardresearch-beacon.js) - * * * -## ⚡️ set-popads-dummy - -> Added in v1.0.4. +### ⚡️ set-popads-dummy Redirects request to the source which sets static properties to PopAds and popns objects. -### Examples - -```adblock +**Example** +``` ||popads.net^$script,redirect=set-popads-dummy,domain=example.org ``` [Redirect source](../src/redirects/set-popads-dummy.js) - * * * -## ⚡️ click2load.html - -> Added in v1.5.0. - +### ⚡️ click2load.html Redirects resource and replaces supposed content by decoy frame with button for original content recovering Related UBO redirect resource: https://github.com/gorhill/uBlock/blob/1.31.0/src/web_accessible_resources/click2load.html -### Example - -```adblock +**Example** +``` ||youtube.com/embed/$frame,third-party,redirect=click2load.html ``` - [Redirect source](../src/redirects/blocking-redirects/click2load.html) - * * * diff --git a/wiki/about-scriptlets.md b/wiki/about-scriptlets.md index 72cddf89f..687395125 100644 --- a/wiki/about-scriptlets.md +++ b/wiki/about-scriptlets.md @@ -1,62 +1,55 @@ -# Available Scriptlets - -- [abort-current-inline-script](#abort-current-inline-script) -- [abort-on-property-read](#abort-on-property-read) -- [abort-on-property-write](#abort-on-property-write) -- [abort-on-stack-trace](#abort-on-stack-trace) -- [adjust-setInterval](#adjust-setinterval) -- [adjust-setTimeout](#adjust-settimeout) -- [close-window](#close-window) -- [debug-current-inline-script](#debug-current-inline-script) -- [debug-on-property-read](#debug-on-property-read) -- [debug-on-property-write](#debug-on-property-write) -- [dir-string](#dir-string) -- [disable-newtab-links](#disable-newtab-links) -- [hide-in-shadow-dom](#hide-in-shadow-dom) -- [inject-css-in-shadow-dom](#inject-css-in-shadow-dom) -- [json-prune](#json-prune) -- [log-addEventListener](#log-addeventlistener) -- [log-eval](#log-eval) -- [log-on-stack-trace](#log-on-stack-trace) -- [log](#log) -- [m3u-prune](#m3u-prune) -- [no-topics](#no-topics) -- [noeval](#noeval) -- [nowebrtc](#nowebrtc) -- [prevent-addEventListener](#prevent-addeventlistener) -- [prevent-adfly](#prevent-adfly) -- [prevent-bab](#prevent-bab) -- [prevent-element-src-loading](#prevent-element-src-loading) -- [prevent-eval-if](#prevent-eval-if) -- [prevent-fab-3.2.0](#prevent-fab-3.2.0) -- [prevent-fetch](#prevent-fetch) -- [prevent-popads-net](#prevent-popads-net) -- [prevent-refresh](#prevent-refresh) -- [prevent-requestAnimationFrame](#prevent-requestanimationframe) -- [prevent-setInterval](#prevent-setinterval) -- [prevent-setTimeout](#prevent-settimeout) -- [prevent-window-open](#prevent-window-open) -- [prevent-xhr](#prevent-xhr) -- [remove-attr](#remove-attr) -- [remove-class](#remove-class) -- [remove-cookie](#remove-cookie) -- [remove-in-shadow-dom](#remove-in-shadow-dom) -- [remove-node-text](#remove-node-text) -- [set-attr](#set-attr) -- [set-constant](#set-constant) -- [set-cookie-reload](#set-cookie-reload) -- [set-cookie](#set-cookie) -- [set-local-storage-item](#set-local-storage-item) -- [set-popads-dummy](#set-popads-dummy) -- [set-session-storage-item](#set-session-storage-item) -- [xml-prune](#xml-prune) -- [trusted-replace-node-text](#trusted-replace-node-text) - +## Available Scriptlets +* [abort-current-inline-script](#abort-current-inline-script) +* [abort-on-property-read](#abort-on-property-read) +* [abort-on-property-write](#abort-on-property-write) +* [abort-on-stack-trace](#abort-on-stack-trace) +* [adjust-setInterval](#adjust-setinterval) +* [adjust-setTimeout](#adjust-settimeout) +* [close-window](#close-window) +* [debug-current-inline-script](#debug-current-inline-script) +* [debug-on-property-read](#debug-on-property-read) +* [debug-on-property-write](#debug-on-property-write) +* [dir-string](#dir-string) +* [disable-newtab-links](#disable-newtab-links) +* [hide-in-shadow-dom](#hide-in-shadow-dom) +* [inject-css-in-shadow-dom](#inject-css-in-shadow-dom) +* [json-prune](#json-prune) +* [log-addEventListener](#log-addeventlistener) +* [log-eval](#log-eval) +* [log-on-stack-trace](#log-on-stack-trace) +* [log](#log) +* [m3u-prune](#m3u-prune) +* [no-topics](#no-topics) +* [noeval](#noeval) +* [nowebrtc](#nowebrtc) +* [prevent-addEventListener](#prevent-addeventlistener) +* [prevent-adfly](#prevent-adfly) +* [prevent-bab](#prevent-bab) +* [prevent-element-src-loading](#prevent-element-src-loading) +* [prevent-eval-if](#prevent-eval-if) +* [prevent-fab-3.2.0](#prevent-fab-3.2.0) +* [prevent-fetch](#prevent-fetch) +* [prevent-popads-net](#prevent-popads-net) +* [prevent-refresh](#prevent-refresh) +* [prevent-requestAnimationFrame](#prevent-requestanimationframe) +* [prevent-setInterval](#prevent-setinterval) +* [prevent-setTimeout](#prevent-settimeout) +* [prevent-window-open](#prevent-window-open) +* [prevent-xhr](#prevent-xhr) +* [remove-attr](#remove-attr) +* [remove-class](#remove-class) +* [remove-cookie](#remove-cookie) +* [remove-in-shadow-dom](#remove-in-shadow-dom) +* [set-attr](#set-attr) +* [set-constant](#set-constant) +* [set-cookie-reload](#set-cookie-reload) +* [set-cookie](#set-cookie) +* [set-local-storage-item](#set-local-storage-item) +* [set-popads-dummy](#set-popads-dummy) +* [set-session-storage-item](#set-session-storage-item) +* [xml-prune](#xml-prune) * * * - -## ⚡️ abort-current-inline-script - -> Added in v1.0.4. +### ⚡️ abort-current-inline-script Aborts an inline script when it attempts to **read** or **write to** the specified property AND when the contents of the ` ``` -1. Aborts inline scripts which are trying to access `window.alert` and match regexp `/Hello.+world/` - - ```adblock +3. Aborts inline scripts which are trying to access `window.alert` and match this regexp: `/Hello.+world/`. + ``` example.org#%#//scriptlet('abort-current-inline-script', 'alert', '/Hello.+world/') ``` For instance, the following scripts will be aborted: - ```html ``` - ```html ``` - And this script will not be aborted: - + This script will not be aborted: ```html ``` [Scriptlet source](../src/scriptlets/abort-current-inline-script.js) - * * * -## ⚡️ abort-on-property-read - -> Added in v1.0.4. +### ⚡️ abort-on-property-read Aborts a script when it attempts to **read** the specified property. @@ -138,19 +120,17 @@ Related UBO scriptlet: https://github.com/gorhill/uBlock/wiki/Resources-Library#abort-on-property-readjs- Related ABP source: -https://gitlab.com/eyeo/snippets/-/blob/main/source/behavioral/abort-on-property-read.js +https://github.com/adblockplus/adblockpluscore/blob/6b2a309054cc23432102b85d13f12559639ef495/lib/content/snippets.js#L864 -### Syntax - -```text +**Syntax** +``` example.org#%#//scriptlet('abort-on-property-read', property) ``` - `property` — required, path to a property (joined with `.` if needed). The property must be attached to `window` -### Examples - -```adblock +**Examples** +``` ! Aborts script when it tries to access `window.alert` example.org#%#//scriptlet('abort-on-property-read', 'alert') @@ -159,12 +139,9 @@ example.org#%#//scriptlet('abort-on-property-read', 'navigator.language') ``` [Scriptlet source](../src/scriptlets/abort-on-property-read.js) - * * * -## ⚡️ abort-on-property-write - -> Added in v1.0.4. +### ⚡️ abort-on-property-write Aborts a script when it attempts to **write** the specified property. @@ -172,41 +149,33 @@ Related UBO scriptlet: https://github.com/gorhill/uBlock/wiki/Resources-Library#abort-on-property-writejs- Related ABP source: -https://gitlab.com/eyeo/snippets/-/blob/main/source/behavioral/abort-on-property-write.js - -### Syntax +https://github.com/adblockplus/adblockpluscore/blob/6b2a309054cc23432102b85d13f12559639ef495/lib/content/snippets.js#L896 -```text +**Syntax** +``` example.org#%#//scriptlet('abort-on-property-write', property) ``` -- `property` — required, path to a property (joined with `.` if needed). - The property must be attached to `window` - -### Examples +- `property` — required, path to a property (joined with `.` if needed). The property must be attached to `window` -```adblock +**Examples** +``` ! Aborts script when it tries to set `window.adblock` value example.org#%#//scriptlet('abort-on-property-write', 'adblock') ``` [Scriptlet source](../src/scriptlets/abort-on-property-write.js) - * * * -## ⚡️ abort-on-stack-trace +### ⚡️ abort-on-stack-trace -> Added in v1.5.0. - -Aborts a script when it attempts to utilize (read or write to) the specified property -and it's error stack trace contains given value. +Aborts a script when it attempts to utilize (read or write to) the specified property and it's error stack trace contains given value. Related UBO scriptlet: https://github.com/gorhill/uBlock-for-firefox-legacy/commit/7099186ae54e70b588d5e99554a05d783cabc8ff -### Syntax - -```text +**Syntax** +``` example.com#%#//scriptlet('abort-on-stack-trace', property, stack) ``` @@ -216,203 +185,152 @@ example.com#%#//scriptlet('abort-on-stack-trace', property, stack) - `inlineScript` - `injectedScript` -### Examples - -1. Aborts script when it tries to access `window.Ya` and it's error stack trace contains `test.js` - - ```adblock - example.org#%#//scriptlet('abort-on-stack-trace', 'Ya', 'test.js') - ``` - -1. Aborts script when it tries to access `window.Ya.videoAd` and it's error stack trace contains `test.js` - - ```adblock - example.org#%#//scriptlet('abort-on-stack-trace', 'Ya.videoAd', 'test.js') - ``` - -1. Aborts script when stack trace matches with any of these parameters - - ```adblock - example.org#%#//scriptlet('abort-on-stack-trace', 'Ya', 'yandexFuncName') - example.org#%#//scriptlet('abort-on-stack-trace', 'Ya', 'yandexScriptName') - ``` +**Examples** +``` +! Aborts script when it tries to access `window.Ya` and it's error stack trace contains `test.js` +example.org#%#//scriptlet('abort-on-stack-trace', 'Ya', 'test.js') -1. Aborts script when it tries to access `window.Ya` and it's an inline script +! Aborts script when it tries to access `window.Ya.videoAd` and it's error stack trace contains `test.js` +example.org#%#//scriptlet('abort-on-stack-trace', 'Ya.videoAd', 'test.js') - ```adblock - example.org#%#//scriptlet('abort-on-stack-trace', 'Ya', 'inlineScript') - ``` +! Aborts script when stack trace matches with any of these parameters +example.org#%#//scriptlet('abort-on-stack-trace', 'Ya', 'yandexFuncName') +example.org#%#//scriptlet('abort-on-stack-trace', 'Ya', 'yandexScriptName') -1. Aborts script when it tries to access `window.Ya` and it's an injected script +! Aborts script when it tries to access `window.Ya` and it's an inline script +example.org#%#//scriptlet('abort-on-stack-trace', 'Ya', 'inlineScript') - ```adblock - example.org#%#//scriptlet('abort-on-stack-trace', 'Ya', 'injectedScript') - ``` +! Aborts script when it tries to access `window.Ya` and it's an injected script +example.org#%#//scriptlet('abort-on-stack-trace', 'Ya', 'injectedScript') +``` [Scriptlet source](../src/scriptlets/abort-on-stack-trace.js) - * * * -## ⚡️ adjust-setInterval - -> Added in v1.0.4. +### ⚡️ adjust-setInterval Adjusts delay for specified setInterval() callbacks. Related UBO scriptlet: https://github.com/gorhill/uBlock/wiki/Resources-Library#nano-setinterval-boosterjs- -### Syntax - -```text +**Syntax** +``` example.org#%#//scriptlet('adjust-setInterval'[, matchCallback [, matchDelay[, boost]]]) ``` - `matchCallback` — optional, string or regular expression for stringified callback matching; - defaults to match all callbacks; invalid regular expression will cause exit and rule will not work +defaults to match all callbacks; invalid regular expression will cause exit and rule will not work - `matchDelay` — optional, defaults to 1000, matching setInterval delay; decimal integer OR '*' for any delay -- `boost` — optional, default to 0.05, float, - capped at 1000 times for up and 50 for down (0.001...50), setInterval delay multiplier - -### Examples +- `boost` — optional, default to 0.05, float, capped at 1000 times for up and 50 for down (0.001...50), setInterval delay multiplier -1. Adjust all setInterval() x20 times where delay equal 1000ms - - ```adblock +**Examples** +1. Adjust all setInterval() x20 times where delay equal 1000ms: + ``` example.org#%#//scriptlet('adjust-setInterval') ``` -1. Adjust all setInterval() x20 times where callback matched with `example` and delay equal 1000ms - - ```adblock +2. Adjust all setInterval() x20 times where callback matched with `example` and delay equal 1000ms + ``` example.org#%#//scriptlet('adjust-setInterval', 'example') ``` -1. Adjust all setInterval() x20 times where callback matched with `example` and delay equal 400ms - - ```adblock +3. Adjust all setInterval() x20 times where callback matched with `example` and delay equal 400ms + ``` example.org#%#//scriptlet('adjust-setInterval', 'example', '400') ``` -1. Slow down setInterval() x2 times where callback matched with `example` and delay equal 1000ms - - ```adblock +4. Slow down setInterval() x2 times where callback matched with `example` and delay equal 1000ms + ``` example.org#%#//scriptlet('adjust-setInterval', 'example', '', '2') ``` - -1. Adjust all setInterval() x50 times where delay equal 2000ms - - ```adblock +5. Adjust all setInterval() x50 times where delay equal 2000ms + ``` example.org#%#//scriptlet('adjust-setInterval', '', '2000', '0.02') ``` - -1. Adjust all setInterval() x1000 times where delay equal 2000ms - - ```adblock +6. Adjust all setInterval() x1000 times where delay equal 2000ms + ``` example.org#%#//scriptlet('adjust-setInterval', '', '2000', '0.001') ``` - -1. Adjust all setInterval() x50 times where delay is randomized - - ```adblock +7. Adjust all setInterval() x50 times where delay is randomized + ``` example.org#%#//scriptlet('adjust-setInterval', '', '*', '0.02') ``` [Scriptlet source](../src/scriptlets/adjust-setInterval.js) - * * * -## ⚡️ adjust-setTimeout - -> Added in v1.0.4. +### ⚡️ adjust-setTimeout Adjusts delay for specified setTimeout() callbacks. Related UBO scriptlet: https://github.com/gorhill/uBlock/wiki/Resources-Library#nano-settimeout-boosterjs- -### Syntax - -```text +**Syntax** +``` example.org#%#//scriptlet('adjust-setTimeout'[, matchCallback [, matchDelay[, boost]]]) ``` - `matchCallback` — optional, string or regular expression for stringified callback matching; - defaults to match all callbacks; invalid regular expression will cause exit and rule will not work +defaults to match all callbacks; invalid regular expression will cause exit and rule will not work - `matchDelay` — optional, defaults to 1000, matching setTimeout delay; decimal integer OR '*' for any delay -- `boost` — optional, default to 0.05, float, - capped at 1000 times for up and 50 for down (0.001...50), setTimeout delay multiplier - -### Examples +- `boost` — optional, default to 0.05, float, capped at 1000 times for up and 50 for down (0.001...50), setTimeout delay multiplier -1. Adjust all setTimeout() x20 times where timeout equal 1000ms - - ```adblock +**Examples** +1. Adjust all setTimeout() x20 times where timeout equal 1000ms: + ``` example.org#%#//scriptlet('adjust-setTimeout') ``` -1. Adjust all setTimeout() x20 times where callback matched with `example` and timeout equal 1000ms - - ```adblock +2. Adjust all setTimeout() x20 times where callback matched with `example` and timeout equal 1000ms + ``` example.org#%#//scriptlet('adjust-setTimeout', 'example') ``` -1. Adjust all setTimeout() x20 times where callback matched with `example` and timeout equal 400ms - - ```adblock +3. Adjust all setTimeout() x20 times where callback matched with `example` and timeout equal 400ms + ``` example.org#%#//scriptlet('adjust-setTimeout', 'example', '400') ``` -1. Slow down setTimeout() x2 times where callback matched with `example` and timeout equal 1000ms - - ```adblock +4. Slow down setTimeout() x2 times where callback matched with `example` and timeout equal 1000ms + ``` example.org#%#//scriptlet('adjust-setTimeout', 'example', '', '2') ``` - -1. Adjust all setTimeout() x50 times where timeout equal 2000ms - - ```adblock +5. Adjust all setTimeout() x50 times where timeout equal 2000ms + ``` example.org#%#//scriptlet('adjust-setTimeout', '', '2000', '0.02') ``` - -1. Adjust all setTimeout() x1000 times where timeout equal 2000ms - - ```adblock +6. Adjust all setTimeout() x1000 times where timeout equal 2000ms + ``` example.org#%#//scriptlet('adjust-setTimeout', '', '2000', '0.001') ``` - -1. Adjust all setTimeout() x20 times where callback matched with `test` and timeout is randomized - - ```adblock +7. Adjust all setTimeout() x20 times where callback matched with `test` and timeout is randomized + ``` example.org#%#//scriptlet('adjust-setTimeout', 'test', '*') ``` [Scriptlet source](../src/scriptlets/adjust-setTimeout.js) - * * * -## ⚡️ close-window - -> Added in v1.5.0. +### ⚡️ close-window Closes the browser tab immediately. -> `window.close()` usage is restricted in the Chrome browser. -> In this case tab will only be closed when using AdGuard Browser extension. - -### Syntax +> `window.close()` usage is restricted in Chrome. In this case +tab will only be closed when using AdGuard browser extension. -```text +**Syntax** +``` example.org#%#//scriptlet('close-window'[, path]) ``` - `path` — optional, string or regular expression - matching the current location's path: `window.location.pathname` + `window.location.search`. - Defaults to execute on every page. +matching the current location's path: `window.location.pathname` + `window.location.search`. +Defaults to execute on every page. -### Examples - -```adblock +**Examples** +``` ! closes any example.org tab example.org#%#//scriptlet('close-window') @@ -421,75 +339,56 @@ example.org#%#//scriptlet('close-window', '/example-page.html') ``` [Scriptlet source](../src/scriptlets/close-window.js) - * * * -## ⚡️ debug-current-inline-script - -> Added in v1.0.4. +### ⚡️ debug-current-inline-script -This scriptlet is basically the same as [abort-current-inline-script](#abort-current-inline-script), -but instead of aborting it starts the debugger. +This scriptlet is basically the same as [abort-current-inline-script](#abort-current-inline-script), but instead of aborting it starts the debugger. -> It is not allowed for prod versions of filter lists. +**It is not supposed to be used in production filter lists!** -### Examples - -```adblock +**Syntax** +``` ! Aborts script when it tries to access `window.alert` example.org#%#//scriptlet('debug-current-inline-script', 'alert') ``` [Scriptlet source](../src/scriptlets/debug-current-inline-script.js) - * * * -## ⚡️ debug-on-property-read - -> Added in v1.0.4. - -This scriptlet is basically the same as [abort-on-property-read](#abort-on-property-read), -but instead of aborting it starts the debugger. +### ⚡️ debug-on-property-read -> It is not allowed for prod versions of filter lists. +This scriptlet is basically the same as [abort-on-property-read](#abort-on-property-read), but instead of aborting it starts the debugger. -### Examples +**It is not supposed to be used in production filter lists!** -```adblock +**Syntax** +``` ! Debug script if it tries to access `window.alert` example.org#%#//scriptlet('debug-on-property-read', 'alert') - -! or `window.open` +! of `window.open` example.org#%#//scriptlet('debug-on-property-read', 'open') ``` [Scriptlet source](../src/scriptlets/debug-on-property-read.js) - * * * -## ⚡️ debug-on-property-write - -> Added in v1.0.4. +### ⚡️ debug-on-property-write -This scriptlet is basically the same as [abort-on-property-write](#abort-on-property-write), -but instead of aborting it starts the debugger. +This scriptlet is basically the same as [abort-on-property-write](#abort-on-property-write), but instead of aborting it starts the debugger. -> It is not allowed for prod versions of filter lists. +**It is not supposed to be used in production filter lists!** -### Examples - -```adblock +**Syntax** +``` ! Aborts script when it tries to write in property `window.test` example.org#%#//scriptlet('debug-on-property-write', 'test') ``` [Scriptlet source](../src/scriptlets/debug-on-property-write.js) - * * * -## ⚡️ dir-string - -> Added in v1.0.4. +### ⚡️ dir-string Wraps the `console.dir` API to call the `toString` method of the argument. There are several adblock circumvention systems that detect browser devtools @@ -497,144 +396,120 @@ and hide themselves. Therefore, if we force them to think that devtools are open (using this scriptlet), it will automatically disable the adblock circumvention script. -### Syntax +Related ABP source: +https://github.com/adblockplus/adblockpluscore/blob/6b2a309054cc23432102b85d13f12559639ef495/lib/content/snippets.js#L766 -```text +**Syntax** +``` example.org#%#//scriptlet('dir-string'[, times]) ``` - - `times` — optional, the number of times to call the `toString` method of the argument to `console.dir` -### Examples - -```adblock +**Example** +``` ! Run 2 times example.org#%#//scriptlet('dir-string', '2') ``` [Scriptlet source](../src/scriptlets/dir-string.js) - * * * -## ⚡️ disable-newtab-links - -> Added in v1.0.4. +### ⚡️ disable-newtab-links Prevents opening new tabs and windows if there is `target` attribute in element. Related UBO scriptlet: https://github.com/gorhill/uBlock/wiki/Resources-Library#disable-newtab-linksjs- -### Syntax - -```adblock +**Syntax** +``` example.org#%#//scriptlet('disable-newtab-links') ``` [Scriptlet source](../src/scriptlets/disable-newtab-links.js) - * * * -## ⚡️ hide-in-shadow-dom - -> Added in v1.3.0. +### ⚡️ hide-in-shadow-dom Hides elements inside open shadow DOM elements. -### Syntax - -```text +**Syntax** +``` example.org#%#//scriptlet('hide-in-shadow-dom', selector[, baseSelector]) ``` - `selector` — required, CSS selector of element in shadow-dom to hide - `baseSelector` — optional, selector of specific page DOM element, - narrows down the part of the page DOM where shadow-dom host supposed to be, - defaults to document.documentElement - -> `baseSelector` should match element of the page DOM, but not of shadow DOM. +narrows down the part of the page DOM where shadow-dom host supposed to be, +defaults to document.documentElement -### Examples +> `baseSelector` should match element of the page DOM, but not of shadow DOM -```adblock +**Examples** +``` ! hides menu bar -example.com#%#//scriptlet('hide-in-shadow-dom', '.storyAd', '#app') +virustotal.com#%#//scriptlet('hide-in-shadow-dom', 'iron-pages', 'vt-virustotal-app') ! hides floating element -example.com#%#//scriptlet('hide-in-shadow-dom', '.contact-fab') +virustotal.com#%#//scriptlet('hide-in-shadow-dom', 'vt-ui-contact-fab') ``` [Scriptlet source](../src/scriptlets/hide-in-shadow-dom.js) - * * * -## ⚡️ inject-css-in-shadow-dom - -> Added in v1.8.2. +### ⚡️ inject-css-in-shadow-dom Injects CSS rule into selected Shadow DOM subtrees on a page -### Syntax - -```text +**Syntax** +``` example.org#%#//scriptlet('inject-css-in-shadow-dom', cssRule[, hostSelector]) ``` - `cssRule` — required, string representing a single css rule -- `hostSelector` — optional, string, selector to match shadow host elements. - CSS rule will be only applied to shadow roots inside these elements. - Defaults to injecting css rule into all available roots. - -### Examples +- `hostSelector` — optional, string, selector to match shadow host elements. CSS rule will be only applied to shadow roots inside these elements. +Defaults to injecting css rule into all available roots. +**Examples** 1. Apply style to all shadow dom subtrees +``` +example.org#%#//scriptlet('inject-css-in-shadow-dom', '#advertisement { display: none !important; }') +``` - ```adblock - example.org#%#//scriptlet('inject-css-in-shadow-dom', '#advertisement { display: none !important; }') - ``` - -1. Apply style to a specific shadow dom subtree - - ```adblock - example.org#%#//scriptlet('inject-css-in-shadow-dom', '#content { margin-top: 0 !important; }', '#banner') - ``` +2. Apply style to a specific shadow dom subtree +``` +example.org#%#//scriptlet('inject-css-in-shadow-dom', '#content { margin-top: 0 !important; }', '.row > #hidden') +``` [Scriptlet source](../src/scriptlets/inject-css-in-shadow-dom.js) - * * * -## ⚡️ json-prune - -> Added in v1.1.0. +### ⚡️ json-prune -Removes specified properties from the result of calling JSON.parse and returns the caller. +Removes specified properties from the result of calling JSON.parse and returns the caller Related UBO scriptlet: https://github.com/gorhill/uBlock/wiki/Resources-Library#json-prunejs- Related ABP source: -https://gitlab.com/eyeo/snippets/-/blob/main/source/behavioral/json-prune.js +https://github.com/adblockplus/adblockpluscore/blob/master/lib/content/snippets.js#L1285 -### Syntax - -```text +**Syntax** +``` example.org#%#//scriptlet('json-prune'[, propsToRemove [, obligatoryProps [, stack]]]) ``` - `propsToRemove` — optional, string of space-separated properties to remove -- `obligatoryProps` — optional, string of space-separated properties - which must be all present for the pruning to occur +- `obligatoryProps` — optional, string of space-separated properties which must be all present for the pruning to occur - `stack` — optional, string or regular expression that must match the current function call stack trace; - if regular expression is invalid it will be skipped +if regular expression is invalid it will be skipped -> Note please that you can use wildcard `*` for chain property name, -> e.g. `ad.*.src` instead of `ad.0.src ad.1.src ad.2.src`. - -### Examples +> Note please that you can use wildcard `*` for chain property name. +e.g. 'ad.*.src' instead of 'ad.0.src ad.1.src ad.2.src ...' +**Examples** 1. Removes property `example` from the results of JSON.parse call - - ```adblock + ``` example.org#%#//scriptlet('json-prune', 'example') ``` @@ -644,9 +519,8 @@ example.org#%#//scriptlet('json-prune'[, propsToRemove [, obligatoryProps [, sta JSON.parse('{"one":1,"example":true}') ``` -1. If there are no specified properties in the result of JSON.parse call, pruning will NOT occur - - ```adblock +2. If there are no specified properties in the result of JSON.parse call, pruning will NOT occur + ``` example.org#%#//scriptlet('json-prune', 'one', 'obligatoryProp') ``` @@ -656,187 +530,146 @@ example.org#%#//scriptlet('json-prune'[, propsToRemove [, obligatoryProps [, sta JSON.parse('{"one":1,"two":2}') ``` -1. A property in a list of properties can be a chain of properties +3. A property in a list of properties can be a chain of properties - ```adblock - example.org#%#//scriptlet('json-prune', 'a.b', 'ads.url.first') + ``` + example.org#%#//scriptlet('json-prune', 'a.b', 'adpath.url.first') ``` -1. Removes property `content.ad` from the results of JSON.parse call if its error stack trace contains `test.js` - - ```adblock +4. Removes property `content.ad` from the results of JSON.parse call if its error stack trace contains `test.js` + ``` example.org#%#//scriptlet('json-prune', 'content.ad', '', 'test.js') ``` -1. A property in a list of properties can be a chain of properties with wildcard in it +5. A property in a list of properties can be a chain of properties with wildcard in it - ```adblock - example.org#%#//scriptlet('json-prune', 'content.*.media.src', 'content.*.media.ad') + ``` + example.org#%#//scriptlet('json-prune', 'content.*.media.src', 'content.*.media.preroll') ``` -1. Call with no arguments will log the current hostname and json payload at the console - - ```adblock +6. Call with no arguments will log the current hostname and json payload at the console + ``` example.org#%#//scriptlet('json-prune') ``` -1. Call with only second argument will log the current hostname and matched json payload at the console - - ```adblock +7. Call with only second argument will log the current hostname and matched json payload at the console + ``` example.org#%#//scriptlet('json-prune', '', '"id":"117458"') ``` [Scriptlet source](../src/scriptlets/json-prune.js) - * * * -## ⚡️ log-addEventListener - -> Added in v1.0.4. +### ⚡️ log-addEventListener Logs all addEventListener calls to the console. Related UBO scriptlet: https://github.com/gorhill/uBlock/wiki/Resources-Library#addeventlistener-loggerjs- -### Syntax - -```adblock +**Syntax** +``` example.org#%#//scriptlet('log-addEventListener') ``` [Scriptlet source](../src/scriptlets/log-addEventListener.js) - * * * -## ⚡️ log-eval - -> Added in v1.0.4. +### ⚡️ log-eval Logs all `eval()` or `new Function()` calls to the console. -### Syntax - -```adblock +**Syntax** +``` example.org#%#//scriptlet('log-eval') ``` [Scriptlet source](../src/scriptlets/log-eval.js) - * * * -## ⚡️ log-on-stack-trace - -> Added in v1.5.0. - -This scriptlet is basically the same as [abort-on-stack-trace](#abort-on-stack-trace), -but instead of aborting it logs: +### ⚡️ log-on-stack-trace +This scriptlet is basically the same as [abort-on-stack-trace](#abort-on-stack-trace), but instead of aborting it logs: - function and source script names pairs that access the given property - was that get or set attempt - script being injected or inline -### Syntax - -```text +**Syntax** +``` example.com#%#//scriptlet('log-on-stack-trace', 'property') ``` - `property` — required, path to a property. The property must be attached to window. [Scriptlet source](../src/scriptlets/log-on-stack-trace.js) - * * * -## ⚡️ log - -> Added in v1.0.4. +### ⚡️ log A simple scriptlet which only purpose is to print arguments to console. This scriptlet can be helpful for debugging and troubleshooting other scriptlets. -### Examples - -```adblock +**Example** +``` example.org#%#//scriptlet('log', 'arg1', 'arg2') ``` [Scriptlet source](../src/scriptlets/log.js) - * * * -## ⚡️ m3u-prune - -> Added in v1.9.1. +### ⚡️ m3u-prune Removes content from the specified M3U file. -Related UBO scriptlet: -https://github.com/gorhill/uBlock/wiki/Resources-Library#m3u-prunejs- - -### Syntax -```text +**Syntax** +``` example.org#%#//scriptlet('m3u-prune'[, propsToRemove[, urlToMatch]]) ``` -- `propsToRemove` — optional, string or regular expression - to match the URL line (segment) which will be removed alongside with its tags +- `propsToRemove` — optional, string or regular expression to match the URL line (segment) which will be removed alongside with its tags - `urlToMatch` — optional, string or regular expression for matching the request's URL - > Usage with no arguments will log response payload and URL to browser console; -> it may be useful for debugging but it is not allowed for prod versions of filter lists. +which is useful for debugging but prohibited for production filter lists. -### Examples - -1. Removes a tag which contains `example.com/video/`, from all requests - - ```adblock - example.org#%#//scriptlet('m3u-prune', 'example.com/video/') +**Examples** +1. Removes a tag which contains `tvessaiprod.nbcuni.com/video/`, from all requests ``` - -1. Removes a line which contains `example.com/video/`, only if request's URL contains `.m3u8` - - ```adblock - example.org#%#//scriptlet('m3u-prune', 'example.com/video/', '.m3u8') + example.org#%#//scriptlet('m3u-prune', 'tvessaiprod.nbcuni.com/video/') ``` -1. Call with no arguments will log response payload and URL at the console +2. Removes a line which contains `tvessaiprod.nbcuni.com/video/`, only if request's URL contains `.m3u8` + ``` + example.org#%#//scriptlet('m3u-prune', 'tvessaiprod.nbcuni.com/video/', '.m3u8') + ``` - ```adblock +3. Call with no arguments will log response payload and URL at the console + ``` example.org#%#//scriptlet('m3u-prune') ``` -1. Call with only `urlToMatch` argument will log response payload and URL only for the matched URL - - ```adblock +4. Call with only `urlToMatch` argument will log response payload and URL only for the matched URL + ``` example.org#%#//scriptlet('m3u-prune', '', '.m3u8') ``` [Scriptlet source](../src/scriptlets/m3u-prune.js) - * * * -## ⚡️ no-topics - -> Added in v1.6.18. +### ⚡️ no-topics -Prevents using the Topics API. +Prevents using The Topics API https://developer.chrome.com/docs/privacy-sandbox/topics/ -### Syntax - -```adblock +**Syntax** +``` example.org#%#//scriptlet('no-topics') ``` [Scriptlet source](../src/scriptlets/no-topics.js) - * * * -## ⚡️ noeval - -> Added in v1.0.4. +### ⚡️ noeval Prevents page to use eval. Notifies about attempts in the console @@ -847,67 +680,54 @@ https://github.com/gorhill/uBlock/wiki/Resources-Library#noevaljs- It also can be used as `$redirect` rules sometimes. See [redirect description](../wiki/about-redirects.md#noeval). -### Syntax - -```adblock +**Syntax** +``` example.org#%#//scriptlet('noeval') ``` [Scriptlet source](../src/scriptlets/noeval.js) - * * * -## ⚡️ nowebrtc +### ⚡️ nowebrtc -> Added in v1.0.4. - -Disables WebRTC by overriding `RTCPeerConnection`. -The overridden function will log every attempt to create a new connection. +Disables WebRTC by overriding `RTCPeerConnection`. The overridden function will log every attempt to create a new connection. Related UBO scriptlet: https://github.com/gorhill/uBlock/wiki/Resources-Library#nowebrtcjs- -### Syntax - -```adblock +**Syntax** +``` example.org#%#//scriptlet('nowebrtc') ``` [Scriptlet source](../src/scriptlets/nowebrtc.js) - * * * -## ⚡️ prevent-addEventListener - -> Added in v1.0.4. +### ⚡️ prevent-addEventListener Prevents adding event listeners for the specified events and callbacks. Related UBO scriptlet: https://github.com/gorhill/uBlock/wiki/Resources-Library#addeventlistener-defuserjs- -### Syntax - -```text +**Syntax** +``` example.org#%#//scriptlet('prevent-addEventListener'[, typeSearch[, listenerSearch]]) ``` - `typeSearch` — optional, string or regular expression matching the type (event name); - defaults to match all types; invalid regular expression will cause exit and rule will not work +defaults to match all types; invalid regular expression will cause exit and rule will not work - `listenerSearch` — optional, string or regular expression matching the listener function body; - defaults to match all listeners; invalid regular expression will cause exit and rule will not work - -### Examples - -1. Prevent all `click` listeners +defaults to match all listeners; invalid regular expression will cause exit and rule will not work - ```adblock +**Examples** +1. Prevent all `click` listeners: + ``` example.org#%#//scriptlet('prevent-addEventListener', 'click') ``` -1. Prevent 'click' listeners with the callback body containing `searchString` - - ```adblock +2. Prevent 'click' listeners with the callback body containing `searchString`. + ``` example.org#%#//scriptlet('prevent-addEventListener', 'click', 'searchString') ``` @@ -920,31 +740,24 @@ example.org#%#//scriptlet('prevent-addEventListener'[, typeSearch[, listenerSear ``` [Scriptlet source](../src/scriptlets/prevent-addEventListener.js) - * * * -## ⚡️ prevent-adfly - -> Added in v1.0.4. +### ⚡️ prevent-adfly Prevents anti-adblock scripts on adfly short links. Related UBO scriptlet: https://github.com/gorhill/uBlock/wiki/Resources-Library#adfly-defuserjs- -### Syntax - -```adblock +**Syntax** +``` example.org#%#//scriptlet('prevent-adfly') ``` [Scriptlet source](../src/scriptlets/prevent-adfly.js) - * * * -## ⚡️ prevent-bab - -> Added in v1.0.4. +### ⚡️ prevent-bab Prevents BlockAdblock script from detecting an ad blocker. @@ -954,169 +767,135 @@ https://github.com/gorhill/uBlock/wiki/Resources-Library#bab-defuserjs- It also can be used as `$redirect` sometimes. See [redirect description](../wiki/about-redirects.md#prevent-bab). -### Syntax - -```adblock +**Syntax** +``` example.org#%#//scriptlet('prevent-bab') ``` [Scriptlet source](../src/scriptlets/prevent-bab.js) - * * * -## ⚡️ prevent-element-src-loading - -> Added in v1.6.2. +### ⚡️ prevent-element-src-loading Prevents target element source loading without triggering 'onerror' listeners and not breaking 'onload' ones. -### Syntax - -```text +**Syntax** +``` example.org#%#//scriptlet('prevent-element-src-loading', tagName, match) ``` -- `tagName` — required, case-insensitive target element tagName - which `src` property resource loading will be silently prevented; possible values: +- `tagName` — required, case-insensitive target element tagName which `src` property resource loading will be silently prevented; possible values: - `script` - `img` - `iframe` - - `link` - `match` — required, string or regular expression for matching the element's URL; -### Examples - -1. Prevent script source loading - - ```adblock +**Examples** +1. Prevent script source loading: +``` example.org#%#//scriptlet('prevent-element-src-loading', 'script' ,'adsbygoogle') - ``` +``` [Scriptlet source](../src/scriptlets/prevent-element-src-loading.js) - * * * -## ⚡️ prevent-eval-if - -> Added in v1.0.4. +### ⚡️ prevent-eval-if Prevents page to use eval matching payload. Related UBO scriptlet: https://github.com/gorhill/uBlock/wiki/Resources-Library#noeval-ifjs- -### Syntax - -```text +**Syntax** +``` example.org#%#//scriptlet('prevent-eval-if'[, search]) ``` - `search` — optional, string or regular expression matching the stringified eval payload; - defaults to match all stringified eval payloads; - invalid regular expression will cause exit and rule will not work - -### Examples +defaults to match all stringified eval payloads; +invalid regular expression will cause exit and rule will not work -```adblock +**Examples** +``` ! Prevents eval if it matches 'test' example.org#%#//scriptlet('prevent-eval-if', 'test') ``` [Scriptlet source](../src/scriptlets/prevent-eval-if.js) - * * * -## ⚡️ prevent-fab-3.2.0 - -> Added in v1.0.4. +### ⚡️ prevent-fab-3.2.0 Prevents execution of the FAB script v3.2.0. Related UBO scriptlet: https://github.com/gorhill/uBlock/wiki/Resources-Library#fuckadblockjs-320- -### Syntax - -```adblock +**Syntax** +``` example.org#%#//scriptlet('prevent-fab-3.2.0') ``` [Scriptlet source](../src/scriptlets/prevent-fab-3.2.0.js) - * * * -## ⚡️ prevent-fetch - -> Added in v1.3.18. +### ⚡️ prevent-fetch -Prevents `fetch` calls if **all** given parameters match. +Prevents `fetch` calls if **all** given parameters match Related UBO scriptlet: https://github.com/gorhill/uBlock/wiki/Resources-Library#no-fetch-ifjs- -### Syntax - -```text +**Syntax** +``` example.org#%#//scriptlet('prevent-fetch'[, propsToMatch[, responseBody[, responseType]]]) ``` - `propsToMatch` — optional, string of space-separated properties to match; possible props: - - string or regular expression for matching the URL passed to fetch call; - empty string, wildcard `*` or invalid regular expression will match all fetch calls - - colon-separated pairs `name:value` where - - - `name` is [`init` option name](https://developer.mozilla.org/en-US/docs/Web/API/WindowOrWorkerGlobalScope/fetch#parameters) - - `value` is string or regular expression for matching the value of the option passed to fetch call; - invalid regular expression will cause any value matching -- `responseBody` — optional, string for defining response body value, - defaults to `emptyObj`. Possible values: - - `emptyObj` — empty object - - `emptyArr` — empty array -- `responseType` — optional, string for defining response type, - original response type is used if not specified. Possible values: - - `default` - - `opaque` + - string or regular expression for matching the URL passed to fetch call; empty string, wildcard `*` or invalid regular expression will match all fetch calls + - colon-separated pairs `name:value` where + - `name` is [`init` option name](https://developer.mozilla.org/en-US/docs/Web/API/WindowOrWorkerGlobalScope/fetch#parameters) + - `value` is string or regular expression for matching the value of the option passed to fetch call; invalid regular expression will cause any value matching +- `responseBody` — optional, string for defining response body value, defaults to `emptyObj`. Possible values: + - `emptyObj` — empty object + - `emptyArr` — empty array +- `responseType` — optional, string for defining response type, defaults to `default`. Possible values: + - `default` + - `opaque` > Usage with no arguments will log fetch calls to browser console; -> it may be useful for debugging but it is not allowed for prod versions of filter lists. - -### Examples +which is useful for debugging but not permitted for production filter lists. +**Examples** 1. Log all fetch calls - - ```adblock + ``` example.org#%#//scriptlet('prevent-fetch') ``` -1. Prevent all fetch calls - - ```adblock +2. Prevent all fetch calls + ``` example.org#%#//scriptlet('prevent-fetch', '*') - ! or + OR example.org#%#//scriptlet('prevent-fetch', '') ``` -1. Prevent fetch call for specific url - - ```adblock +3. Prevent fetch call for specific url + ``` example.org#%#//scriptlet('prevent-fetch', '/url\\.part/') ``` -1. Prevent fetch call for specific request method - - ```adblock +4. Prevent fetch call for specific request method + ``` example.org#%#//scriptlet('prevent-fetch', 'method:HEAD') ``` -1. Prevent fetch call for specific url and request method - - ```adblock +5. Prevent fetch call for specific url and request method + ``` example.org#%#//scriptlet('prevent-fetch', '/specified_url_part/ method:/HEAD|GET/') ``` -1. Prevent fetch call and specify response body value - - ```adblock +6. Prevent fetch call and specify response body value + ``` ! Specify response body for fetch call to a specific url example.org#%#//scriptlet('prevent-fetch', '/specified_url_part/ method:/HEAD|GET/', 'emptyArr') @@ -1124,74 +903,58 @@ example.org#%#//scriptlet('prevent-fetch'[, propsToMatch[, responseBody[, respon example.org#%#//scriptlet('prevent-fetch', '', 'emptyArr') ``` -1. Prevent all fetch calls and specify response type value - - ```adblock +7. Prevent all fetch calls and specify response type value + ``` example.org#%#//scriptlet('prevent-fetch', '*', '', 'opaque') ``` [Scriptlet source](../src/scriptlets/prevent-fetch.js) - * * * -## ⚡️ prevent-popads-net - -> Added in v1.0.4. +### ⚡️ prevent-popads-net Aborts on property write (PopAds, popns), throws reference error with random id. Related UBO scriptlet: https://github.com/gorhill/uBlock/wiki/Resources-Library#popadsnetjs- -### Syntax - -```adblock +**Syntax** +``` example.org#%#//scriptlet('prevent-popads-net') ``` [Scriptlet source](../src/scriptlets/prevent-popads-net.js) - * * * -## ⚡️ prevent-refresh - -> Added in v1.6.2. +### ⚡️ prevent-refresh Prevents reloading of a document through a meta "refresh" tag. Related UBO scriptlet: https://github.com/gorhill/uBlock/wiki/Resources-Library#refresh-defuserjs- -### Syntax - -```text +**Syntax** +``` example.org#%#//scriptlet('prevent-refresh'[, delay]) ``` -- `delay` — optional, number of seconds for delay that indicates when scriptlet should run. - If not set, source tag value will be applied. - -### Examples - -1. Prevent reloading of a document through a meta "refresh" tag +- `delay` — optional, number of seconds for delay that indicates when scriptlet should run. If not set, source tag value will be applied. - ```adblock - example.org#%#//scriptlet('prevent-refresh') - ``` - -1. Prevent reloading of a document with delay +**Examples** +1. Prevent reloading of a document through a meta "refresh" tag. +``` + enrt.eu#%#//scriptlet('prevent-refresh') +``` - ```adblock - example.com#%#//scriptlet('prevent-refresh', 3) - ``` +2. Prevent reloading of a document with delay. +``` + cryptodirectories.com#%#//scriptlet('prevent-refresh', 3) +``` [Scriptlet source](../src/scriptlets/prevent-refresh.js) - * * * -## ⚡️ prevent-requestAnimationFrame - -> Added in v1.1.15. +### ⚡️ prevent-requestAnimationFrame Prevents a `requestAnimationFrame` call if the text of the callback is matching the specified search string which does not start with `!`; @@ -1200,30 +963,25 @@ otherwise mismatched calls should be defused. Related UBO scriptlet: https://github.com/gorhill/uBlock/wiki/Resources-Library#no-requestanimationframe-ifjs- -### Syntax - -```text +**Syntax** +``` example.org#%#//scriptlet('prevent-requestAnimationFrame'[, search]) ``` -- `search` — optional, string or regular expression; - invalid regular expression will be skipped and all callbacks will be matched. - If starts with `!`, scriptlet will not match the stringified callback but all other will be defused. - If do not start with `!`, the stringified callback will be matched. - -> Call with no argument will log all requestAnimationFrame calls, -> it may be useful for debugging but it is not allowed for prod versions of filter lists. - -### Examples +- `search` — optional, string or regular expression; invalid regular expression will be skipped and all callbacks will be matched. +If starts with `!`, scriptlet will not match the stringified callback but all other will be defused. +If do not start with `!`, the stringified callback will be matched. -1. Prevents `requestAnimationFrame` calls if the callback matches `/\.test/` +Call with no argument will log all requestAnimationFrame calls while debugging. +So do not use the scriptlet without any parameter in production filter lists. - ```adblock +**Examples** +1. Prevents `requestAnimationFrame` calls if the callback matches `/\.test/`. + ```bash example.org#%#//scriptlet('prevent-requestAnimationFrame', '/\.test/') ``` For instance, the following call will be prevented: - ```javascript var times = 0; requestAnimationFrame(function change() { @@ -1234,10 +992,8 @@ example.org#%#//scriptlet('prevent-requestAnimationFrame'[, search]) } }); ``` - -1. Prevents `requestAnimationFrame` calls if **does not match** 'check' - - ```adblock +2. Prevents `requestAnimationFrame` calls if **does not match** 'check'. + ```bash example.org#%#//scriptlet('prevent-requestAnimationFrame', '!check') ``` @@ -1264,69 +1020,57 @@ example.org#%#//scriptlet('prevent-requestAnimationFrame'[, search]) ``` [Scriptlet source](../src/scriptlets/prevent-requestAnimationFrame.js) - * * * -## ⚡️ prevent-setInterval - -> Added in v1.0.4. +### ⚡️ prevent-setInterval Prevents a `setInterval` call if: - -1. The text of the callback is matching the specified `matchCallback` string/regexp which does not start with `!`; - otherwise mismatched calls should be defused. -1. The delay is matching the specified `matchDelay`; otherwise mismatched calls should be defused. +1) the text of the callback is matching the specified `matchCallback` string/regexp which does not start with `!`; +otherwise mismatched calls should be defused; +2) the delay is matching the specified `matchDelay`; otherwise mismatched calls should be defused. Related UBO scriptlet: https://github.com/gorhill/uBlock/wiki/Resources-Library#no-setinterval-ifjs- -### Syntax - -```text +**Syntax** +``` example.org#%#//scriptlet('prevent-setInterval'[, matchCallback[, matchDelay]]) ``` -> Call with no arguments will log all setInterval calls (`log-setInterval` superseding), -> it may be useful for debugging but it is not allowed for prod versions of filter lists. - -- `matchCallback` — optional, string or regular expression; - invalid regular expression will be skipped and all callbacks will be matched. - If starts with `!`, scriptlet will not match the stringified callback but all other will be defused. - If do not start with `!`, the stringified callback will be matched. - If not set, prevents all `setInterval` calls due to specified `matchDelay`. +Call with no arguments will log calls to setInterval while debugging (`log-setInterval` superseding), +so production filter lists' rules definitely require at least one of the parameters: +- `matchCallback` — optional, string or regular expression; invalid regular expression will be skipped and all callbacks will be matched. +If starts with `!`, scriptlet will not match the stringified callback but all other will be defused. +If do not start with `!`, the stringified callback will be matched. +If not set, prevents all `setInterval` calls due to specified `matchDelay`. - `matchDelay` — optional, must be an integer. - If starts with `!`, scriptlet will not match the delay but all other will be defused. - If do not start with `!`, the delay passed to the `setInterval` call will be matched. - Decimal delay values will be rounded down, e.g `10.95` will be matched by `matchDelay` with value `10`. +If starts with `!`, scriptlet will not match the delay but all other will be defused. +If do not start with `!`, the delay passed to the `setInterval` call will be matched. +Decimal delay values will be rounded down, e.g `10.95` will be matched by `matchDelay` with value `10`. > If `prevent-setInterval` log looks like `setInterval(undefined, 1000)`, -> it means that no callback was passed to setInterval() and that's not scriptlet issue -> and obviously it can not be matched by `matchCallback`. - -### Examples +it means that no callback was passed to setInterval() and that's not scriptlet issue +and obviously it can not be matched by `matchCallback`. -1. Prevents `setInterval` calls if the callback matches `/\.test/` regardless of the delay - - ```adblock + **Examples** +1. Prevents `setInterval` calls if the callback matches `/\.test/` regardless of the delay. + ```bash example.org#%#//scriptlet('prevent-setInterval', '/\.test/') ``` For instance, the following call will be prevented: - ```javascript setInterval(function () { window.test = "value"; }, 100); ``` -1. Prevents `setInterval` calls if the callback does not contain `value` - - ```adblock +2. Prevents `setInterval` calls if the callback does not contain `value`. + ``` example.org#%#//scriptlet('prevent-setInterval', '!value') ``` For instance, only the first of the following calls will be prevented: - ```javascript setInterval(function () { window.test = "test -- prevented"; @@ -1339,14 +1083,12 @@ example.org#%#//scriptlet('prevent-setInterval'[, matchCallback[, matchDelay]]) }, 500); ``` -1. Prevents `setInterval` calls if the callback contains `value` and the delay is not set to `300` - - ```adblock +3. Prevents `setInterval` calls if the callback contains `value` and the delay is not set to `300`. + ``` example.org#%#//scriptlet('prevent-setInterval', 'value', '!300') ``` For instance, only the first of the following calls will not be prevented: - ```javascript setInterval(function () { window.test = "value 1 -- executed"; @@ -1359,14 +1101,12 @@ example.org#%#//scriptlet('prevent-setInterval'[, matchCallback[, matchDelay]]) }, 500); ``` -1. Prevents `setInterval` calls if the callback does not contain `value` and the delay is not set to `300` - - ```adblock +4. Prevents `setInterval` calls if the callback does not contain `value` and the delay is not set to `300`. + ``` example.org#%#//scriptlet('prevent-setInterval', '!value', '!300') ``` For instance, only the second of the following calls will be prevented: - ```javascript setInterval(function () { window.test = "test -- executed"; @@ -1382,14 +1122,12 @@ example.org#%#//scriptlet('prevent-setInterval'[, matchCallback[, matchDelay]]) }, 500); ``` -1. Prevents `setInterval` calls if the callback contains `value` and delay is a decimal number - - ```adblock +5. Prevents `setInterval` calls if the callback contains `value` and delay is a decimal. + ``` example.org#%#//scriptlet('prevent-setInterval', 'value', '300') ``` For instance, the following calls will be prevented: - ```javascript setInterval(function () { window.test = "value"; @@ -1400,69 +1138,57 @@ example.org#%#//scriptlet('prevent-setInterval'[, matchCallback[, matchDelay]]) ``` [Scriptlet source](../src/scriptlets/prevent-setInterval.js) - * * * -## ⚡️ prevent-setTimeout - -> Added in v1.0.4. +### ⚡️ prevent-setTimeout Prevents a `setTimeout` call if: - -1. The text of the callback is matching the specified `matchCallback` string/regexp which does not start with `!`; - otherwise mismatched calls should be defused. -1. The delay is matching the specified `matchDelay`; otherwise mismatched calls should be defused. +1) the text of the callback is matching the specified `matchCallback` string/regexp which does not start with `!`; +otherwise mismatched calls should be defused; +2) the delay is matching the specified `matchDelay`; otherwise mismatched calls should be defused. Related UBO scriptlet: https://github.com/gorhill/uBlock/wiki/Resources-Library#no-settimeout-ifjs- -### Syntax - -```text +**Syntax** +``` example.org#%#//scriptlet('prevent-setTimeout'[, matchCallback[, matchDelay]]) ``` -> Call with no arguments will log all setTimeout calls (`log-setTimeout` superseding), -> it may be useful for debugging but it is not allowed for prod versions of filter lists. - -- `matchCallback` — optional, string or regular expression; - invalid regular expression will be skipped and all callbacks will be matched. - If starts with `!`, scriptlet will not match the stringified callback but all other will be defused. - If do not start with `!`, the stringified callback will be matched. - If not set, prevents all `setTimeout` calls due to specified `matchDelay`. +Call with no arguments will log calls to setTimeout while debugging (`log-setTimeout` superseding), +so production filter lists' rules definitely require at least one of the parameters: +- `matchCallback` — optional, string or regular expression; invalid regular expression will be skipped and all callbacks will be matched. +If starts with `!`, scriptlet will not match the stringified callback but all other will be defused. +If do not start with `!`, the stringified callback will be matched. +If not set, prevents all `setTimeout` calls due to specified `matchDelay`. - `matchDelay` — optional, must be an integer. - If starts with `!`, scriptlet will not match the delay but all other will be defused. - If do not start with `!`, the delay passed to the `setTimeout` call will be matched. - Decimal delay values will be rounded down, e.g `10.95` will be matched by `matchDelay` with value `10`. +If starts with `!`, scriptlet will not match the delay but all other will be defused. +If do not start with `!`, the delay passed to the `setTimeout` call will be matched. +Decimal delay values will be rounded down, e.g `10.95` will be matched by `matchDelay` with value `10`. > If `prevent-setTimeout` log looks like `setTimeout(undefined, 1000)`, -> it means that no callback was passed to setTimeout() and that's not scriptlet issue -> and obviously it can not be matched by `matchCallback`. - -### Examples - -1. Prevents `setTimeout` calls if the callback matches `/\.test/` regardless of the delay +it means that no callback was passed to setTimeout() and that's not scriptlet issue +and obviously it can not be matched by `matchCallback`. - ```adblock +**Examples** +1. Prevents `setTimeout` calls if the callback matches `/\.test/` regardless of the delay. + ```bash example.org#%#//scriptlet('prevent-setTimeout', '/\.test/') ``` For instance, the following call will be prevented: - ```javascript setTimeout(function () { window.test = "value"; }, 100); ``` -1. Prevents `setTimeout` calls if the callback does not contain `value` - - ```adblock +2. Prevents `setTimeout` calls if the callback does not contain `value`. + ``` example.org#%#//scriptlet('prevent-setTimeout', '!value') ``` For instance, only the first of the following calls will be prevented: - ```javascript setTimeout(function () { window.test = "test -- prevented"; @@ -1475,14 +1201,12 @@ example.org#%#//scriptlet('prevent-setTimeout'[, matchCallback[, matchDelay]]) }, 500); ``` -1. Prevents `setTimeout` calls if the callback contains `value` and the delay is not set to `300` - - ```adblock +3. Prevents `setTimeout` calls if the callback contains `value` and the delay is not set to `300`. + ``` example.org#%#//scriptlet('prevent-setTimeout', 'value', '!300') ``` For instance, only the first of the following calls will not be prevented: - ```javascript setTimeout(function () { window.test = "value 1 -- executed"; @@ -1495,14 +1219,12 @@ example.org#%#//scriptlet('prevent-setTimeout'[, matchCallback[, matchDelay]]) }, 500); ``` -1. Prevents `setTimeout` calls if the callback does not contain `value` and the delay is not set to `300` - - ```adblock +4. Prevents `setTimeout` calls if the callback does not contain `value` and the delay is not set to `300`. + ``` example.org#%#//scriptlet('prevent-setTimeout', '!value', '!300') ``` For instance, only the second of the following calls will be prevented: - ```javascript setTimeout(function () { window.test = "test -- executed"; @@ -1518,14 +1240,12 @@ example.org#%#//scriptlet('prevent-setTimeout'[, matchCallback[, matchDelay]]) }, 500); ``` -1. Prevents `setTimeout` calls if the callback contains `value` and delay is a decimal - - ```adblock +5. Prevents `setTimeout` calls if the callback contains `value` and delay is a decimal. + ``` example.org#%#//scriptlet('prevent-setTimeout', 'value', '300') ``` For instance, the following calls will be prevented: - ```javascript setTimeout(function () { window.test = "value"; @@ -1536,171 +1256,136 @@ example.org#%#//scriptlet('prevent-setTimeout'[, matchCallback[, matchDelay]]) ``` [Scriptlet source](../src/scriptlets/prevent-setTimeout.js) - * * * -## ⚡️ prevent-window-open +### ⚡️ prevent-window-open -> Added in v1.0.4. - -Prevents `window.open` calls when URL either matches or not matches the specified string/regexp. -Using it without parameters prevents all `window.open` calls. +Prevents `window.open` calls when URL either matches or not matches the specified string/regexp. Using it without parameters prevents all `window.open` calls. Related UBO scriptlet: https://github.com/gorhill/uBlock/wiki/Resources-Library#windowopen-defuserjs- -### Syntax - -```text +**Syntax** +``` example.org#%#//scriptlet('prevent-window-open'[, match[, delay[, replacement]]]) ``` -- `match` — optional, string or regular expression. - If not set or regular expression is invalid, all window.open calls will be matched. - If starts with `!`, scriptlet will not match the stringified callback but all other will be defused. - If do not start with `!`, the stringified callback will be matched. +- `match` — optional, string or regular expression. If not set or regular expression is invalid, all window.open calls will be matched. +If starts with `!`, scriptlet will not match the stringified callback but all other will be defused. +If do not start with `!`, the stringified callback will be matched. - `delay` — optional, number of seconds. If not set, scriptlet will return `null`, - otherwise valid sham window object as injected `iframe` will be returned - for accessing its methods (blur(), focus() etc.) and will be removed after the delay. +otherwise valid sham window object as injected `iframe` will be returned +for accessing its methods (blur(), focus() etc.) and will be removed after the delay. - `replacement` — optional, string; one of the predefined constants: - `obj` — for returning an object instead of default iframe; for cases when the page requires a valid `window` instance to be returned - - `log` — for logging window.open calls; not allowed for prod versions of filter lists. - -### Examples + - `log` — for logging window.open calls; permitted for production filter lists. -1. Prevent all `window.open` calls - - ```adblock +**Examples** +1. Prevent all `window.open` calls: + ``` example.org#%#//scriptlet('prevent-window-open') ``` -1. Prevent `window.open` for all URLs containing `example` - - ```adblock +2. Prevent `window.open` for all URLs containing `example`: + ``` example.org#%#//scriptlet('prevent-window-open', 'example') ``` -1. Prevent `window.open` for all URLs matching RegExp `/example\./` - - ```adblock +3. Prevent `window.open` for all URLs matching RegExp `/example\./`: + ``` example.org#%#//scriptlet('prevent-window-open', '/example\./') ``` -1. Prevent `window.open` for all URLs **NOT** containing `example` - - ```adblock +4. Prevent `window.open` for all URLs **NOT** containing `example`: + ``` example.org#%#//scriptlet('prevent-window-open', '!example') ``` -### Old syntax of prevent-window-open parameters - -- `match` — optional, defaults to "matching", any positive number or nothing for "matching", - 0 or empty string for "not matching" -- `search` — optional, string or regexp for matching the URL passed to `window.open` call; - defaults to search all `window.open` call -- `replacement` — optional, string to return prop value or property instead of window.open; - defaults to return noopFunc. - -### Examples of old syntax - -```adblock -example.org#%#//scriptlet('prevent-window-open', '1', '/example\./') -example.org#%#//scriptlet('prevent-window-open', '0', 'example') -example.org#%#//scriptlet('prevent-window-open', '', '', 'trueFunc') -example.org#%#//scriptlet('prevent-window-open', '1', '', '{propName=noopFunc}') -``` +Old syntax of prevent-window-open parameters: +- `match` — optional, defaults to "matching", any positive number or nothing for "matching", 0 or empty string for "not matching" +- `search` — optional, string or regexp for matching the URL passed to `window.open` call; defaults to search all `window.open` call +- `replacement` — optional, string to return prop value or property instead of window.open; defaults to return noopFunc. +**Examples** + ``` + example.org#%#//scriptlet('prevent-window-open', '1', '/example\./') + example.org#%#//scriptlet('prevent-window-open', '0', 'example') + example.org#%#//scriptlet('prevent-window-open', '', '', 'trueFunc') + example.org#%#//scriptlet('prevent-window-open', '1', '', '{propName=noopFunc}') + ``` > For better compatibility with uBO, old syntax is not recommended to use. [Scriptlet source](../src/scriptlets/prevent-window-open.js) - * * * -## ⚡️ prevent-xhr - -> Added in v1.5.0. +### ⚡️ prevent-xhr Prevents `xhr` calls if **all** given parameters match. Related UBO scriptlet: https://github.com/gorhill/uBlock/wiki/Resources-Library#no-xhr-ifjs- -### Syntax - -```text +**Syntax** +``` example.org#%#//scriptlet('prevent-xhr'[, propsToMatch[, randomize]]) ``` - `propsToMatch` — optional, string of space-separated properties to match; possible props: - - string or regular expression for matching the URL passed to `XMLHttpRequest.open()` call; - empty string or wildcard `*` for all `XMLHttpRequest.open()` calls match - - colon-separated pairs `name:value` where - - `name` is XMLHttpRequest object property name - - `value` is string or regular expression for matching the value of the option - passed to `XMLHttpRequest.open()` call -- `randomize` — defaults to `false` for empty responseText, - optional argument to randomize responseText of matched XMLHttpRequest's response; possible values: - - `true` to randomize responseText, random alphanumeric string of 10 symbols - - colon-separated pair `name:value` string value to customize responseText data where - - `name` — only `length` supported for now - - `value` — range on numbers, for example `100-300`, limited to 500000 characters + - string or regular expression for matching the URL passed to `XMLHttpRequest.open()` call; empty string or wildcard `*` for all `XMLHttpRequest.open()` calls match + - colon-separated pairs `name:value` where + - `name` is XMLHttpRequest object property name + - `value` is string or regular expression for matching the value of the option passed to `XMLHttpRequest.open()` call +- `randomize` — defaults to `false` for empty responseText, optional argument to randomize responseText of matched XMLHttpRequest's response; possible values: + - `true` to randomize responseText, random alphanumeric string of 10 symbols + - colon-separated pair `name:value` string value to customize responseText data where + - `name` — only `length` supported for now + - `value` — range on numbers, for example `100-300`, limited to 500000 characters > Usage with no arguments will log XMLHttpRequest objects to browser console; -> it may be useful for debugging but it is not allowed for prod versions of filter lists. - -### Examples +which is useful for debugging but not allowed for production filter lists. +**Examples** 1. Log all XMLHttpRequests - - ```adblock + ``` example.org#%#//scriptlet('prevent-xhr') ``` -1. Prevent all XMLHttpRequests - - ```adblock +2. Prevent all XMLHttpRequests + ``` example.org#%#//scriptlet('prevent-xhr', '*') example.org#%#//scriptlet('prevent-xhr', '') ``` -1. Prevent XMLHttpRequests for specific url - - ```adblock +3. Prevent XMLHttpRequests for specific url + ``` example.org#%#//scriptlet('prevent-xhr', 'example.org') ``` -1. Prevent XMLHttpRequests for specific request method - - ```adblock +4. Prevent XMLHttpRequests for specific request method + ``` example.org#%#//scriptlet('prevent-xhr', 'method:HEAD') ``` -1. Prevent XMLHttpRequests for specific url and specified request methods - - ```adblock +5. Prevent XMLHttpRequests for specific url and specified request methods + ``` example.org#%#//scriptlet('prevent-xhr', 'example.org method:/HEAD|GET/') ``` -1. Prevent XMLHttpRequests for specific url and randomize it's response text - - ```adblock +6. Prevent XMLHttpRequests for specific url and randomize it's response text + ``` example.org#%#//scriptlet('prevent-xhr', 'example.org', 'true') ``` -1. Prevent XMLHttpRequests for specific url and randomize it's response text with range - - ```adblock +7. Prevent XMLHttpRequests for specific url and randomize it's response text with range + ``` example.org#%#//scriptlet('prevent-xhr', 'example.org', 'length:100-300') ``` [Scriptlet source](../src/scriptlets/prevent-xhr.js) - * * * -## ⚡️ remove-attr - -> Added in v1.0.4. +### ⚡️ remove-attr Removes the specified attributes from DOM nodes. This scriptlet runs once when the page loads and after that periodically in order to DOM tree changes by default, @@ -1709,25 +1394,21 @@ or as specified by applying argument. Related UBO scriptlet: https://github.com/gorhill/uBlock/wiki/Resources-Library#remove-attrjs- -### Syntax - -```text +**Syntax** +``` example.org#%#//scriptlet('remove-attr', attrs[, selector, applying]) ``` - `attrs` — required, attribute or list of attributes joined by '|' - `selector` — optional, CSS selector, specifies DOM nodes from which the attributes will be removed -- `applying` — optional, one or more space-separated flags that describe the way scriptlet apply, - defaults to 'asap stay'; possible flags: +- `applying` — optional, one or more space-separated flags that describe the way scriptlet apply, defaults to 'asap stay'; possible flags: - `asap` — runs as fast as possible **once** - `complete` — runs **once** after the whole page has been loaded - `stay` — as fast as possible **and** stays on the page observing possible DOM changes -### Examples - -1. Removes by attribute - - ```adblock +**Examples** +1. Removes by attribute + ``` example.org#%#//scriptlet('remove-attr', 'example|test') ``` @@ -1739,9 +1420,8 @@ example.org#%#//scriptlet('remove-attr', attrs[, selector, applying])