- abort-current-inline-script
- abort-on-property-read
- abort-on-property-write
- abort-on-stack-trace
- adjust-setInterval
- adjust-setTimeout
- amazon-apstag
- call-nothrow
- close-window
- debug-current-inline-script
- debug-on-property-read
- debug-on-property-write
- didomi-loader
- dir-string
- disable-newtab-links
- evaldata-prune
- fingerprintjs2
- fingerprintjs3
- gemius
- google-analytics-ga
- google-analytics
- google-ima3
- googlesyndication-adsbygoogle
- googletagservices-gpt
- hide-in-shadow-dom
- href-sanitizer
- inject-css-in-shadow-dom
- json-prune-fetch-response
- json-prune-xhr-response
- json-prune
- log-addEventListener
- log-eval
- log-on-stack-trace
- log
- m3u-prune
- matomo
- metrika-yandex-tag
- metrika-yandex-watch
- naver-wcslog
- no-protected-audience
- no-topics
- noeval
- nowebrtc
- pardot-1.0
- prebid
- prevent-addEventListener
- prevent-adfly
- prevent-bab
- prevent-element-src-loading
- prevent-eval-if
- prevent-fab-3.2.0
- prevent-fetch
- prevent-popads-net
- prevent-refresh
- prevent-requestAnimationFrame
- prevent-setInterval
- prevent-setTimeout
- prevent-window-open
- prevent-xhr
- remove-attr
- remove-class
- remove-cookie
- remove-in-shadow-dom
- remove-node-text
- scorecardresearch-beacon
- set-attr
- set-constant
- set-cookie-reload
- set-cookie
- set-local-storage-item
- set-popads-dummy
- set-session-storage-item
- spoof-css
- xml-prune
Added in v1.0.4.
Aborts an inline script when it attempts to read or write to the specified property
AND when the contents of the <script>
element contains the specified
text or matches the regular expression.
Related UBO scriptlet: https://github.com/gorhill/uBlock/wiki/Resources-Library#abort-current-inline-scriptjs-
Related ABP source: https://gitlab.com/eyeo/snippets/-/blob/main/source/behavioral/abort-current-inline-script.js
example.org#%#//scriptlet('abort-current-inline-script', property[, search])
property
— required, path to a property (joined with.
if needed). The property must be attached towindow
search
— optional, string or regular expression that must match the inline script content. Defaults to abort all scripts which are trying to access the specified property. Invalid regular expression will cause exit and rule will not work.
Note please that to abort the inline script with addEventListener in it,
property
should be set asEventTarget.prototype.addEventListener
, not justaddEventListener
.
-
Aborts all inline scripts trying to access
window.alert
example.org#%#//scriptlet('abort-current-inline-script', 'alert')
-
Aborts inline scripts which are trying to access
window.alert
and containHello, world
example.org#%#//scriptlet('abort-current-inline-script', 'alert', 'Hello, world')
For instance, the following script will be aborted:
<script>alert("Hello, world");</script>
-
Aborts inline scripts which are trying to access
window.alert
and match regexp/Hello.+world/
example.org#%#//scriptlet('abort-current-inline-script', 'alert', '/Hello.+world/')
For instance, the following scripts will be aborted:
<script>alert("Hello, big world");</script>
<script>alert("Hello, little world");</script>
And this script will not be aborted:
<script>alert("Hi, little world");</script>
Added in v1.0.4.
Aborts a script when it attempts to read the specified property.
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
example.org#%#//scriptlet('abort-on-property-read', property)
property
— required, path to a property (joined with.
if needed). The property must be attached towindow
! Aborts script when it tries to access `window.alert`
example.org#%#//scriptlet('abort-on-property-read', 'alert')
! Aborts script when it tries to access `navigator.language`
example.org#%#//scriptlet('abort-on-property-read', 'navigator.language')
Added in v1.0.4.
Aborts a script when it attempts to write the specified property.
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
example.org#%#//scriptlet('abort-on-property-write', property)
property
— required, path to a property (joined with.
if needed). The property must be attached towindow
! Aborts script when it tries to set `window.adblock` value
example.org#%#//scriptlet('abort-on-property-write', 'adblock')
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.
Related UBO scriptlet: https://github.com/gorhill/uBlock-for-firefox-legacy/commit/7099186ae54e70b588d5e99554a05d783cabc8ff
example.com#%#//scriptlet('abort-on-stack-trace', property, stack)
property
— required, path to a property. The property must be attached to window.stack
— required, string that must match the current function call stack trace.- values to abort inline or injected script, accordingly:
inlineScript
injectedScript
- values to abort inline or injected script, accordingly:
-
Aborts script when it tries to access
window.Ya
and it's error stack trace containstest.js
example.org#%#//scriptlet('abort-on-stack-trace', 'Ya', 'test.js')
-
Aborts script when it tries to access
window.Ya.videoAd
and it's error stack trace containstest.js
example.org#%#//scriptlet('abort-on-stack-trace', 'Ya.videoAd', 'test.js')
-
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')
-
Aborts script when it tries to access
window.Ya
and it's an inline scriptexample.org#%#//scriptlet('abort-on-stack-trace', 'Ya', 'inlineScript')
-
Aborts script when it tries to access
window.Ya
and it's an injected scriptexample.org#%#//scriptlet('abort-on-stack-trace', 'Ya', 'injectedScript')
Added in v1.0.4.
Adjusts delay for specified setInterval() callbacks.
Related UBO scriptlet: https://github.com/gorhill/uBlock/wiki/Resources-Library#nano-setinterval-boosterjs-
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 workmatchDelay
— optional, defaults to 1000, matching setInterval delay; decimal integer OR '*' for any delayboost
— optional, default to 0.05, float, capped at 1000 times for up and 50 for down (0.001...50), setInterval delay multiplier
-
Adjust all setInterval() x20 times where delay equal 1000ms
example.org#%#//scriptlet('adjust-setInterval')
-
Adjust all setInterval() x20 times where callback matched with
example
and delay equal 1000msexample.org#%#//scriptlet('adjust-setInterval', 'example')
-
Adjust all setInterval() x20 times where callback matched with
example
and delay equal 400msexample.org#%#//scriptlet('adjust-setInterval', 'example', '400')
-
Slow down setInterval() x2 times where callback matched with
example
and delay equal 1000msexample.org#%#//scriptlet('adjust-setInterval', 'example', '', '2')
-
Adjust all setInterval() x50 times where delay equal 2000ms
example.org#%#//scriptlet('adjust-setInterval', '', '2000', '0.02')
-
Adjust all setInterval() x1000 times where delay equal 2000ms
example.org#%#//scriptlet('adjust-setInterval', '', '2000', '0.001')
-
Adjust all setInterval() x50 times where delay is randomized
example.org#%#//scriptlet('adjust-setInterval', '', '*', '0.02')
Added in v1.0.4.
Adjusts delay for specified setTimeout() callbacks.
Related UBO scriptlet: https://github.com/gorhill/uBlock/wiki/Resources-Library#nano-settimeout-boosterjs-
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 workmatchDelay
— optional, defaults to 1000, matching setTimeout delay; decimal integer OR '*' for any delayboost
— optional, default to 0.05, float, capped at 1000 times for up and 50 for down (0.001...50), setTimeout delay multiplier
-
Adjust all setTimeout() x20 times where timeout equal 1000ms
example.org#%#//scriptlet('adjust-setTimeout')
-
Adjust all setTimeout() x20 times where callback matched with
example
and timeout equal 1000msexample.org#%#//scriptlet('adjust-setTimeout', 'example')
-
Adjust all setTimeout() x20 times where callback matched with
example
and timeout equal 400msexample.org#%#//scriptlet('adjust-setTimeout', 'example', '400')
-
Slow down setTimeout() x2 times where callback matched with
example
and timeout equal 1000msexample.org#%#//scriptlet('adjust-setTimeout', 'example', '', '2')
-
Adjust all setTimeout() x50 times where timeout equal 2000ms
example.org#%#//scriptlet('adjust-setTimeout', '', '2000', '0.02')
-
Adjust all setTimeout() x1000 times where timeout equal 2000ms
example.org#%#//scriptlet('adjust-setTimeout', '', '2000', '0.001')
-
Adjust all setTimeout() x20 times where callback matched with
test
and timeout is randomizedexample.org#%#//scriptlet('adjust-setTimeout', 'test', '*')
Added in v1.10.25.
Mocks Amazon's apstag.js
example.org#%#//scriptlet('amazon-apstag')
Added in v1.10.1.
Prevents an exception from being thrown and returns undefined when a specific function is called.
Related UBO scriptlet: https://github.com/gorhill/uBlock/wiki/Resources-Library#call-nothrowjs-
example.org#%#//scriptlet('call-nothrow', functionName)
functionName
— required, the name of the function to trap
-
Prevents an exception from being thrown when
Object.defineProperty
is called:example.org#%#//scriptlet('call-nothrow', 'Object.defineProperty')
For instance, the following call normally throws an error, but the scriptlet catches it and returns undefined:
Object.defineProperty(window, 'foo', { value: true }); Object.defineProperty(window, 'foo', { value: false });
-
Prevents an exception from being thrown when
JSON.parse
is called:example.org#%#//scriptlet('call-nothrow', 'JSON.parse')
For instance, the following call normally throws an error, but the scriptlet catches it and returns undefined:
JSON.parse('foo');
Added in v1.5.0.
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.
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.
! closes any example.org tab
example.org#%#//scriptlet('close-window')
! closes specific example.org tab
example.org#%#//scriptlet('close-window', '/example-page.html')
Added in v1.0.4.
This scriptlet is basically the same as abort-current-inline-script, but instead of aborting it starts the debugger.
It is not allowed for prod versions of filter lists.
! Aborts script when it tries to access `window.alert`
example.org#%#//scriptlet('debug-current-inline-script', 'alert')
Added in v1.0.4.
This scriptlet is basically the same as abort-on-property-read, but instead of aborting it starts the debugger.
It is not allowed for prod versions of filter lists.
! Debug script if it tries to access `window.alert`
example.org#%#//scriptlet('debug-on-property-read', 'alert')
! or `window.open`
example.org#%#//scriptlet('debug-on-property-read', 'open')
Added in v1.0.4.
This scriptlet is basically the same as abort-on-property-write, but instead of aborting it starts the debugger.
It is not allowed for prod versions of filter lists.
! Aborts script when it tries to write in property `window.test`
example.org#%#//scriptlet('debug-on-property-write', 'test')
Added in v1.10.25.
Mocks Didomi's CMP loader script. https://developers.didomi.io/
example.org#%#//scriptlet('didomi-loader')
Added in v1.0.4.
Wraps the console.dir
API to call the toString
method of the argument.
There are several adblock circumvention systems that detect browser devtools
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.
example.org#%#//scriptlet('dir-string'[, times])
times
— optional, the number of times to call thetoString
method of the argument toconsole.dir
! Run 2 times
example.org#%#//scriptlet('dir-string', '2')
Added in v1.0.4.
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-
example.org#%#//scriptlet('disable-newtab-links')
Added in v1.9.37.
Removes specified properties from the result of calling eval (if payloads contains Object
) and returns to the caller.
Related UBO scriptlet: https://github.com/gorhill/uBlock/commit/c8de9041917b61035171e454df886706f27fc4f3
example.org#%#//scriptlet('evaldata-prune'[, propsToRemove [, obligatoryProps [, stack]]])
propsToRemove
— optional, string of space-separated properties to removeobligatoryProps
— optional, string of space-separated properties which must be all present for the pruning to occurstack
— optional, string or regular expression that must match the current function call stack trace; 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 ofad.0.src ad.1.src ad.2.src
.
-
Removes property
example
from the payload of the eval callexample.org#%#//scriptlet('evaldata-prune', 'example')
For instance, the following call will return
{ one: 1}
eval({ one: 1, example: true })
-
If there are no specified properties in the payload of eval call, pruning will NOT occur
example.org#%#//scriptlet('evaldata-prune', 'one', 'obligatoryProp')
For instance, the following call will return
{ one: 1, two: 2}
JSON.parse('{"one":1,"two":2}')
-
A property in a list of properties can be a chain of properties
example.org#%#//scriptlet('evaldata-prune', 'a.b', 'ads.url.first')
-
Removes property
content.ad
from the payload of eval call if its error stack trace containstest.js
example.org#%#//scriptlet('evaldata-prune', 'content.ad', '', 'test.js')
-
A property in a list of properties can be a chain of properties with wildcard in it
example.org#%#//scriptlet('evaldata-prune', 'content.*.media.src', 'content.*.media.ad')
-
Call with no arguments will log the current hostname and object payload at the console
example.org#%#//scriptlet('evaldata-prune')
-
Call with only second argument will log the current hostname and matched object payload at the console
example.org#%#//scriptlet('evaldata-prune', '', '"id":"117458"')
Added in v1.10.25.
Mocks FingerprintJS v2 https://github.com/fingerprintjs
example.org#%#//scriptlet('fingerprintjs2')
Added in v1.10.25.
Mocks FingerprintJS v3 https://github.com/fingerprintjs
example.org#%#//scriptlet('fingerprintjs3')
Added in v1.10.25.
Mocks Gemius Analytics. https://flowplayer.com/developers/plugins/gemius
example.org#%#//scriptlet('gemius')
Added in v1.10.25.
Mocks old Google Analytics API.
example.org#%#//scriptlet('google-analytics-ga')
Added in v1.10.25.
Mocks Google's Analytics and Tag Manager APIs.
example.org#%#//scriptlet('google-analytics')
Added in v1.10.25.
Mocks the IMA SDK of Google.
example.org#%#//scriptlet('google-ima3')
Added in v1.10.25.
Mocks Google AdSense API.
example.org#%#//scriptlet('googlesyndication-adsbygoogle')
Added in v1.10.25.
Mocks Google Publisher Tag API.
example.org#%#//scriptlet('googletagservices-gpt')
Added in v1.3.0.
Hides elements inside open shadow DOM elements.
example.org#%#//scriptlet('hide-in-shadow-dom', selector[, baseSelector])
selector
— required, CSS selector of element in shadow-dom to hidebaseSelector
— 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.
! hides menu bar
example.com#%#//scriptlet('hide-in-shadow-dom', '.storyAd', '#app')
! hides floating element
example.com#%#//scriptlet('hide-in-shadow-dom', '.contact-fab')
Added in v1.10.25.
Set the href
attribute to a value found in text content of the targeted a
element,
or in an attribute of the targeted a
element,
or in a URL parameter of the targeted a
element's href
attribute.
This scriptlet runs once when the page loads and after that on DOM tree changes.
Related UBO scriptlet: https://github.com/uBlockOrigin/uBlock-issues/wiki/Resources-Library#href-sanitizerjs-
example.org#%#//scriptlet('href-sanitizer', selector[, attribute])
selector
— required, a CSS selector to match the elements to be sanitized, which should be anchor elements (<a>
) withhref
attribute.attribute
— optional, default totext
:text
— use the text content of the matched element,[attribute-name]
copy the value from attributeattribute-name
on the same element,?parameter
copy the value from URL parameterparameter
of the same element'shref
attribute.
-
Set the
href
attribute to a value found in text content of the targeteda
element:example.org#%#//scriptlet('href-sanitizer', 'a[href*="foo.com"]')
<!-- before --> <div> <a href="https://foo.com/bar">https://example.org/test?foo</a> </div> <!-- after --> <div> <a href="https://example.org/test?foo">https://example.org/test?foo</a> </div>
-
Set the
href
attribute to a value found in an attribute of the targeteda
element:example.org#%#//scriptlet('href-sanitizer', 'a[href*="foo.com"]', '[data-href]')
<!-- before --> <div> <a href="https://foo.com/bar" data-href="https://example.org/test?foo"></a> </div> <!-- after --> <div> <a href="https://example.org/test?foo" data-href="https://example.org/test?foo"></a> </div>
-
Set the
href
attribute to a value found in a URL parameter of the targeteda
element'shref
attribute:example.org#%#//scriptlet('href-sanitizer', 'a[href*="tracker.com"]', '?redirect')
<!-- before --> <div> <a href="https://tracker.com/foo?redirect=https://example.org/"></a> </div> <!-- after --> <div> <a href="https://example.org/"></a> </div>
Added in v1.8.2.
Injects CSS rule into selected Shadow DOM subtrees on a page
example.org#%#//scriptlet('inject-css-in-shadow-dom', cssRule[, hostSelector])
cssRule
— required, string representing a single css rulehostSelector
— 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.
-
Apply style to all shadow dom subtrees
example.org#%#//scriptlet('inject-css-in-shadow-dom', '#advertisement { display: none !important; }')
-
Apply style to a specific shadow dom subtree
example.org#%#//scriptlet('inject-css-in-shadow-dom', '#content { margin-top: 0 !important; }', '#banner')
Added in v1.10.25.
Removes specified properties from the JSON response of a fetch call.
Related UBO scriptlet: https://github.com/gorhill/uBlock/commit/749cec0f095f659d6c0b90eb89b729e9deb07c87
example.org#%#//scriptlet('json-prune-fetch-response'[, propsToRemove[, obligatoryProps[, propsToMatch[, stack]]]])
propsToRemove
— optional, string of space-separated properties to removeobligatoryProps
— optional, string of space-separated properties which must be all present for the pruning to occurpropsToMatch
— 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
wherename
isinit
option namevalue
is string or regular expression for matching the value of the option passed to fetch call; invalid regular expression will cause any value matching
- string or regular expression for matching the URL passed to fetch call;
empty string, wildcard
stack
— optional, string or regular expression that must match the current function call stack trace; 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 ofad.0.src ad.1.src ad.2.src
.
Usage with with only propsToMatch argument will log fetch calls to browser console. It may be useful for debugging but it is not allowed for prod versions of filter lists.
Scriptlet does nothing if response body can't be converted to JSON.
-
Removes property
example
from the JSON response of any fetch callexample.org#%#//scriptlet('json-prune-fetch-response', 'example')
For instance, if the JSON response of a fetch call is:
{one: 1, example: true}
then the response will be modified to:
{one: 1}
-
A property in a list of properties can be a chain of properties
example.org#%#//scriptlet('json-prune-fetch-response', 'a.b', 'ads.url.first')
-
Removes property
content.ad
from the JSON response of a fetch call if URL containscontent.json
example.org#%#//scriptlet('json-prune-fetch-response', 'content.ad', '', 'content.json')
-
Removes property
content.ad
from the JSON response of a fetch call if its error stack trace containstest.js
example.org#%#//scriptlet('json-prune-fetch-response', 'content.ad', '', '', 'test.js')
-
A property in a list of properties can be a chain of properties with wildcard in it
example.org#%#//scriptlet('json-prune-fetch-response', 'content.*.media.src', 'content.*.media.ad')
-
Log all JSON responses of a fetch call
example.org#%#//scriptlet('json-prune-fetch-response')
Added in v1.10.25.
Removes specified properties from the JSON response of a XMLHttpRequest
call.
Related UBO scriptlet: https://github.com/gorhill/uBlock/commit/3152896d428c54c76cfd66c3da110bd4d6506cbc
example.org#%#//scriptlet('json-prune-xhr-response'[, propsToRemove[, obligatoryProps[, propsToMatch[, stack]]]])
propsToRemove
— optional, string of space-separated properties to removeobligatoryProps
— optional, string of space-separated properties which must be all present for the pruning to occurpropsToMatch
— optional, string of space-separated properties to match for extra condition; possible props:- string or regular expression for matching the URL passed to
XMLHttpRequest.open()
call; - colon-separated pairs
name:value
wherename
— string or regular expression for matching XMLHttpRequest property namevalue
— string or regular expression for matching the value of the option passed toXMLHttpRequest.open()
call
- string or regular expression for matching the URL passed to
stack
— optional, string or regular expression that must match the current function call stack trace; 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 ofad.0.src ad.1.src ad.2.src
.
Usage with with only propsToMatch argument will log XMLHttpRequest calls to browser console. It may be useful for debugging but it is not allowed for prod versions of filter lists.
Scriptlet does nothing if response body can't be converted to JSON.
-
Removes property
example
from the JSON response of any XMLHttpRequest callexample.org#%#//scriptlet('json-prune-xhr-response', 'example')
For instance, if the JSON response of a XMLHttpRequest call is:
{one: 1, example: true}
then the response will be modified to:
{one: 1}
-
A property in a list of properties can be a chain of properties
example.org#%#//scriptlet('json-prune-xhr-response', 'a.b', 'ads.url.first')
-
Removes property
content.ad
from the JSON response of a XMLHttpRequest call if URL containscontent.json
example.org#%#//scriptlet('json-prune-xhr-response', 'content.ad', '', 'content.json')
-
Removes property
content.ad
from the JSON response of a XMLHttpRequest call if its error stack trace containstest.js
example.org#%#//scriptlet('json-prune-xhr-response', 'content.ad', '', '', 'test.js')
-
A property in a list of properties can be a chain of properties with wildcard in it
example.org#%#//scriptlet('json-prune-xhr-response', 'content.*.media.src', 'content.*.media.ad')
-
Log all JSON responses of a XMLHttpRequest call
example.org#%#//scriptlet('json-prune-xhr-response')
Added in v1.1.0.
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
example.org#%#//scriptlet('json-prune'[, propsToRemove [, obligatoryProps [, stack]]])
propsToRemove
— optional, string of space-separated properties to removeobligatoryProps
— optional, string of space-separated properties which must be all present for the pruning to occurstack
— optional, string or regular expression that must match the current function call stack trace; 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 ofad.0.src ad.1.src ad.2.src
.
-
Removes property
example
from the results of JSON.parse callexample.org#%#//scriptlet('json-prune', 'example')
For instance, the following call will return
{ one: 1}
JSON.parse('{"one":1,"example":true}')
-
If there are no specified properties in the result of JSON.parse call, pruning will NOT occur
example.org#%#//scriptlet('json-prune', 'one', 'obligatoryProp')
For instance, the following call will return
{ one: 1, two: 2}
JSON.parse('{"one":1,"two":2}')
-
A property in a list of properties can be a chain of properties
example.org#%#//scriptlet('json-prune', 'a.b', 'ads.url.first')
-
Removes property
content.ad
from the results of JSON.parse call if its error stack trace containstest.js
example.org#%#//scriptlet('json-prune', 'content.ad', '', 'test.js')
-
A property in a list of properties can be a chain of properties with wildcard in it
example.org#%#//scriptlet('json-prune', 'content.*.media.src', 'content.*.media.ad')
-
Call with no arguments will log the current hostname and json payload at the console
example.org#%#//scriptlet('json-prune')
-
Call with only second argument will log the current hostname and matched json payload at the console
example.org#%#//scriptlet('json-prune', '', '"id":"117458"')
Added in v1.0.4.
Logs all addEventListener calls to the console.
Related UBO scriptlet: https://github.com/gorhill/uBlock/wiki/Resources-Library#addeventlistener-loggerjs-
example.org#%#//scriptlet('log-addEventListener')
Added in v1.0.4.
Logs all eval()
or new Function()
calls to the console.
example.org#%#//scriptlet('log-eval')
Added in v1.5.0.
This scriptlet is basically the same as 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
example.com#%#//scriptlet('log-on-stack-trace', 'property')
property
— required, path to a property. The property must be attached to window.
Added in v1.0.4.
A simple scriptlet which only purpose is to print arguments to console. This scriptlet can be helpful for debugging and troubleshooting other scriptlets.
Related ABP source: https://gitlab.com/eyeo/snippets/-/blob/main/source/introspection/log.js
example.org#%#//scriptlet('log', 'arg1', 'arg2')
Added in v1.9.1.
Removes content from the specified M3U file.
Related UBO scriptlet: https://github.com/gorhill/uBlock/wiki/Resources-Library#m3u-prunejs-
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 tagsurlToMatch
— optional, string or regular expression for matching the request's URLverbose
— optional, boolean, if set to 'true' will log original and modified M3U content
verbose
may be useful for debugging but it is not allowed for prod versions of filter lists.
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.
-
Removes a tag which contains
example.com/video/
, from all requestsexample.org#%#//scriptlet('m3u-prune', 'example.com/video/')
-
Removes a line which contains
example.com/video/
, only if request's URL contains.m3u8
example.org#%#//scriptlet('m3u-prune', 'example.com/video/', '.m3u8')
-
Removes a line which contains
example.com/video/
, only if request's URL contains.m3u8
and log contentexample.org#%#//scriptlet('m3u-prune', 'example.com/video/', '.m3u8', 'true')
-
Call with no arguments will log response payload and URL at the console
example.org#%#//scriptlet('m3u-prune')
-
Call with only
urlToMatch
argument will log response payload and URL only for the matched URLexample.org#%#//scriptlet('m3u-prune', '', '.m3u8')
Added in v1.10.25.
Mocks the piwik.js file of Matomo (formerly Piwik).
example.org#%#//scriptlet('matomo')
Added in v1.10.25.
Mocks Yandex Metrika API. https://yandex.ru/support/metrica/objects/method-reference.html
example.org#%#//scriptlet('metrika-yandex-tag')
Added in v1.10.25.
Mocks the old Yandex Metrika API. https://yandex.ru/support/metrica/objects/_method-reference.html
example.org#%#//scriptlet('metrika-yandex-watch')
Added in v1.10.25.
Mocks wcslog.js of Naver Analytics.
example.org#%#//scriptlet('naver-wcslog')
Added in v1.10.25.
Prevents using the Protected Audience API. https://wicg.github.io/turtledove/
example.org#%#//scriptlet('no-protected-audience')
Added in v1.6.18.
Prevents using the Topics API. https://developer.chrome.com/docs/privacy-sandbox/topics/
example.org#%#//scriptlet('no-topics')
Added in v1.0.4.
Prevents page to use eval. Notifies about attempts in the console
Related UBO scriptlet: https://github.com/gorhill/uBlock/wiki/Resources-Library#noevaljs-
It also can be used as $redirect
rules sometimes.
See redirect description.
example.org#%#//scriptlet('noeval')
Added in v1.0.4.
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-
example.org#%#//scriptlet('nowebrtc')
Added in v1.10.25.
Mocks the pd.js file of Salesforce. https://pi.pardot.com/pd.js https://developer.salesforce.com/docs/marketing/pardot/overview
example.org#%#//scriptlet('pardot-1.0')
Added in v1.10.25.
Mocks the prebid.js header bidding suit. https://docs.prebid.org/
example.org#%#//scriptlet('prebid')
Added in v1.0.4.
Prevents adding event listeners for the specified events and callbacks.
Related UBO scriptlet: https://github.com/gorhill/uBlock/wiki/Resources-Library#addeventlistener-defuserjs-
Related ABP snippet: https://gitlab.com/eyeo/snippets/-/blob/main/source/behavioral/prevent-listener.js
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 worklistenerSearch
— 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
-
Prevent all
click
listenersexample.org#%#//scriptlet('prevent-addEventListener', 'click')
-
Prevent 'click' listeners with the callback body containing
searchString
example.org#%#//scriptlet('prevent-addEventListener', 'click', 'searchString')
For instance, this listener will not be called:
el.addEventListener('click', () => { window.test = 'searchString'; });
Added in v1.0.4.
Prevents anti-adblock scripts on adfly short links.
Related UBO scriptlet: https://github.com/gorhill/uBlock/wiki/Resources-Library#adfly-defuserjs-
example.org#%#//scriptlet('prevent-adfly')
Added in v1.0.4.
Prevents BlockAdblock script from detecting an ad blocker.
Related UBO scriptlet: https://github.com/gorhill/uBlock/wiki/Resources-Library#bab-defuserjs-
It also can be used as $redirect
sometimes.
See redirect description.
example.org#%#//scriptlet('prevent-bab')
Added in v1.6.2.
Prevents target element source loading without triggering 'onerror' listeners and not breaking 'onload' ones.
example.org#%#//scriptlet('prevent-element-src-loading', tagName, match)
tagName
— required, case-insensitive target element tagName whichsrc
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;
-
Prevent script source loading
example.org#%#//scriptlet('prevent-element-src-loading', 'script' ,'adsbygoogle')
Added in v1.0.4.
Prevents page to use eval matching payload.
Related UBO scriptlet: https://github.com/gorhill/uBlock/wiki/Resources-Library#noeval-ifjs-
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
! Prevents eval if it matches 'test'
example.org#%#//scriptlet('prevent-eval-if', 'test')
Added in v1.0.4.
Prevents execution of the FAB script v3.2.0.
Related UBO scriptlet: https://github.com/gorhill/uBlock/wiki/Resources-Library#fuckadblockjs-320-
example.org#%#//scriptlet('prevent-fab-3.2.0')
Added in v1.3.18.
Prevents fetch
calls if all given parameters match.
Related UBO scriptlet: https://github.com/gorhill/uBlock/wiki/Resources-Library#no-fetch-ifjs-
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
wherename
isinit
option namevalue
is string or regular expression for matching the value of the option passed to fetch call; invalid regular expression will cause any value matching
- string or regular expression for matching the URL passed to fetch call;
empty string, wildcard
responseBody
— optional, string for defining response body value, defaults toemptyObj
. Possible values:emptyObj
— empty objectemptyArr
— empty arrayemptyStr
— empty string
responseType
— optional, string for defining response type, original response type is used if not specified. Possible values:basic
cors
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.
-
Log all fetch calls
example.org#%#//scriptlet('prevent-fetch')
-
Prevent all fetch calls
example.org#%#//scriptlet('prevent-fetch', '*') ! or example.org#%#//scriptlet('prevent-fetch', '')
-
Prevent fetch call for specific url
example.org#%#//scriptlet('prevent-fetch', '/url\\.part/')
-
Prevent fetch call for specific request method
example.org#%#//scriptlet('prevent-fetch', 'method:HEAD')
-
Prevent fetch call for specific url and request method
example.org#%#//scriptlet('prevent-fetch', '/specified_url_part/ method:/HEAD|GET/')
-
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') ! Specify response body for all fetch calls example.org#%#//scriptlet('prevent-fetch', '', 'emptyArr')
-
Prevent all fetch calls and specify response type value
example.org#%#//scriptlet('prevent-fetch', '*', '', 'opaque')
Added in v1.0.4.
Aborts on property write (PopAds, popns), throws reference error with random id.
Related UBO scriptlet: https://github.com/gorhill/uBlock/wiki/Resources-Library#popadsnetjs-
example.org#%#//scriptlet('prevent-popads-net')
Added in v1.6.2.
Prevents reloading of a document through a meta "refresh" tag.
Related UBO scriptlet: https://github.com/gorhill/uBlock/wiki/Resources-Library#refresh-defuserjs-
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.
-
Prevent reloading of a document through a meta "refresh" tag
example.org#%#//scriptlet('prevent-refresh')
-
Prevent reloading of a document with delay
example.com#%#//scriptlet('prevent-refresh', 3)
Added in v1.1.15.
Prevents a requestAnimationFrame
call
if the text of the callback is matching the specified search string which does not start with !
;
otherwise mismatched calls should be defused.
Related UBO scriptlet: https://github.com/gorhill/uBlock/wiki/Resources-Library#no-requestanimationframe-ifjs-
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.
-
Prevents
requestAnimationFrame
calls if the callback matches/\.test/
example.org#%#//scriptlet('prevent-requestAnimationFrame', '/\.test/')
For instance, the following call will be prevented:
var times = 0; requestAnimationFrame(function change() { window.test = 'new value'; if (times < 2) { times += 1; requestAnimationFrame(change); } });
-
Prevents
requestAnimationFrame
calls if does not match 'check'example.org#%#//scriptlet('prevent-requestAnimationFrame', '!check')
For instance, only the first call will be prevented:
var timesFirst = 0; requestAnimationFrame(function changeFirst() { window.check = 'should not be prevented'; if (timesFirst < 2) { timesFirst += 1; requestAnimationFrame(changeFirst); } }); var timesSecond = 0; requestAnimationFrame(function changeSecond() { window.second = 'should be prevented'; if (timesSecond < 2) { timesSecond += 1; requestAnimationFrame(changeSecond); } });
Added in v1.0.4.
Prevents a setInterval
call if:
- The text of the callback is matching the specified
matchCallback
string/regexp which does not start with!
; otherwise mismatched calls should be defused. - 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-
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 allsetInterval
calls due to specifiedmatchDelay
.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 thesetInterval
call will be matched. Decimal delay values will be rounded down, e.g10.95
will be matched bymatchDelay
with value10
.
If
prevent-setInterval
log looks likesetInterval(undefined, 1000)
, it means that no callback was passed to setInterval() and that's not scriptlet issue and obviously it can not be matched bymatchCallback
.
-
Prevents
setInterval
calls if the callback matches/\.test/
regardless of the delayexample.org#%#//scriptlet('prevent-setInterval', '/\.test/')
For instance, the following call will be prevented:
setInterval(function () { window.test = "value"; }, 100);
-
Prevents
setInterval
calls if the callback does not containvalue
example.org#%#//scriptlet('prevent-setInterval', '!value')
For instance, only the first of the following calls will be prevented:
setInterval(function () { window.test = "test -- prevented"; }, 300); setInterval(function () { window.test = "value -- executed"; }, 400); setInterval(function () { window.value = "test -- executed"; }, 500);
-
Prevents
setInterval
calls if the callback containsvalue
and the delay is not set to300
example.org#%#//scriptlet('prevent-setInterval', 'value', '!300')
For instance, only the first of the following calls will not be prevented:
setInterval(function () { window.test = "value 1 -- executed"; }, 300); setInterval(function () { window.test = "value 2 -- prevented"; }, 400); setInterval(function () { window.test = "value 3 -- prevented"; }, 500);
-
Prevents
setInterval
calls if the callback does not containvalue
and the delay is not set to300
example.org#%#//scriptlet('prevent-setInterval', '!value', '!300')
For instance, only the second of the following calls will be prevented:
setInterval(function () { window.test = "test -- executed"; }, 300); setInterval(function () { window.test = "test -- prevented"; }, 400); setInterval(function () { window.test = "value -- executed"; }, 400); setInterval(function () { window.value = "test -- executed"; }, 500);
-
Prevents
setInterval
calls if the callback containsvalue
and delay is a decimal numberexample.org#%#//scriptlet('prevent-setInterval', 'value', '300')
For instance, the following calls will be prevented:
setInterval(function () { window.test = "value"; }, 300); setInterval(function () { window.test = "value"; }, 300 + Math.random());
Added in v1.0.4.
Prevents a setTimeout
call if:
- The text of the callback is matching the specified
matchCallback
string/regexp which does not start with!
; otherwise mismatched calls should be defused. - 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-
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 allsetTimeout
calls due to specifiedmatchDelay
.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 thesetTimeout
call will be matched. Decimal delay values will be rounded down, e.g10.95
will be matched bymatchDelay
with value10
.
If
prevent-setTimeout
log looks likesetTimeout(undefined, 1000)
, it means that no callback was passed to setTimeout() and that's not scriptlet issue and obviously it can not be matched bymatchCallback
.
-
Prevents
setTimeout
calls if the callback matches/\.test/
regardless of the delayexample.org#%#//scriptlet('prevent-setTimeout', '/\.test/')
For instance, the following call will be prevented:
setTimeout(function () { window.test = "value"; }, 100);
-
Prevents
setTimeout
calls if the callback does not containvalue
example.org#%#//scriptlet('prevent-setTimeout', '!value')
For instance, only the first of the following calls will be prevented:
setTimeout(function () { window.test = "test -- prevented"; }, 300); setTimeout(function () { window.test = "value -- executed"; }, 400); setTimeout(function () { window.value = "test -- executed"; }, 500);
-
Prevents
setTimeout
calls if the callback containsvalue
and the delay is not set to300
example.org#%#//scriptlet('prevent-setTimeout', 'value', '!300')
For instance, only the first of the following calls will not be prevented:
setTimeout(function () { window.test = "value 1 -- executed"; }, 300); setTimeout(function () { window.test = "value 2 -- prevented"; }, 400); setTimeout(function () { window.test = "value 3 -- prevented"; }, 500);
-
Prevents
setTimeout
calls if the callback does not containvalue
and the delay is not set to300
example.org#%#//scriptlet('prevent-setTimeout', '!value', '!300')
For instance, only the second of the following calls will be prevented:
setTimeout(function () { window.test = "test -- executed"; }, 300); setTimeout(function () { window.test = "test -- prevented"; }, 400); setTimeout(function () { window.test = "value -- executed"; }, 400); setTimeout(function () { window.value = "test -- executed"; }, 500);
-
Prevents
setTimeout
calls if the callback containsvalue
and delay is a decimalexample.org#%#//scriptlet('prevent-setTimeout', 'value', '300')
For instance, the following calls will be prevented:
setTimeout(function () { window.test = "value"; }, 300); setTimeout(function () { window.test = "value"; }, 300 + Math.random());
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.
Related UBO scriptlet: https://github.com/gorhill/uBlock/wiki/Resources-Library#no-window-open-ifjs-
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.delay
— optional, number of seconds. If not set, scriptlet will returnnull
, otherwise valid sham window object as injectediframe
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 validwindow
instance to be returnedlog
— for logging window.open calls; not allowed for prod versions of filter lists.
-
Prevent all
window.open
callsexample.org#%#//scriptlet('prevent-window-open')
-
Prevent
window.open
for all URLs containingexample
example.org#%#//scriptlet('prevent-window-open', 'example')
-
Prevent
window.open
for all URLs matching RegExp/example\./
example.org#%#//scriptlet('prevent-window-open', '/example\./')
-
Prevent
window.open
for all URLs NOT containingexample
example.org#%#//scriptlet('prevent-window-open', '!example')
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 towindow.open
call; defaults to search allwindow.open
callreplacement
— optional, string to return prop value or property instead of window.open; defaults to return noopFunc.
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.
Added in v1.5.0.
Prevents xhr
calls if all given parameters match.
Related UBO scriptlet: https://github.com/gorhill/uBlock/wiki/Resources-Library#no-xhr-ifjs-
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 allXMLHttpRequest.open()
calls match- colon-separated pairs
name:value
wherename
is XMLHttpRequest object property namevalue
is string or regular expression for matching the value of the option passed toXMLHttpRequest.open()
call
- colon-separated pairs
- string or regular expression for matching the URL passed to
randomize
— defaults tofalse
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 wherename
— onlylength
supported for nowvalue
— range on numbers, for example100-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.
-
Log all XMLHttpRequests
example.org#%#//scriptlet('prevent-xhr')
-
Prevent all XMLHttpRequests
example.org#%#//scriptlet('prevent-xhr', '*') example.org#%#//scriptlet('prevent-xhr', '')
-
Prevent XMLHttpRequests for specific url
example.org#%#//scriptlet('prevent-xhr', 'example.org')
-
Prevent XMLHttpRequests for specific request method
example.org#%#//scriptlet('prevent-xhr', 'method:HEAD')
-
Prevent XMLHttpRequests for specific url and specified request methods
example.org#%#//scriptlet('prevent-xhr', 'example.org method:/HEAD|GET/')
-
Prevent XMLHttpRequests for specific url and randomize it's response text
example.org#%#//scriptlet('prevent-xhr', 'example.org', 'true')
-
Prevent XMLHttpRequests for specific url and randomize it's response text with range
example.org#%#//scriptlet('prevent-xhr', 'example.org', 'length:100-300')
Added in v1.0.4.
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, or as specified by applying argument.
Related UBO scriptlet: https://github.com/gorhill/uBlock/wiki/Resources-Library#remove-attrjs-
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 removedapplying
— 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 oncecomplete
— runs once after the whole page has been loadedstay
— as fast as possible and stays on the page observing possible DOM changes
-
Removes by attribute
example.org#%#//scriptlet('remove-attr', 'example|test')
<!-- before --> <div example="true" test="true">Some text</div> <!-- after --> <div>Some text</div>
-
Removes with specified selector
example.org#%#//scriptlet('remove-attr', 'example', 'div[class="inner"]')
<!-- before --> <div class="wrapper" example="true"> <div class="inner" example="true">Some text</div> </div> <!-- after --> <div class="wrapper" example="true"> <div class="inner">Some text</div> </div>
-
Using flags
example.org#%#//scriptlet('remove-attr', 'example', 'html', 'asap complete')
Added in v1.1.1.
Removes the specified classes from DOM nodes. This scriptlet runs once after the page loads and after that periodically in order to DOM tree changes.
Related UBO scriptlet: https://github.com/gorhill/uBlock/wiki/Resources-Library#remove-classjs-
example.org#%#//scriptlet('remove-class', classes[, selector, applying])
classes
— required, class or list of classes separated by '|'selector
— optional, CSS selector, specifies DOM nodes from which the classes will be removed. If there is noselector
, each class ofclasses
independently will be removed from all nodes which has oneapplying
— 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 oncecomplete
— runs once after the whole page has been loadedstay
— as fast as possible and stays on the page observing possible DOM changes
-
Removes by classes
example.org#%#//scriptlet('remove-class', 'example|test')
<!-- before --> <div id="first" class="nice test">Some text</div> <div id="second" class="rare example for test">Some text</div> <div id="third" class="testing better example">Some text</div> <!-- after --> <div id="first" class="nice">Some text</div> <div id="second" class="rare for">Some text</div> <div id="third" class="testing better">Some text</div>
-
Removes with specified selector
example.org#%#//scriptlet('remove-class', 'branding', 'div[class^="inner"]')
<!-- before --> <div class="wrapper true branding"> <div class="inner bad branding">Some text</div> </div> <!-- after --> <div class="wrapper true branding"> <div class="inner bad">Some text</div> </div>
-
Using flags
example.org#%#//scriptlet('remove-class', 'branding', 'div[class^="inner"]', 'asap complete')
Added in v1.0.4.
Removes current page cookies by passed string matching with name. For current domain and subdomains. Runs on load and before unload.
Related UBO scriptlet: https://github.com/gorhill/uBlock/wiki/Resources-Library#cookie-removerjs-
Related ABP source: https://gitlab.com/eyeo/snippets/-/blob/main/source/behavioral/cookie-remover.js
example.org#%#//scriptlet('remove-cookie'[, match])
match
— optional, string or regex matching the cookie name. If not specified all accessible cookies will be removed.
-
Removes all cookies
example.org#%#//scriptlet('remove-cookie')
-
Removes cookies which name contains
example
stringexample.org#%#//scriptlet('remove-cookie', 'example')
For instance this cookie will be removed:
document.cookie = '__example=randomValue';
Added in v1.3.14.
Removes elements inside open shadow DOM elements.
example.org#%#//scriptlet('remove-in-shadow-dom', selector[, baseSelector])
selector
— required, CSS selector of element in shadow-dom to removebaseSelector
— 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.
! removes menu bar
virustotal.com#%#//scriptlet('remove-in-shadow-dom', 'iron-pages', 'vt-virustotal-app')
! removes floating element
virustotal.com#%#//scriptlet('remove-in-shadow-dom', 'vt-ui-contact-fab')
Added in v1.9.37.
Removes text from DOM nodes.
Related UBO scriptlet: https://github.com/gorhill/uBlock/commit/2bb446797a12086f2eebc0c8635b671b8b90c477
example.org#%#//scriptlet('remove-node-text', nodeName, condition)
nodeName
— required, string or RegExp, specifies DOM node name from which the text will be removed. Must target lowercased node names, e.gdiv
instead ofDIV
.textMatch
— required, string or RegExp to match against node's text content. If matched, the whole text will be removed. Case sensitive.
-
Remove node's text content:
example.org#%#//scriptlet('remove-node-text', 'div', 'some text')
<!-- before --> <div>some text</div> <span>some text</span> <!-- after --> <div></div > <span>some text</span>
-
Remove node's text content, matching both node name and condition by RegExp:
example.org#%#//scriptlet('remove-node-text', '/[a-z]*[0-9]/', '/text/')
<!-- before --> <qrce3>some text</qrce3> <span>some text</span> <!-- after --> <qrce3></qrce3> <span>some text</span>
Added in v1.10.25.
example.org#%#//scriptlet('scorecardresearch-beacon')
Added in v1.5.0.
Sets attribute with permitted value on the specified elements. This scriptlet runs once when the page loads and after that on DOM tree changes.
Related UBO scriptlet: https://github.com/gorhill/uBlock/wiki/Resources-Library#set-attrjs-
example.org#%#//scriptlet('set-attr', selector, attr[, value])
selector
— required, CSS selector, specifies DOM nodes to set attributes onattr
— required, attribute to be setvalue
— optional, the value to assign to the attribute, defaults to ''. Possible values:''
— empty string- positive decimal integer
<= 32767
true
/false
in any case variation[attribute-name]
copy the value from attributeattribute-name
on the same element.
-
Set attribute by selector
example.org#%#//scriptlet('set-attr', 'div.class > a.class', 'test-attribute', '0')
<!-- before --> <div> <a>Another text</a> <a class="class">Some text</a> </div> <!-- after --> <div> <a>Another text</a> <a class="class" test-attribute="0">Some text</a> </div>
-
Set attribute without value
example.org#%#//scriptlet('set-attr', 'a.class', 'test-attribute')
<!-- before --> <a class="class">Some text</div> <!-- after --> <a class="class" test-attribute>Some text</div>
-
Set attribute value to
TRUE
example.org#%#//scriptlet('set-attr', 'a.class', 'test-attribute', 'TRUE')
<!-- before --> <a class="class">Some text</div> <!-- after --> <a class="class" test-attribute="TRUE">Some text</div>
-
Set attribute value to
fAlse
example.org#%#//scriptlet('set-attr', 'a.class', 'test-attribute', 'fAlse')
<!-- before --> <a class="class">Some text</div> <!-- after --> <a class="class" test-attribute="fAlse">Some text</div>
-
Copy attribute value from the target element
example.org#%#//scriptlet('set-attr', 'iframe[data-cur]', 'href', '[data-cur]')
<!-- before --> <iframe data-cur="good-url.com" href="bad-url.org"></iframe> <!-- after --> <iframe data-cur="good-url.com" href="good-url.com"></iframe>
Added in v1.0.4.
Creates a constant property and assigns it one of the values from the predefined list.
Actually, it's not a constant. Please note, that it can be rewritten with a value of a different type.
If empty object is present in chain it will be trapped until chain leftovers appear.
Related UBO scriptlet: https://github.com/gorhill/uBlock/wiki/Resources-Library#set-constantjs-
Related ABP snippet: https://github.com/adblockplus/adblockpluscore/blob/adblockpluschrome-3.9.4/lib/content/snippets.js#L1361
example.org#%#//scriptlet('set-constant', property, value[, stack,[ valueWrapper[, setProxyTrap]]])
property
— required, path to a property (joined with.
if needed). The property must be attached towindow
.value
— required. Possible values:- positive decimal integer
<= 32767
- one of the predefined constants:
undefined
false
true
null
emptyObj
— empty objectemptyArr
— empty arraynoopFunc
— function with empty bodynoopCallbackFunc
— function returning noopFunctrueFunc
— function returning truefalseFunc
— function returning falsethrowFunc
— function throwing an errornoopPromiseResolve
— function returning Promise object that is resolved with an empty responsenoopPromiseReject
— function returning Promise.reject()''
— empty string-1
— number value-1
yes
no
- positive decimal integer
stack
— string or regular expression that must match the current function call stack trace, defaults to matching every call; if regular expression is invalid, it will be skippedvalueWrapper
– optional, string to modify a value to be set. Possible wrappers:asFunction
– function returning valueasCallback
– function returning callback, that would return valueasResolved
– Promise that would resolve with valueasRejected
– Promise that would reject with value
setProxyTrap
– optional, boolean, if set to true, proxy trap will be set on the object
! Any access to `window.first` will return `false`
example.org#%#//scriptlet('set-constant', 'first', 'false')
✔ window.first === false
! Any call to `window.second()` will return `true`
example.org#%#//scriptlet('set-constant', 'second', 'trueFunc')
✔ window.second() === true
✔ window.second.toString() === "function trueFunc() {return true;}"
! Any call to `document.third()` will return `true` if the method is related to `checking.js`
example.org#%#//scriptlet('set-constant', 'document.third', 'trueFunc', 'checking.js')
✔ document.third() === true // if the condition described above is met
! Any call to `document.fourth()` will return `yes`
example.org#%#//scriptlet('set-constant', 'document.fourth', 'yes', '', 'asFunction')
✔ document.fourth() === 'yes'
! Any call to `document.fifth()` will return `yes`
example.org#%#//scriptlet('set-constant', 'document.fifth', '42', '', 'asRejected')
✔ document.fifth.catch((reason) => reason === 42) // promise rejects with specified number
! Any access to `window.foo.bar` will return `false` and the proxy trap will be set on the `foo` object
! It may be required in the case when `foo` object is overwritten by website script
! Related to this issue - https://github.com/AdguardTeam/Scriptlets/issues/330
example.org#%#//scriptlet('set-constant', 'foo.bar', 'false', '', '', 'true')
✔ window.foo.bar === false
Added in v1.3.14.
Sets a cookie with the specified name and value, path, and domain, and reloads the current page after the cookie setting. If reloading option is not needed, use set-cookie scriptlet.
example.org#%#//scriptlet('set-cookie-reload', name, value[, path[, domain]])
name
— required, cookie name to be setvalue
— required, cookie value; possible values:- positive decimal integer
<= 32767
- one of the predefined constants in any case variation:
true
/t
false
/f
yes
/y
no
/n
ok
on
/off
accept
/accepted
/notaccepted
reject
/rejected
allow
/allowed
disallow
/deny
enable
/enabled
disable
/disabled
necessary
/required
hide
/hidden
essential
/nonessential
checked
/unchecked
- positive decimal integer
path
— optional, cookie path, defaults to/
; possible values:/
— root pathnone
— to set no path at all
domain
— optional, cookie domain, if not set origin will be set as domain, if the domain does not match the origin, the cookie will not be set
Note that the scriptlet does not encode a cookie name, e.g. name 'a:b' will be set as 'a:b' and not as 'a%3Ab'.
Also if a cookie name includes
;
, the cookie will not be set since this may cause the cookie to break.
example.org#%#//scriptlet('set-cookie-reload', 'checking', 'ok')
example.org#%#//scriptlet('set-cookie-reload', 'gdpr-settings-cookie', '1')
example.org#%#//scriptlet('set-cookie-reload', 'cookie-set', 'true', 'none')
example.org#%#//scriptlet('set-cookie-reload', 'test', '1', 'none', 'example.org')
Added in v1.2.3.
Sets a cookie with the specified name, value, path, and domain.
Related UBO scriptlet: https://github.com/gorhill/uBlock/wiki/Resources-Library#set-cookiejs-
example.org#%#//scriptlet('set-cookie', name, value[, path[, domain]])
name
— required, cookie name to be setvalue
— required, cookie value; possible values:- positive decimal integer
<= 32767
- one of the predefined constants in any case variation:
true
/t
false
/f
yes
/y
no
/n
ok
on
/off
accept
/accepted
/notaccepted
reject
/rejected
allow
/allowed
disallow
/deny
enable
/enabled
disable
/disabled
necessary
/required
hide
/hidden
essential
/nonessential
checked
/unchecked
- positive decimal integer
path
— optional, cookie path, defaults to/
; possible values:/
— root pathnone
— to set no path at all
domain
— optional, cookie domain, if not set origin will be set as domain, if the domain does not match the origin, the cookie will not be set
Note that the scriptlet does not encode a cookie name, e.g. name 'a:b' will be set as 'a:b' and not as 'a%3Ab'.
Also if a cookie name includes
;
, the cookie will not be set since this may cause the cookie to break.
example.org#%#//scriptlet('set-cookie', 'CookieConsent', '1')
example.org#%#//scriptlet('set-cookie', 'gdpr-settings-cookie', 'true')
example.org#%#//scriptlet('set-cookie', 'cookie_consent', 'ok', 'none')
example.org#%#//scriptlet('set-cookie-reload', 'test', '1', 'none', 'example.org')
Added in v1.4.3.
Adds specified key and its value to localStorage object, or updates the value of the key if it already exists. Scriptlet won't set item if storage is full.
To remove item from localStorage use $remove$
as a value.
Related UBO scriptlet: https://github.com/gorhill/uBlock/wiki/Resources-Library#set-local-storage-itemjs-
example.com#%#//scriptlet('set-local-storage-item', 'key', 'value')
key
— required, key name to be set. Should be a string for setting, but it also can be a regular expression for removing items from localStorage.value
— required, key value; possible values:- positive decimal integer
<= 32767
- one of the predefined constants in any case variation:
undefined
false
true
null
emptyObj
— empty objectemptyArr
— empty array''
— empty stringyes
no
on
off
accept
accepted
reject
rejected
allowed
denied
$remove$
— remove specific item from localStorage
- positive decimal integer
example.org#%#//scriptlet('set-local-storage-item', 'player.live.current.mute', 'false')
example.org#%#//scriptlet('set-local-storage-item', 'exit-intent-marketing', '1')
! Removes the item with key 'foo' from local storage
example.org#%#//scriptlet('set-local-storage-item', 'foo', '$remove$')
! Removes from local storage all items whose key matches the regular expression `/mp_.*_mixpanel/`
example.org#%#//scriptlet('set-local-storage-item', '/mp_.*_mixpanel/', '$remove$')
Added in v1.0.4.
Sets static properties PopAds and popns.
Related UBO scriptlet: https://github.com/gorhill/uBlock/wiki/Resources-Library#popads-dummyjs-
example.org#%#//scriptlet('set-popads-dummy')
Added in v1.4.3.
Adds specified key and its value to sessionStorage object, or updates the value of the key if it already exists. Scriptlet won't set item if storage is full.
To remove item from sessionStorage use $remove$
as a value.
Related UBO scriptlet: https://github.com/gorhill/uBlock/wiki/Resources-Library#set-session-storage-itemjs-
example.com#%#//scriptlet('set-session-storage-item', 'key', 'value')
key
— required, key name to be set. Should be a string for setting, but it also can be a regular expression for removing items from localStorage.value
— required, key value; possible values:- positive decimal integer
<= 32767
- one of the predefined constants in any case variation:
undefined
false
true
null
emptyObj
— empty objectemptyArr
— empty array''
— empty stringyes
no
on
off
accept
accepted
reject
rejected
allowed
denied
$remove$
— remove specific item from sessionStorage
- positive decimal integer
example.org#%#//scriptlet('set-session-storage-item', 'player.live.current.mute', 'false')
example.org#%#//scriptlet('set-session-storage-item', 'exit-intent-marketing', '1')
! Removes the item with key 'foo' from session storage
example.org#%#//scriptlet('set-session-storage-item', 'foo', '$remove$')
! Removes from session storage all items whose key matches the regular expression `/mp_.*_mixpanel/`
example.org#%#//scriptlet('set-session-storage-item', '/mp_.*_mixpanel/', '$remove$')
Added in v1.10.1.
Spoof CSS property value when getComputedStyle()
or getBoundingClientRect()
methods is called.
Related UBO scriptlet: https://github.com/gorhill/uBlock/wiki/Resources-Library#spoof-cssjs-
example.org#%#//scriptlet('spoof-css', selectors, cssNameProperty, cssNameValue)
selectors
— string of comma-separated selectors to matchcssPropertyName
— CSS property namecssPropertyValue
— CSS property value
Call with
debug
ascssPropertyName
andtruthy
value ascssPropertyValue
will trigger debugger statement whengetComputedStyle()
orgetBoundingClientRect()
methods is called. It may be useful for debugging but it is not allowed for prod versions of filter lists.
-
Spoof CSS property value
display
toblock
for all elements with classadsbygoogle
:example.org#%#//scriptlet('spoof-css', '.adsbygoogle', 'display', 'block')
-
Spoof CSS property value
height
to100
for all elements with classadsbygoogle
andadvert
:example.org#%#//scriptlet('spoof-css', '.adsbygoogle, .advert', 'height', '100')
-
To invoke debugger statement:
example.org#%#//scriptlet('spoof-css', '.adsbygoogle', 'debug', 'true')
Added in v1.7.3.
Removes an element from the specified XML.
Related UBO scriptlet: https://github.com/gorhill/uBlock/wiki/Resources-Library#xml-prunejs-
example.org#%#//scriptlet('xml-prune'[, propsToMatch[, optionalProp[, urlToMatch]]])
propsToMatch
— optional, XPath or selector of elements which will be removed from XMLoptionalProp
— optional, selector of elements that must occur in XML documenturlToMatch
— optional, string or regular expression for matching the request's URLverbose
— optional, boolean, if set to 'true' will log original and modified XML content
verbose
may be useful for debugging but it is not allowed for prod versions of filter lists.
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.
-
Remove
Period
tag whoseid
contains-ad-
from all requestsexample.org#%#//scriptlet('xml-prune', 'Period[id*="-ad-"]')
-
Remove
Period
tag whoseid
contains-ad-
, only if XML containsSegmentTemplate
example.org#%#//scriptlet('xml-prune', 'Period[id*="-ad-"]', 'SegmentTemplate')
-
Remove
Period
tag whoseid
contains-ad-
, only if request's URL contains.mpd
example.org#%#//scriptlet('xml-prune', 'Period[id*="-ad-"]', '', '.mpd')
-
Remove
Period
tag whoseid
contains-ad-
, only if request's URL contains.mpd
and log contentexample.org#%#//scriptlet('xml-prune', 'Period[id*="-ad-"]', '', '.mpd', 'true')
-
Remove
Period
tag whoseid
containspre-roll
and removeduration
attribute from thePeriod
tag by using XPath expressionexample.org#%#//scriptlet('xml-prune', 'xpath(//*[name()="Period"][contains(@id, "pre-roll") and contains(@id, "-ad-")] | //*[name()="Period"]/@duration)')
-
Call with no arguments will log response payload and URL at the console
example.org#%#//scriptlet('xml-prune')
-
Call with only
urlToMatch
argument will log response payload and URL only for the matched URLexample.org#%#//scriptlet('xml-prune', '', '', '.mpd')