1
0
mirror of https://github.com/gorhill/uBlock.git synced 2024-11-06 19:02:30 +01:00
Commit Graph

1119 Commits

Author SHA1 Message Date
Raymond Hill
2a9378b5a8
Use non-minified lists for stable release of assets.json
Because this is what the current stable release (1.49.2) ships
with.

Related feedback:
- https://www.reddit.com/r/uBlockOrigin/comments/13n0p4g/
2023-05-20 22:01:55 -04:00
Raymond Hill
d506b28a48
Patch Unicode country flags with image-based flags
Related issue:
- https://github.com/uBlockOrigin/uBlock-issues/issues/2645
2023-05-20 21:35:52 -04:00
Raymond Hill
d405460584
Add spoof-css scriptlet
Related issue:
- https://github.com/uBlockOrigin/uBlock-issues/issues/2618

Usage:

    example.com##+js(spoof-css, selector, property-name, property-value, ...)

- selector: a valid CSS selector which matches the elements for which
  the spoofing must apply.
- property-name: a CSS property name (can be dashed- or camel-cased)
- property-value: the value to return regardless of the currently
  computed value.

There can be any number of property-name/property-value pairs, all
separated by commas.

A special property-name/property-value pair `debug/1` can be used
to force the browser to break when `getComputedStyle()` or
`getBoundingClientrect()` is called, useful to help pinpoint usage
of those calls in the page's source code:

    example.com##+js(spoof-css, .ad, debug, 1)
2023-05-20 17:18:44 -04:00
Raymond Hill
02dff78eab
Add back AdGuard Tracking Protection
As per discussion with fitler list maintainers.
2023-05-19 13:11:51 -04:00
Raymond Hill
2ef2888805
Expand/harden some scriptlets
Related issue:
- https://github.com/uBlockOrigin/uBlock-issues/issues/2615

Expand `set-constant`: 3rd parameter and beyond are tokens which
modify the behavior of `set-contant`. Valid tokens:

- `interactive`, `end`, `2`: set the constant when the event
  `DOMContentInteractive` is fired.
- `complete`, `idle`, `3`: set the constant when the event
  `load` is fired.
- `asFunction`: the constant will be a function returning the
  specified value.
- `asCallback`: the constant will be a function returning a
  function returning the specified value.
- `asResolved`: the constant will be a promise resolving to
  the specified value.
- `asRejected`: the constant will be a promise failing with
  the specified value.

Harden `no-setimeout-if` and `no-setinterval-if` as per feedback
from filter list maintainers.
2023-05-19 12:55:01 -04:00
Raymond Hill
df5437a54f
Revert "Render List stats below on mobile"
This reverts commit 9ea39886b6.
2023-05-17 15:44:11 -04:00
Raymond Hill
bcb5c441a9
Work on tags (more to do) 2023-05-16 19:49:57 -04:00
Raymond Hill
9ea39886b6
Render List stats below on mobile 2023-05-16 12:10:40 -04:00
Raymond Hill
e79d9b2f85
Add more minified version of uBO lists 2023-05-13 15:20:35 -04:00
Raymond Hill
c1ac09b96a
Address #17921 2023-05-10 08:50:52 -04:00
Raymond Hill
39a8aaa39b
Rmove unicode-based flags 2023-05-09 09:51:34 -04:00
Raymond Hill
84fad1deeb
Add support for sublists in "Filter lists" pane
As discussed internally with filter list maintainers.

Additionally, added a search field to filter out lists. This
is still a work in progress, no need to open issues about this,
I am aware of what is missing (i18n, more tags, etc.)
2023-05-06 12:50:25 -04:00
Raymond Hill
47c458c27c
Fix bad renaming 2023-05-05 20:56:55 -04:00
Raymond Hill
b884d71f04
Use tabs instead of spaces 2023-05-05 10:20:12 -04:00
Raymond Hill
53ba8ded5c
Split AdGuard Annoyances into sublists 2023-05-05 10:13:35 -04:00
Raymond Hill
68539e1fd3
Deprecate "Fanboy Annoyances" in assets.dev.json
To be replaced with five sublists.

