Commit graph

2975 commits

Author SHA1 Message Date
Raymond Hill
018265272d
Import translation work from https://crowdin.com/project/ublock 2020-04-29 10:03:41 -04:00
Raymond Hill
23633b388d
Fix reported "Storage used:" when info is not available 2020-04-29 10:00:58 -04:00
Raymond Hill
3efee017cf
Fix own-rule text color
Related fedback:
- https://github.com/gorhill/uBlock/commit/db9c32185538#commitcomment-38818960
2020-04-29 06:16:59 -04:00
Raymond Hill
d364eb9668
Minor code review 2020-04-28 18:39:31 -04:00
Raymond Hill
848edbbdf6
Import translation work from https://crowdin.com/project/ublock 2020-04-28 11:24:42 -04:00
Raymond Hill
d462b50cec
Improve presentation of advanced settings page
Specifically:

- Fix exception being thrown when createing an
  empty line

- Syntax-color invalid setting names

- Syntax-color non-default values
2020-04-28 11:07:00 -04:00
Raymond Hill
9a6feb34d5
Re-order sections in the new popup panel
The blocking-stuff button icons have been brought
closer to the power button.

The go-somewhere button icons have been moved at
the bottom.

The hostname of the current site is now shown below
the power button. The base domain is bolded.

This re-ordering is for a few reasons:

- The blocking-stuff button icons are now closer
  to the revert/persist/reload transient buttons
  which show up when modifying the blocking
  behavior of uBO.

- The makes it easier to potentially bring in a
  very basic view where only the power button and
  the statistics are shown and all the button
  icons are hidden from view.
2020-04-27 19:01:16 -04:00
Raymond Hill
6259f88598
Add an alias for window.open-defuser scriptlet
As per request from filter list maintainers.

The alias is `nowoif`, in line with other such
defusing scriplets.
2020-04-27 11:24:41 -04:00
Raymond Hill
f7c838ef27
Import translation work from https://crowdin.com/project/ublock 2020-04-27 10:44:44 -04:00
Raymond Hill
db9c321855
More work toward re-hauling the user interface
This commit specifically address bringing the
desktop version of the new popup panel's look
and feel more inline with the classic one:

- Hide tool captions on desktop

- Bring back no-popups switch on desktop

- Bring back tooltips on desktop (though they
  are now rendered natively by the browser)

- Use the Photon icons suggested by @brampitoyo
  for the no-popups and no-remote-fonts
  switches
2020-04-27 10:33:49 -04:00
Raymond Hill
37b22d0142
Import translation work from https://crowdin.com/project/ublock 2020-04-26 09:07:52 -04:00
Raymond Hill
43357e4a4d
Mind that checkbox can be in a flex container 2020-04-26 09:02:30 -04:00
Raymond Hill
8ed60af0f9
Fine tune material design-based checkbox code
Summary:
- Make checkbox nodes self-contained
  (a > b) instead of (a + b)
- Revisit logger to use new checkboxes
2020-04-26 08:44:00 -04:00
Raymond Hill
fefc7e21b2
Unbreaking checkbox in logger settings
Related commit:
- f9b385ffb1

The real fix is not trivial, so this is a workaround
until the real fix. The logger's setting dialog is
also suffering from small visual issues due to all
the CSS changes elsewhere recently, this will be fixed
at the same time.
2020-04-25 18:57:36 -04:00
Raymond Hill
bedaf87399
Import translation work from https://crowdin.com/project/ublock 2020-04-25 15:24:37 -04:00
Raymond Hill
f9b385ffb1
Standardize checkbox visual to material design
Motivation:
- To align with Firefox Preview's own design
- To uniformize checkbox look and behavior
  across all platforms
2020-04-25 15:19:07 -04:00
Raymond Hill
525eb9f922
Lint HTML files using tidy 2020-04-25 11:31:42 -04:00
Raymond Hill
c6099d174d
Fix typos in HTML code
Related feedback:
- https://github.com/gorhill/uBlock/commit/01ab072f07f8#r38739334

Will `tidy` from now on.
2020-04-25 11:20:36 -04:00
Raymond Hill
3afe286124
Translation work from https://crowdin.com/project/ublock 2020-04-25 10:27:04 -04:00
Raymond Hill
fe94aa331a
Replace CodeMirror resize code with CSS flex 2020-04-25 10:19:08 -04:00
Raymond Hill
468f4d6b8e
Fix power button color in classic popup panel
Related feedback:
- https://www.reddit.com/r/uBlockOrigin/comments/g7i95t/
2020-04-25 08:03:34 -04:00
Raymond Hill
01ab072f07
Add localized strings for contributions in About pane
Additionally, an entry for filter list
contributors has been added.
2020-04-24 20:17:21 -04:00
Raymond Hill
9845e4d61a
Replace old resizing code with CSS flex 2020-04-24 20:10:35 -04:00
Raymond Hill
ee2d7bfa17
Import translation work from https://crowdin.com/project/ublock 2020-04-24 09:54:48 -04:00
Raymond Hill
f16d77ef03
Avoid applying CSS filter twice 2020-04-24 09:46:44 -04:00
Raymond Hill
d2897db2b6
More fine tuning of user interface
Noteworthy:
- Make new popup panel better resize in desktop
  environment
- Fix button visuals in "My rules" pane
- Keep "Update now" button visible until update
  is completed
- Renaming CSS variables for consistency
2020-04-24 09:33:44 -04:00
Raymond Hill
98f19facec
More fine tuning as per feedback
Better constrast for warning color. Related feedback:
- 5bee33253f (commitcomment-38700085)

Revisit how large numbers are rendered in a
compact form in the new popup panel. Feedback
from https://crowdin.com/project/ublock pointed
out that the string to translate was flawed for
Chinese locale (and possibly in some other
locales as well).
2020-04-23 14:19:41 -04:00
Raymond Hill
ed383bd470
Import translation work from https://crowdin.com/project/ublock 2020-04-23 10:16:56 -04:00
Raymond Hill
fea02031c1
Mind possibly too long abbreviation 2020-04-23 10:08:06 -04:00
Raymond Hill
0afe7c2231
More fine tuning of user interface
The rendering of the total number of blocked
requests will now be abbreviated using `M` and
`G` when the block count is respectively above
1 million and 1 billion.

The storage used figure in the Settings pane
will be rendered using KB, MB or GB.
2020-04-23 08:45:43 -04:00
Raymond Hill
04c07f3e10
Use large units for large values in Settings pane
Shorten "Storage used" values using large
units, i.e. shorten rendered values using
KB, MB, and GB for large figures.
2020-04-22 16:30:23 -04:00
Raymond Hill
64cb7fa843
Import translation work from https://crowdin.com/project/ublock 2020-04-22 16:29:57 -04:00
Raymond Hill
b277b084d5
More fine tuning of latest UI changes 2020-04-22 11:17:58 -04:00
Raymond Hill
4eef5432a9
More fine tuning of UI 2020-04-22 09:56:37 -04:00
Raymond Hill
5bee33253f
More work toward redesigning the UI
As per email feedback from Mozilla's
https://github.com/brampitoyo

This is yet another incremental step toward
redesigning the UI, much more is left to do.
The idea is to align uBO's UI to that of
Firefox Preview.

Additionally, code has been added to reset
the new popup panel to vertical layout should
the viewport be not wide enough to
accomodate the horizontal layout.

Related feedback:
- https://www.reddit.com/r/uBlockOrigin/comments/g4ufvi/
2020-04-21 16:33:08 -04:00
Raymond Hill
b5b72059eb
Import translation work from https://crowdin.com/project/ublock 2020-04-20 09:51:30 -04:00
Raymond Hill
8a6dc8ee88
Minor fine tuning of some dashboard visuals
More left to do as per reference documentation:
- https://protocol.mozilla.org/
- https://material.io/
2020-04-20 09:45:18 -04:00
Raymond Hill
7f999b759f
Fix broken DOM inspector [regression]
Regression from:
- 0bcf04d3dd

Related feedback:
- https://github.com/gorhill/uBlock/commit/0bcf04d3dda2#commitcomment-38594585

The DOM inspector client code is injected as
content script, thus it must be categorized as
non-privileged code.
2020-04-19 08:33:09 -04:00
Raymond Hill
21d7c7ee3d
More fine tuning of various visuals
Summarily:
- Bring back horizontal layout for fenix popup panel
  to be used in desktop environment
- Address feedback from
  https://github.com/gorhill/uBlock/commit/54b68ebd9426#commitcomment-38549940
- Allow future dark theme to be enabled programmatically
2020-04-18 09:48:53 -04:00
Raymond Hill
54b68ebd94
Fine tune various visuals
Related feedback:
- e917213e81 (commitcomment-38533349)
2020-04-16 08:49:34 -04:00
Raymond Hill
0bcf04d3dd
Centralize access to browser.storage.local('localStorage')
Related commit:
- 2ac288397c

Instead of having the `localStorage` data being accessed
from different locations, all accesses are now funnelled
to the main process.

Doing so simplifies the code in auxiliary processes and
also remove the need for browser.storage.local.onChanged()
listeners.

No longer using an onChanged() listener also happens to
remove spurious warnings from the Firefox console.
2020-04-15 15:55:29 -04:00
Raymond Hill
042935b22a
Ensure element picker's height is not affected by web sites
Related issue:
- https://github.com/uBlockOrigin/uBlock-issues/issues/987
2020-04-15 09:46:12 -04:00
Raymond Hill
efa3c140ab
Fix typo in last commit
Related commit:
- 36711a7c07
2020-04-14 11:57:59 -04:00
Raymond Hill
8c1a055bfe
Import translation work from https://crowdin.com/project/ublock 2020-04-14 09:19:31 -04:00
Raymond Hill
b20e33ff18
Fine tune CSS to restore intended visuals on fenix 2020-04-14 09:15:36 -04:00
Raymond Hill
36711a7c07
Fix denyallow thrown away with pure hostname patterns 2020-04-14 09:10:59 -04:00
Raymond Hill
7f55e5d54d
Fine tune CSS and fix CSS regressions in last commit
Related commit:
- e917213e81

Specifically, intended font size was no longer
set properly for mobile in popup panel.
2020-04-13 16:40:12 -04:00
Raymond Hill
051cb27f9b
Fix syntax highlighting of line continuation
Thix fixes an exception being thrown when the
line being continued is the last one.
2020-04-13 14:26:17 -04:00
Raymond Hill
94935a4b9e
Pure origin filters can't have denyallow option
This fixes filters of the form:

  *$[...],denyallow=[...],domain=[...]
  |http://$[...],denyallow=[...],domain=[...]
  |https://$[...],denyallow=[...],domain=[...]