Users who are already subscribed to the list will have to manually
unsubscribe from it, which will be moved to _Custom_ section, and
subscribe to the sublists which have narrower purpose.
2023-05-05 09:53:25 -04:00
Raymond Hill
223815342e
Make dev build use its own assets.json: assets.dev.json
This will make it easier to safely test new versions of
assets.json.
2023-05-04 19:20:18 -04:00
Raymond Hill
42106cf5ff
Update URLs of NLD list
Related issue:
- https://github.com/uBlockOrigin/uAssets/discussions/17919
2023-05-03 19:35:29 -04:00
Raymond Hill
e6e5b1eac4
Add Fanboy lists optimized for uBO: Cookie & Social
Related discussion:
- https://github.com/uBlockOrigin/uBlock-issues/discussions/2612
2023-04-29 12:17:51 -04:00
Raymond Hill
bbda637294
Host a minified version of uBO lists on CDNs 2023-04-28 17:30:13 -04:00
Raymond Hill
6c29ae82f2
Protect against possible page modification to addEventListener 2023-04-28 07:58:23 -04:00
Raymond Hill
3c12173dfe
Add ability to execute aeld scriptlet at a later time
As per discussion with filter list maintainers.

THis requires to use JSON notation for parameter passing:

- "runAt":  "end" = execute scriptlet at `DOMContentLoaded` event
- "runAt": "idle" = execute scriptlet at `load` event
2023-04-27 12:52:17 -04:00
Raymond Hill
d3fbef5f9c
Use uBO-optimized Fanboy lists
Related issue:
- https://github.com/uBlockOrigin/uBlock-issues/issues/2610
2023-04-24 12:05:27 -04:00
Raymond Hill
349c8ca619
Fix overzealous logging in acs scriptlet 2023-04-23 09:28:59 -04:00
Raymond Hill
2ab2b48066
Updated the Finnish list source address (#3894)
Co-authored-by: peace2000 <17256841+peace2000@users.noreply.github.com>
2023-04-18 09:46:33 -04:00
Raymond Hill
cc062d3a8a
No need for redundant "safe" 2023-04-15 11:14:14 -04:00
Raymond Hill
e1500ee88d
Add ability to defer set-constant execution
A new optional parameter has been added to `set-constant`
scriptlet: `runAt`, default to `0`.

 ..##+js(set, document.body.oncontextmenu, null, 2)

When the `runAt` parameter is present, uBO will take it into
account to possibly defer execution of `set-constant`:

- `runAt` not present: execute immediately
- `runAt` = 1: execute immediately
- `runAt` = 2: execute when document state is "interactive"
- `runAt` = 3: execute when document state is `"complete"
2023-04-11 21:45:40 -04:00
Raymond Hill
edbe96a401
Add logging ability to acs scriptlet, for the benefit of filter list
maintainers.

To enable logging, use the JSON approach to pass parameters to
`acs` scriptlet. Example:

    ..##+js(acs, { "target": "document.oncontextmenu", "log": true })

Whereas "target", "needle", and "context" correspond to their
respective positional argument. Using JSON form to pass parameters
allows to specify extra paramters to facilitate debugging of that
scriptlet:

- `"log": true` => output useful information at the dev console.
- `"debug": true` => break at key locations in the scriptlet.

The added logging/debugging capabilities work only in the dev build
of uBO or if the advanced setting `filterAuthorMode` is set to
`true`.
2023-04-02 12:01:58 -04:00
Raymond Hill
b5d78a07bf
Fix type in variable name
Related issue:
- https://github.com/uBlockOrigin/uBlock-issues/issues/2570
2023-03-30 20:46:44 -04:00
Raymond Hill
c8af55e27a
Harden aeld scriptlet against page's tampering
Related feedback:
- https://github.com/uBlockOrigin/uBlock-discussions/discussions/1#discussioncomment-5433222
2023-03-26 14:02:21 -04:00
Raymond Hill
5c9c87e485
Add ability for scriptlets to share local data
Related issue:
- https://github.com/uBlockOrigin/uBlock-issues/issues/1741

As a result of the new capability, usage of RegExp API in `aost`
scriptlet has been shielded from the webpage tampering with the
API.
2023-03-26 12:31:36 -04:00
Raymond Hill
236fb3ad59
Add scriptlet dependencies to reduce code duplication 2023-03-26 09:13:17 -04:00
Raymond Hill
439951824a
Remove addEventListenerLogger, expand addEventListenerDefuser
The scriptlet addEventListenerLogger has been removed.

The logging of addEventListener() calls can now be done with the
addEventListenerDefuser scriptlet, which now supports the
following named arguments:

"type": the event type to match. Default to '', i.e. match-all.

"pattern": the pattern to match against the handler argument
Default to '', i.e. match-all.

"log": an integer value telling when to log:

- 1: log only when both type and pattern matches, i.e. when a
     call to addEventListener() is defused
- 2: log when either the type or pattern matches
- 3: log all calls to addEventListener()

"debug": an integer value telling when to break into the
 debugger, useful to inspect the debugger's call stack.

- 1: break into the debugger when both type and pattern match,
     so effectively when defusing is taking place.
- 2: break into the debugger when either type or pattern matches.

The usage of named arguments is optional, positional arguments
are still supported as documented. Named arguments is required
to use "log" and/or "debug" arguments.

Obviously, do not use "log" or "debug" in any filter list, these
are investigative tools for filter list authors.

Examples of usage using named arguments:

  wikipedia.org##+js(aeld, { "type": "/mouse/", "pattern": "/.^/", "log": 2 })

Above filter will log calls to addEventListener() which have the
pattern "mouse" in the event type (so "mouseover", "mouseout",
etc.) without defusing any of them (because pattern can't match
anything).

  wikipedia.org##+js(aeld, { "type": "/.^/", "log": 2 })

Above filter will log all calls without defusing any of them
(because type can't match anything)

  wikipedia.org##+js(aeld, { "log": 1 })

Above filter will log and defuse all calls to addEventListener().
2023-03-25 12:35:56 -04:00
Raymond Hill
a51130baed
Remove unused scriptlets 2023-03-24 18:46:39 -04:00
Raymond Hill
18a84d2819
Refactor scriptlets injection code
Builtin scriptlets are no longer parsed as text-based resources,
they are imported as JS functions, and `toString()` is used to
obtain text-based representation of a scriptlet.

Scriptlet parameters are now passed as function call arguments
rather than by replacing text-based occurrences of `{{i}}`. The
arguments are always string values (see below for exception).

Support for argument as Object has been added. This opens the
door to have scriptlets using named arguments rather than
positional arguments, and hence easier to extend functionality
of existing scriptlets. Example:

    example.com##+js(scriplet, { "prop": "adblock", "value": false, "log": true })

Compatibility with user-provided scriptlets has been preserved.

User-provided scriptlets can benefit some of the changes:

Use the form `function(..){..}` instead of `(function(..){..})();`
in order to received scriptlet arguments as part of function call
-- instead of using `{{i}}`.

If using the form `function(..){..}`, you can choose to receive
an Object as argument -- just be sure that your scriptlet's
parameter is valid JSON notation.
2023-03-24 14:05:18 -04:00
Raymond Hill
285ce54d9c
Add regional filter list for Croatia/Serbia
Related discussion:
- https://github.com/uBlockOrigin/uAssets/issues/17088#issuecomment-1460942565
2023-03-21 09:56:43 -04:00
Raymond Hill
e93117cbb6
Add call-nothrow scriptlet
The purpose is to prevent a call to an existing function from
throwing an exception. The exception will be caught by the
scriptlet and neutralized.

The first argument must be a reference to a function call. At
the moment, the function call must exist at the time the
scriptlet is called.
2023-03-14 18:50:01 -04:00
Raymond Hill
5fe0416001
Fix https://github.com/uBlockOrigin/uBlock-issues/issues/2546 2023-03-14 14:05:20 -04:00
Raymond Hill
fc84fdee52
Fine tune scriptlet 2023-03-14 08:21:22 -04:00
Raymond Hill
b3821e6869
Support removing whole lines of text with regex in m3u-prune scriptlet
Related issue:
- https://github.com/uBlockOrigin/uBlock-issues/issues/2508

If the first argument is a regex with multine flag set, the
scriptlet will execute the regex against the whole text, and
remove matching text from the whole text.

If the matching text does not contains whole lines, the text
won't be removed, i.e. it is not allowed to remove only part
of a line.
2023-03-12 17:45:02 -04:00
Raymond Hill
f80c84ab40
Remove references to deprecated gitcdn.link
Related feedback:
- https://github.com/uBlockOrigin/uBlock-issues/issues/2136#issuecomment-1465231197
2023-03-12 14:09:44 -04:00
Raymond Hill
4b4ef6a60c
Rename href-from-text to href-sanitizer, add argument
Related issue:
- https://github.com/uBlockOrigin/uBlock-issues/issues/2531#issuecomment-1462389539

Usage:
- example.com##+js(href-sanitizer, a[href^="/go?to="]:not([title]))
- example.com##+js(href-sanitizer, a[href^="/go?to="][title], [title])

The second argument is the attribute from which to extract the text
to be used for the `href` attribute of the link. If the second
attribute is absent, the text content of the element will be used.
2023-03-09 13:37:06 -05:00
Raymond Hill
e123256eaf
Add experimental href-from-text scriptlet
Related issue:
- https://github.com/uBlockOrigin/uBlock-issues/issues/2531

Usage:

    example.com##+js(href-from-text, a[href^="/tracker-link?to="]

The above scriptlet will find all elements matching the selector
passed as 1st argument, and replace the `href` attribute with the
text content of the element, if all the following conditions are
met:

- The element is a link (`a`) element
- The link element has an existing `href` attribute
- The text content of the element is a valid `https`-based URL
2023-03-09 08:49:26 -05:00
Raymond Hill
088e90ed42
Add list for Macedonia; add languages to Persian list
Related issues:
- https://github.com/uBlockOrigin/uBlock-issues/issues/2522
- https://github.com/AdguardTeam/AdguardFilters/pull/144318#issuecomment-1451721914
2023-03-02 17:09:32 -05:00
Raymond Hill
46c1eb8678
Update URLs to EasyDutch list
Related feedback:
- https://github.com/uBlockOrigin/uAssets/issues/11204#issuecomment-1384238094
2023-01-23 20:04:01 -05:00
Raymond Hill
98c0bd8406
Remove AdGuard Tracking Protection from stock lists
Related issue:
- https://github.com/AdguardTeam/AdguardFilters/issues/139081#issuecomment-1375396423
2023-01-11 20:29:07 -05:00
Raymond Hill
eb88e6fb12
Fix bad JSON 2022-12-26 09:11:04 -05:00
Raymond Hill
8f66de67e1
Remove gitcdn.link as CDN provider
Appears broken at the moment. Related discussion:
- https://github.com/uBlockOrigin/uBlock-issues/issues/1165#issuecomment-1364607559
2022-12-25 07:40:13 -05:00
Raymond Hill
c88f4445d1
Update invalid SDN URL for EasyList Lithuania
Related issue:
- https://github.com/uBlockOrigin/uBlock-issues/issues/2420
- https://github.com/uBlockOrigin/uBlock-issues/issues/1566#issuecomment-826372745
2022-12-22 10:34:49 -05:00
Raymond Hill
6140e55589
Remove combinatronics.io as CDN 2022-12-02 11:39:32 -05:00