2020-04-13 14:22:21 -04:00
Raymond Hill
b5d8b0a9f0
Import translation work from https://crowdin.com/project/ublock 2020-04-13 09:31:22 -04:00
Raymond Hill
e917213e81
Sixth pass to re-design the dashboard
Related commits:
- 0662767dd6
- 99b2a0a761
- a8e3118fea
- 453f5450b6
- a45a21f337

This commit focuses on implementing the use of
CSS `var(...)` throughout so as to make it easy
to create themes -- a requirement for uBO to
support a dark theme.

There is still work to do regarding converting
uBO's CSS to completely support `var(...)` but
being able to start using theming will help
complete and fine tune CSS `var(...)` support.

Related issue:
- https://github.com/uBlockOrigin/uBlock-issues/issues/401
2020-04-13 09:19:58 -04:00
Raymond Hill
e4065ec05c
Import translation work from https://crowdin.com/project/ublock 2020-04-11 11:41:33 -04:00
Raymond Hill
0662767dd6
Fifth pass to re-design the dashboard
Related commits:
- 99b2a0a761
- a8e3118fea
- 453f5450b6
- a45a21f337

Fine tuned previous work.

Started the use of variable-based color values.
2020-04-11 11:32:43 -04:00
Raymond Hill
ebf7ade6b1
Import translation work from https://crowdin.com/project/ublock 2020-04-10 18:27:48 -04:00
Raymond Hill
99b2a0a761
Fourth pass to re-design the dashboard
Related commits:
- a8e3118fea
- 453f5450b6
- a45a21f337

Roughly, the changes in this commit:
- Make it easier to implement a dark theme eventually:
  - Flatten the look of buttons
  - Remove the use of `opacity` style property as a
    color modifier
- Some work toward removing dependency on FontAwesome
  font
2020-04-10 18:17:12 -04:00
Raymond Hill
a7dc0de98f
Update kbd shortcuts only if kbd shortcuts pane is enabled
Related feedback:
- https://github.com/uBlockOrigin/uBlock-issues/issues/386#issuecomment-611806957
2020-04-10 17:25:36 -04:00
Raymond Hill
b1cf3c46a7
Import translation work from https://crowdin.com/project/ublock 2020-04-09 09:36:34 -04:00
Raymond Hill
a8e3118fea
Third pass to re-design the dashboard
Related commits:
- 453f5450b6
- a45a21f337

This commit fixes parts of the re-design not
rendering as intended as per <https://github.com/brampitoyo>'s
feedback screenshots.

The dashboard tab buttons have been converted to
`span` tags (from `a` tags), thus eliminating
the unwanted side effect of the text being
rendered as unvisited links (blueish).

The font size intended for touch screens was not
taking effect due to bad cut & paste.

Other minor adjustments to improve consistency
in spacing.
2020-04-09 09:20:29 -04:00
Raymond Hill
03739ab96b
Add minimal-scale in meta tag 2020-04-08 10:23:40 -04:00
Raymond Hill
5a2e5cfe86
Import translation work from https://crowdin.com/project/ublock 2020-04-08 10:22:38 -04:00
Raymond Hill
4687c60bf9
Support fetching assets from CDNs when auto-updating
This commit add the ability to fetch from CDN servers
when an asset is fetched as a result of auto-update.

If an asset has a `cdnURLs` entry in `assets.json`,
the asset will be auto-updated using one of those
CDN URLs. When many CDN URLs are specified, those
URLs will be shuffled in order to spread the bandwidth
across all specified CDN servers. If all specified CDN
servers fail to respond, uBO will fall back to usual
`contentURLs` entry.

The `cdnURLs` are used only when an asset is
auto-updated, this ensures a user will get the more
recent available version of an asset when manually
updating.

The motivation of this new feature is to relieve
GitHub from acting as a CDN (which it is not) for
uBO -- an increasing concern with the growing adoption
of uBO along with the growing size of key uBO assets.
2020-04-08 09:57:55 -04:00
Raymond Hill
e8a9997de8
Import translation work from https://github.com/gorhill/uBlock 2020-04-06 14:05:16 -04:00
Raymond Hill
a45a21f337
Second pass to re-design the dashboard
Related commit:
- 453f5450b6

The changes in this commit are mostly related
to the "Filter lists" pane.

An eye icon has been added, which purpose is
to view the content of a list. Clicking on the
name of the list will toggle the list's
checkbox.
2020-04-06 14:00:19 -04:00
Raymond Hill
64d8904998
Fine tune font size for reworked dashboard UI
Related feedback:
- https://github.com/gorhill/uBlock/commit/453f5450b6e6#commitcomment-38305932

The larger font size is best justified for
touchscreen to allow tapping -- less justified
on devices with a mouse which allow for more
accurate selection.
2020-04-05 19:37:23 -04:00
Raymond Hill
453f5450b6
First pass to Re-design the dashboard
This is a first pass in which only the dashboard
navigation widget and the "Settings" pane have
been revisited.

Reference work:
- https://app.abstract.com/share/54f1465e-8d1c-4e7b-9ae4-f37e21bef7fe
2020-04-05 15:19:07 -04:00
Raymond Hill
20332c65b4
No need for "Shortcuts" pane in Firefox 74 and above
Related issue:
- https://github.com/uBlockOrigin/uBlock-issues/issues/386
2020-04-05 09:47:22 -04:00
Raymond Hill
df08b12d48
Fix race condition at browser launch re. cosmetic filtering
Related issue:
- https://github.com/uBlockOrigin/uBlock-issues/issues/974

Related feedback:
- https://www.reddit.com/r/uBlockOrigin/comments/fuscia/

The race condition was that a content script could
query the main process to retrieve cosmetic filters
while the cosmetic filters had not been yet fully
loaded into memory. The fix ensure that an already
injected content script will re-query once the
cosmetic filters are fully loaded in memory at
browser launch time.
2020-04-04 11:34:43 -04:00
Raymond Hill
1295e25961
Remove unused property 2020-04-03 09:07:22 -04:00
Raymond Hill
cc3152e803
Import translation work from https://crowdin.com/project/ublock 2020-04-03 09:02:55 -04:00
Raymond Hill
044a1dd6ee
Fix :style exception filters not being reported in logger
Related issue:
- https://github.com/uBlockOrigin/uBlock-issues/issues/962

Regression from:
- 72bb700568
2020-03-26 09:19:02 -04:00
Raymond Hill
0078cea6a0
Import translation work from https://crowdin.com/project/ublock 2020-03-26 08:43:30 -04:00
Raymond Hill
2f927847f2
Discard :style() filters chained to procedural operators
Related issue:
- https://github.com/uBlockOrigin/uBlock-issues/issues/961
2020-03-26 08:38:22 -04:00
Raymond Hill
151ff5326a
Import translation work from https://crowdin.com/project/ublock 2020-03-24 12:18:33 -04:00
Raymond Hill
2fcc41f641
Improve disqus_embed.js scriptlet
Related issue:
- https://github.com/uBlockOrigin/uBlock-issues/issues/959

The problematic site does not declare the expected
`disqus_shortname` global variable, so the scriptlet
has been extended to deal with such occurrence.
2020-03-24 10:02:20 -04:00
Raymond Hill
11d24abea0
Move proxy-detection code to Firefox-specific code
Related commit:
- https://github.com/uBlockOrigin/uBlock-issues/issues/911

The motivation is to avoid executing code which is
unnecessary on platforms not supporting the browser.dns
API.
2020-03-23 13:31:43 -04:00
Raymond Hill
0c30bee3e3
Fix typo in proxy-detecting code
Related issue:
- https://github.com/uBlockOrigin/uBlock-issues/issues/911

Related commit:
- https://github.com/gorhill/uBlock/commit/3f7ece94691f
2020-03-23 12:23:05 -04:00
Raymond Hill
3f7ece9469
Do not cname-uncloak when a proxy is in use
Related issue:
- https://github.com/uBlockOrigin/uBlock-issues/issues/911

Since cname-uncloaking is available only on Firefox
at the moment, the fix is relevant only to Firefox.

By default uBO will no longer cname-uncloak when it
detects that network requests are being being proxied.

This default behavior can be overriden by setting the
new advanced setting `cnameUncloakProxied` to `true`.
The new setting default to `false`, i.e. cname-uncloaking
is disabled when uBO detects that a proxy is in use.

This new advanced setting may disappear once the
following Firefox issue is fixed:
- https://bugzilla.mozilla.org/show_bug.cgi?id=1618271
2020-03-22 14:52:58 -04:00
Raymond Hill
f5204235b7
Use prime number to generate cache-bypass token
Related discussion:
- https://github.com/gorhill/uBlock/commit/048bfd251c9b#r37972005

From <https://github.com/gwarser>:

> I think this should be "modulo prime", not 12.
> If someone always turn on PC in "8am" there is
> a slight chance to hit cache.
2020-03-22 11:31:06 -04:00
Raymond Hill
381498daa2
Reorganize filter instances deduplication code
Related commit:
- https://github.com/gorhill/uBlock/commit/ab629b9e1093
2020-03-19 13:42:06 -04:00
Raymond Hill
a36566b348
Allow empty needle in BidiTrieContainer.lastIndexOf()
Related issue:
- https://github.com/uBlockOrigin/uBlock-issues/issues/882

Related commit:
- https://github.com/gorhill/uBlock/commit/7c0294bd5f54

The changes in the commit above have been reverted, and
the new fix is to add the ability to handle an empty
needle in BidiTrieContainer.lastIndexOf() -- in which
case the method will return the end of the currently
matched pattern.
2020-03-19 13:16:41 -04:00
Raymond Hill
20a32e881a
Import translation work from https://crowdin.com/project/ublock 2020-03-18 09:21:57 -04:00
Raymond Hill
ab629b9e10
Add filter instance deduplicater in static net filtering engine
Provide a way to optionally deduplicate filter
instances, useful for filter instances with:

- high likelihood of duplication; and
- non-trivial memory footprint per instance
  - For examples, filter instances to implement
    `domain=`, `denyallow=`, `csp=`.

Cursory tests show this helps further reduce
uBO's memory footprint.
2020-03-18 09:06:33 -04:00
Raymond Hill
ec70fba948
Import translation work from https://crowdin.com/project/ublock 2020-03-16 09:17:59 -04:00
Raymond Hill
c3bc2c741d
Add support for cname type and denyallow option
This concerns the static network filtering engine.

Related issue:
- https://github.com/uBlockOrigin/uBlock-issues/issues/943

* * *

New static network filter type: `cname`

By default, network requests which are result of
resolving a canonical name are subject to filtering.
This filtering can be bypassed by creating exception
filters using the `cname` option. For example:

    @@*$cname

The filter above tells the network filtering engine
to except network requests which fulfill all the
following conditions:

- network request is blocked
- network request is that of an unaliased hostname

Filter list authors are discouraged from using
exception filters of `cname` type, unless there no
other practical solution such that maintenance
burden become the greater issue. Of course, such
exception filters should be as narrow as possible,
i.e. apply to specific domain, etc.

* * *

New static network filter option: `denyallow`

The purpose of `denyallow` is bring
default-deny/allow-exceptionally ability into static
network filtering arsenal. Example of usage:

    *$3p,script, \
        denyallow=x.com|y.com \
        domain=a.com|b.com

The above filter tells the network filtering engine that
when the context is `a.com` or `b.com`, block all
3rd-party scripts except those from `x.com` and `y.com`.

Essentially, the new `denyallow` option makes it easier
to implement default-deny/allow-exceptionally in static
filter lists, whereas before this had to be done with
unwieldy regular expressions[1], or through the mix of
broadly blocking filters along with exception filters[2].

[1] https://hg.adblockplus.org/ruadlist/rev/f362910bc9a0

[2] Typically filters which pattern are of the
    form `|http*://`
2020-03-15 12:23:25 -04:00
Raymond Hill
84d4111c05
Import translation work from https://crowdin.com/project/ublock 2020-03-15 09:34:34 -04:00
Raymond Hill
85c9e74999
Do not repeat filter content in reverse lookup dialog
No need to repeat content of filter when reverse
lookup fails in logger's dialog.
2020-03-15 09:27:38 -04:00
Raymond Hill
17886abcda
Centralize break-all CSS property
So that both asset viewer and "My filters" inherit
the property for filter list rendering.
2020-03-15 09:25:18 -04:00
Raymond Hill
bc700e691c
Fix srcset handling in element picker
Related issue:
- https://github.com/uBlockOrigin/uBlock-issues/issues/923

Use current page's hostname instead of that of
image URLs to decide whether to reset pattern
union with previous picker sessions.

The fixed issue arose from the fact that the
page uses URLs from different origins in a
single srcset attribute.
2020-03-15 08:45:17 -04:00
Raymond Hill
ca80d2826b
Add indentation requirement for line continuation
Related commit:
- https://github.com/gorhill/uBlock/commit/703c525b01aa

This adds an indentation requirement for line
continuation to take place. The conditions are now
as follow:
- Current line ends with ` \`: ASCII space + backslash
- Next line starts with `    `: four ASCII spaces
2020-03-15 08:15:17 -04:00
Raymond Hill
703c525b01
Support line continuation in filter lists
If a line in a filter list ends with a space
(ASCII code 32) followed by a backslash
(ASCII code 92), those two characters will be
removed, the line will be trimmed and the next
line will be trimmed and concatenated to form
a new, longer line.

The purpose is to give filter list authors
a way to visually break apart unduly long
filters and thus make maintenance easier.

When line continuation is used, it is suggested
that the extra lines are prepended with four
space so as to make it more visually obvious that
the extra line(s) are the continuation of a
previous line.

Related issue:
- https://github.com/uBlockOrigin/uBlock-issues/issues/943

The filter referenced in the above issue was the
motivation to implement this feature:
- https://hg.adblockplus.org/ruadlist/rev/f362910bc9a0

I verified and could not find any instance in major
filter lists of lines ending with ` \`, thus the
change should be safe.
2020-03-14 13:34:13 -04:00
Raymond Hill
2cbbc30084
Also remove text node in :remove() operator
Related discussion:
- https://github.com/gorhill/uBO-Extra/issues/119#issuecomment-537842967

As an incidental side effect, this may or may not
prevent execution of the content of some inline
script tags.
2020-03-09 11:34:49 -04:00
Raymond Hill
0f33f2386d
Expand log output of window.open-defuser 2020-03-09 10:09:40 -04:00
Raymond Hill
b27848a060
Improve window.open-defuser scriptlet
The new syntax deprecate the old syntax, though the
old syntax will still be supported until it's no
longer used in mainstream filter lists.

The new syntax is:

    example.com##+js(window.open-defuser, pattern, seconds)

`pattern`:

A pattern to match for the defusing to take place.
Patterns which starts and ends with `/` will be
interpreted as regular expressions. To NOT match a
pattern, prefix with `!`.

`seconds`:

If not present, no window will be opened and the
scriptlet will return `null`.

If present and a valid integer value, the defuser
will return a valid window object even though no
popup window is opened. The returned window object
will cease to be valid after the specified number
of seconds.
2020-03-08 16:15:58 -04:00
Raymond Hill
1d9421b8b2
Improve validation of CSS selector-based cosmetic filters
Reported internally. The following invalid filter was not
discarded by uBO:

    123tvnow.com##.123tv-ads

The correct form should be:

    123tvnow.com##.\31 23tv-ads

Not discarding invalid CSS selector-based cosmetic
filter may break CSS selector-based cosmetic
filtering.
2020-03-08 10:55:19 -04:00
Raymond Hill
72bb700568
Add procedural cosmetic operators remove() and upward()
***

New procedural cosmetic operator: `:remove()`

Related issue:
- https://github.com/gorhill/uBlock/issues/2252

The purpose is to outright remove elements from the
DOM tree. Since `:remove()` is an "action" operator,
it must only be used as a trailing operator (just
like the `:style()` operator).

AdGuard's cosmetic filter syntax `{ remove: true; }`
will be converted to uBO's `:remove()` operator
internally.

***

New procedural cosmetic operator: `:upward(...)`

The purpose is to lookup an ancestor element.

When used with an integer argument, it is synonym of
`:nth-ancestor()`, which will be deprecated and which
will no longer be supported once no longer used in
mainstream filter lists.

Filter lists maintainers must only use `:upward(int)`
instead of `:nth-ancestor(int)` once the new operator
become available in all stable releases of uBO.

`:upward()` can also accept a CSS selector as argument,
in which case the nearest ancestor which matches the
CSS selector will be selected.
2020-03-07 14:25:06 -05:00
Raymond Hill
7442463a87
Fix spurious v-scrollbar when hovering bottom-most cells 2020-03-04 13:34:50 -05:00
Raymond Hill
891f45d440
Fix hidden hyphen location in DA translation 2020-03-02 15:39:32 -05:00
Raymond Hill
bef9eedf73
Support hidden hyphen HTML entity in translation work
Related issue:
- https://github.com/uBlockOrigin/uBlock-issues/issues/907#issuecomment-590804054
2020-03-02 12:34:50 -05:00
Rory O’Kane
be111c4036
In Element Zapper, support Mac keyboards’ Delete key (#3770)
Override the Backspace key, not just the Delete key, as Mac keyboards have Backspace as the only delete key and label it Delete.

Source of key value: https://developer.mozilla.org/en-US/docs/Web/API/KeyboardEvent/key/Key_Values#Editing_keys

More background on Mac keyboard shortcuts: Mac keyboards can emulate Delete using fn+Delete, meaning Forward Delete, but Mac software does not use it except in text editing. When deletion is dangerous, Mac software requires holding a modifier key in conjuction with Delete, but I think it’s better to make deletion easy in this case.

This new binding has a potential downside: if the user Backspace key normally goes Back in history (which can differ across OSs and browsers), this will change the behavior to delete the selected element instead. If the user really wants to go back in history, they will have to press Escape to leave the mode and then press Backspace, or they will have to press an alternative keyboard shortcuts such as Alt+Left. I think the user will rarely want to go back in history in the middle of picking an element, though.

That downside could be mitigated by conditioning the key check on `runtime.PlatformOs` (https://developer.mozilla.org/en-US/docs/Mozilla/Add-ons/WebExtensions/API/runtime/PlatformOs). But that would complicate the code a lot compared to the importance of this feature, and such detection would still fail to capture the user’s intent accurately in all cases. I think it’s better to unconditionally accept both Backspace (Delete) and Delete (Forward Delete).
2020-02-28 14:28:00 -05:00
Raymond Hill
c40df88bc6
Make row slightly taller on mobile 2020-02-27 10:01:09 -05:00
Raymond Hill
cf084e1db7
Import translation work from https://crowdin.com/project/ublock 2020-02-27 09:58:55 -05:00
Raymond Hill
c4caa5539d
Move refresh button to the right of the power button 2020-02-27 09:29:14 -05:00
Raymond Hill
da71c3a499
Force console output when explicitly requested from dev tools
Related feedback:
- https://bugzilla.mozilla.org/show_bug.cgi?id=1617666#c0

Not being able to see benchmark results when explicitly
requesting benchmark results is not very user-friendly;
this commit fixes this.
2020-02-25 11:00:58 -05:00
Raymond Hill
c17a9c8a93
Fix spurious warning when force-reloading the dashboard
Related issue:
- https://github.com/uBlockOrigin/uBlock-issues/issues/905

Additionally, minor changes to avoid spurious errors in
browser console.
2020-02-24 09:59:35 -05:00
Raymond Hill
7634604aa8
Make element picker mind that network filters are case-insensitive
Related discussion:
- https://github.com/easylist/easylist/pull/4950#issuecomment-590064744
2020-02-24 09:24:54 -05:00
Raymond Hill
b55991d346
Import translation work from https://crowdin.com/project/ublock 2020-02-23 12:26:07 -05:00
Raymond Hill
3621792f16
Rework/remove remnant of code dependent on localStorage
Related issue:
- https://github.com/uBlockOrigin/uBlock-issues/issues/899
2020-02-23 12:18:45 -05:00
Raymond Hill
d16ac963ef
Use correct element id fenix popup panel 2020-02-23 12:16:50 -05:00
Raymond Hill
15470bcbdc
Ensure disableWebAssembly setting is loaded before use
Related issue:
- https://github.com/uBlockOrigin/uBlock-issues/issues/899

WASM modules are now loaded on demand rather than at
script evaluation time.
2020-02-22 13:36:22 -05:00
Raymond Hill
2ac288397c
Remove usage of synchronous localStorage API
Related issue:
- https://github.com/uBlockOrigin/uBlock-issues/issues/899

browser.storage.local is now used to store non-critical
local settings.

These settings are all collated under the key
`localStorage`, and vAPI.localStorage is an API to
handle access to these values stored under this key.

vAPI.localStorage.getItem() is still synchronous but
its purpose is to return internally cached values --
this minimizes code changes throughout uBO.
2020-02-21 15:34:54 -05:00
Raymond Hill
5da3aaaabf
Properly test for WebAssembly presence before use
Related issue:
- https://github.com/uBlockOrigin/uBlock-issues/issues/900
2020-02-21 15:21:25 -05:00
Raymond Hill
ddc2b11657
Fail graciously if no benchmark dataset found 2020-02-21 08:13:15 -05:00
Raymond Hill
b784b7d569
Support loading of benchmark dataset in published versions
New advanced setting: `benchmarkDatasetURL`
Default value: `unset`

To specify a URL from where the benchmark dataset will be
fetched. This allows to launch benchmark operations from
within published versions of uBO, rather than from just
a locally built version.
2020-02-21 08:06:52 -05:00
Raymond Hill
5ccf435754
Add edge-scheme to default whitelist directives
Related issue:
- https://github.com/uBlockOrigin/uBlock-issues/issues/879
2020-02-20 16:43:56 -05:00
Raymond Hill
da0ef9454a
Neutralize localStorage access on mobile platform
Related issue:
- https://github.com/uBlockOrigin/uBlock-issues/issues/899

window.localStorage is synchronous and thus should be
avoided at launch time. Currently the avoidance is only
for mobile platforms.
2020-02-20 16:40:29 -05:00
Raymond Hill
c0947200e5
Import translation work from https://crowdin.com/project/ublock 2020-02-20 10:59:03 -05:00
Raymond Hill
ba7d24a338
Wrap long hostnames in popup panel 2020-02-20 08:29:33 -05:00
Raymond Hill
a74403e8be
Import translation work from https://crowdin.com/project/ublock 2020-02-19 08:09:56 -05:00
Raymond Hill
81f91e4fd4
Put back erroneously removed background color 2020-02-18 11:35:07 -05:00
Raymond Hill
6802e6d32f
Minor color adjustment 2020-02-18 11:31:24 -05:00
Raymond Hill
69a7c6771b
Fine tune fenix UI as per Bram's feedback 2020-02-18 09:53:20 -05:00
Raymond Hill
7a93301d78
Fine tune UI of "fenix" popup panel 2020-02-17 09:35:58 -05:00
Raymond Hill
e123c96bbc
Import translation work from https://crowdin.com/project/ublock 2020-02-17 09:02:52 -05:00
Raymond Hill
6cdb1092dd
Import translation work from https://crowdin.com/project/ublock 2020-02-15 09:43:27 -05:00
Raymond Hill
3fab7bfdb4
Add support for "specific-generic" cosmetic filters
A specific cosmetic filter of the following form...

    *##.selector

... will be unconditionally injected into all web pages,
whereas a cosmetic filter of the form...

    ##.selector

... would be injected only when uBO's DOM surveyor finds
at least one matching element in a web page.

The new specific-generic form will also be disabled when a
web page is subject to a `generichide` exception filter,
since the filter is essentially a generic one -- the only
difference from the usual generic form is that the filter
is injected unconditionally instead of through the DOM
surveyor.

Specific-generic cosmetic filters will NOT be discarded
when checking the "Ignore generic cosmetic filters"
option in the "Filter lists" pane -- since the purpose
of this option is primarily to disable the DOM surveyor.

Specific-generic cosmetic filters should be used
parcimoniously and only when using a normal specific
filter is really impractical.

Related issue:
- https://github.com/uBlockOrigin/uBlock-issues/issues/803
2020-02-14 11:51:05 -05:00
Raymond Hill
8adad98a0d
New way to convey IDN and CNAME info in popup panel
Hostnames which have unpunycoded IDN or canonical
name information will have this information reported
as an extra line under the hostname name in the popup
panel, rather than as a tooltip.

For the fenix UI flavor, the save/revert tools are
now shown regardless of whether the overview area is
visible or not.
2020-02-10 08:06:36 -05:00
Raymond Hill
4b7bbb150f
Import translation work from https://crowdin.com/project/ublock 2020-02-09 12:43:12 -05:00
Raymond Hill
44fe38c9fe
Minor cleanup of HTML code 2020-02-09 10:41:10 -05:00
JustOff
a806dd4bd2
Add env_legacy to the pre-processor supported tokens (#3768)
This will allow specifically target uBlock Origin for Firefox legacy-based browsers in shared filter lists,
see https://github.com/gorhill/uBlock-for-firefox-legacy/pull/1.
2020-02-09 08:23:00 -05:00
Raymond Hill
760d206bd4
Select default UI according to target platform
More specifically, this commit makes it so that
the new default UI for Firefox Preview will be
automatically selected.

A default platform-specific UI can be cancelled
by setting the advanced setting `uiFlavor` to `-`.
2020-02-06 11:42:12 -05:00
Raymond Hill
4509483c7e
Set tooltip to cname alias in popup panel
The toolip of a canonical name entry (blue)
in the popup panel will provide the alias
hostname related to the canonical hostname
in order to help with rule-making decisions.
2020-02-06 10:18:15 -05:00
Raymond Hill
651955b97c
Throw if mismatched size when unserializing an array buffer
An exception will be thrown if the length of an unserialized
array buffer does not match exactly the original size at
serialization time.
2020-02-04 09:55:02 -05:00
Raymond Hill
609e9a6428
Remove elision of leading wildcard in some filter patterns
Related issue:
- https://github.com/uBlockOrigin/uBlock-issues/issues/882

Related commits:
- https://github.com/gorhill/uBlock/commit/a95ef16e064a
- https://github.com/gorhill/uBlock/commit/7971b223855d

Leading wildcards before valid token characters need to
be kept in order to respect the semantic of the filter.
A leading wildcard in such case changes the semantic of
a filter, i.e. two following filters are semantically
different:

    example/abc
    *example/abc

As a result, µBlock.BidiTrieContainer.indexOf() is now
able to deal with a needle of length zero -- which is
what happens in FilterPatternLeft(Ex) with filter
patterns starting with `*` (or `^*`) and followed by
valid token characters (0-9, a-z and %).
2020-02-03 14:09:37 -05:00
Raymond Hill
3ef999d44b
Enforce no scrollbars on body element
Related issue:
- https://github.com/uBlockOrigin/uBlock-issues/issues/881
2020-02-03 10:51:30 -05:00
Raymond Hill
a95ef16e06
Fix token position value when removing leading wildcard
Related issue:
- https://www.reddit.com/r/uBlockOrigin/comments/ex8ggg/

Regression from:
- https://github.com/gorhill/uBlock/commit/7971b223855d
2020-02-02 10:05:15 -05:00
Raymond Hill
1d51927d2e
Fix handling of end-anchor in redirect patterns
Related issue:
- https://github.com/uBlockOrigin/uBlock-issues/issues/872

An end-anchor was treated as literal `|` in the redirect
pattern to match instead of as a end-of-string condition.
2020-02-01 12:47:17 -05:00
Raymond Hill
ce055d0653
Import translation work from https://crowdin.com/project/ublock 2020-02-01 11:42:49 -05:00
Raymond Hill
4629732a69
Fine tune visuals of ruleset tools in popup panel 2020-02-01 11:36:14 -05:00
Raymond Hill
0627fcfb62
Fix broken row rendering for non-network-based URL
Reported internally by volunteers.

Regression from:
- https://github.com/gorhill/uBlock/commit/3a564c199260#diff-fd76b4e8f9d7bfb2e5e01510c9457633L367
2020-01-31 13:48:17 -05:00
Raymond Hill
fcc7781aef
Use proper popup URL 2020-01-30 12:43:41 -05:00
Raymond Hill
2b0316440e
First draft of popup panel for Firefox Preview
First draft of changes as discussed with Firefox
Preview people.

In order to allow testing/evaluating these changes,
the new advanced setting `uiFlavor` has been added.
Default to `unset`; and can currently only be set
to `fenix`.

The new setting takes effect at launch only. This
new setting is not to be mentioned in official
documentation for now.

This is ongoing work, not open to external feedback.
2020-01-25 09:24:59 -05:00
Raymond Hill
2e0a8951b8
Minor code review 2020-01-23 12:06:40 -05:00
Raymond Hill
043ae117c8
Decouple error handling of lists loading from selfie loading
This commit make it so that if an *unexpected* error is
thrown when trying to load the selfie at launch, the filter
lists will still be loaded as a result.
2020-01-21 10:52:13 -05:00
Raymond Hill
969dbecd49
Import translation work from https://crowdin.com/project/ublock 2020-01-10 11:13:55 -05:00
Raymond Hill
f8ec54c635
Fix compatibility issue with hosts files
Related issue:
- https://github.com/uBlockOrigin/uBlock-issues/issues/847

IP address `0` is a valid synonym of `0.0.0.0`.
2020-01-10 11:07:31 -05:00
Raymond Hill
8704e4e620
Improve token extraction from regex-based filters
Tokens which are as long or longer than the max token
length possible do not need to have the prefix part
evaluated against special regex characters. This will
help increase the likelihood of extracting a valid
token from regex-based filters.

Actual case found in EasyPrivacy:

  /^https?:\/\/eulerian..*\/[a-z0-9]{2,12}\.js/$script

Before this commit, uBO was not able to extract a
valid token, while now uBO is able to extract `eulerian`
as a valid token (consequently the regex-based filter
will now be evaluated only when the token `euleria` is
found in a URL).
2020-01-09 10:09:51 -05:00
Raymond Hill
2cf79ef922
Minor code review 2020-01-04 09:32:28 -05:00
Raymond Hill
d0738c0835
Visually distinguish canonical names in popup panel
Further fine-tuning support for canonical names.

Aliased canonical names will be rendered blue
in the dynamic filtering pane of the popup panel.
2019-12-31 16:36:51 -05:00
Raymond Hill
e9abce61a0
Fix unescaped attr value in generated CSS selector
Related feedback:
- https://github.com/NanoAdblocker/NanoCore2/commit/5e625da8fe45#commitcomment-36625096
2019-12-31 16:14:50 -05:00
Raymond Hill
a518a9c1e4
Import translation work from https://crowdin.com/project/ublock 2019-12-30 10:04:54 -05:00