uBlock/src/css/codemirror.css
Raymond Hill bde3164eb4
Add support for 1P, 3P, header= filter options and other changes
New filter options
==================

Strict partyness: `1P`, `3P`
----------------------------

The current options 1p/3p are meant to "weakly" match partyness, i.e. a
network request is considered 1st-party to its context as long as both the
context and the request share the same base domain.

The new partyness options are meant to check for strict partyness, i.e. a
network request will be considered 1st-party if and only if both the context
and the request share the same hostname.

For examples:

- context: `www.example.org`
- request: `www.example.org`
- `1p`: yes, `1P`: yes
- `3p`: no,  `3P`: no

- context: `www.example.org`
- request: `subdomain.example.org`
- `1p`: yes, `1P`: no
- `3p`: no,  `3P`: yes

- context: `www.example.org`
- request: `www.example.com`
- `1p`: no, `1P`: no
- `3p`: yes,  `3P`: yes

The strict partyness options will be visually emphasized in the editor so as
to prevent mistakenly using `1P` or `3P` where weak partyness is meant to be
used.

Filter on response headers: `header=`
-------------------------------------

Currently experimental and under evaluation. Disabled by default, enable by
toggling `filterOnHeaders` to `true` in advanced settings.

Ability to filter network requests according to whether a specific response
header is present and whether it matches or does not match a specific value.

For example:

    *$1p,3P,script,header=via:1\.1\s+google

The above filter is meant to block network requests which fullfill all the
following conditions:

- is weakly 1st-party to the context
- is not strictly 1st-party to the context
- is of type `script`
- has a response HTTP header named `via`, which value matches the regular
  expression `1\.1\s+google`.

The matches are always performed in a case-insensitive manner.

The header value is assumed to be a literal regular expression, except for
the following special characters:

- to anchor to start of string, use leading `|`, not `^`
- to anchor to end of string, use trailing `|`, not `$`
- to invert the test, use a leading `!`

To block a network request if it merely contains a specific HTTP header is
just a matter of specifying the header name without a header value:

    *$1p,3P,script,header=via

Generic exception filters can be used to disable specific block `header=`
filters, i.e. `@@*$1p,3P,script,header` will override the block `header=`
filters given as example above.

Dynamic filtering's `allow` rules override block `headers=` filters.

Important: It is key that filter authors use as many narrowing filter options
as possible when using the `header=` option, and the `header=` option should
be used ONLY when other filter options are not sufficient.

More documentation justifying the purpose of `header=` option will be
provided eventually if ever it is decided to move it from experimental to
stable status.

To be decided: to restrict usage of this filter option to only uBO's own
filter lists or "My filters".

Changes
=======

Fine tuning `queryprune=`
-------------------------

The following changes have been implemented:

The special value `*` (i.e. `queryprune=*`) means "remove all query
parameters".

If the `queryprune=` value is made only of alphanumeric characters
(including `_`), the value will be internally converted to regex  equivalent
`^value=`. This ensures a better future compatibility with AdGuard's
`removeparam=`.

If the `queryprune=` value starts with `!`, the test will be inverted. This
can be used to remove all query parameters EXCEPT those who match the
specified value.

Other
-----

The legacy code to test for spurious CSP reports has been removed. This
is no longer an issue ever since uBO redirects to local resources through
web accessible resources.

Notes
=====

The following new and recently added filter options are not compatible with
Chromium's manifest v3 changes:

- `queryprune=`
- `1P`
- `3P`
- `header=`
2020-11-23 08:22:43 -05:00

196 lines
4.6 KiB
CSS

.codeMirrorContainer {
font-size: 12px;
line-height: 1.25;
overflow: hidden;
position: relative;
}
.CodeMirror {
background-color: var(--default-surface);
box-sizing: border-box;
color: var(--default-ink);
flex-grow: 1;
height: 100%;
width: 100%;
}
.CodeMirror-lines {
padding-bottom: 6rem;
}
.CodeMirror-gutters {
background-color: var(--cm-gutter-surface);
border-color: var(--cm-gutter-border);
}
.CodeMirror-linenumber {
color: var(--cm-gutter-ink);
}
/* For when panels are used */
.codeMirrorContainer > div:not([class^="CodeMirror"]) {
display: flex;
flex-direction: column;
height: 100%;
}
.codeMirrorContainer.codeMirrorBreakAll .CodeMirror-wrap pre {
word-break: break-all;
}
/* CodeMirror theme overrides */
.CodeMirror-focused .CodeMirror-selected {
background: var(--cm-selection-surface);
color: var(--cm-selection-ink);
}
.CodeMirror-line::selection,
.CodeMirror-line > span::selection,
.CodeMirror-line > span > span::selection {
background: var(--cm-selection-surface);
color: var(--cm-selection-ink);
}
.cm-s-default .cm-comment {
color: var(--sf-comment-ink);
}
.cm-s-default .cm-def {
color: var(--sf-def-ink);
}
.cm-s-default .cm-directive {
color: var(--sf-directive-ink);
font-weight: bold;
}
.cm-s-default .cm-error {
color: inherit;
}
.cm-s-default .cm-error,
.CodeMirror-linebackground.error {
background-color: var(--sf-error-surface);
text-decoration: underline var(--sf-error-ink);
text-underline-position: under;
}
.cm-s-default .cm-link {
text-decoration: none;
}
.cm-s-default .cm-link:hover {
color: var(--link-ink);
}
.cm-s-default .cm-keyword {
color: var(--sf-keyword-ink);
}
.cm-s-default .cm-notice {
text-underline-position: under;
text-decoration-color: var(--sf-notice-ink);
text-decoration-style: solid;
text-decoration-line: underline;
}
.cm-s-default .cm-tag {
color: var(--sf-tag-ink);
}
.cm-s-default .cm-value { color: var(--sf-value-ink); }
.cm-s-default .cm-variable {
color: var(--sf-variable-ink);
}
.cm-s-default .cm-warning {
text-decoration: underline var(--sf-warning-ink);
text-underline-position: under;
}
/* Rules */
.cm-s-default .cm-allowrule {
color: var(--df-allow-ink);
font-weight: bold;
}
.cm-s-default .cm-blockrule {
color: var(--df-block-ink);
font-weight: bold;
}
.cm-s-default .cm-nooprule {
color: var(--df-noop-ink);
font-weight: bold;
}
.cm-s-default .cm-sortkey {
color: var(--sf-keyword-ink);
}
div.CodeMirror span.CodeMirror-matchingbracket {
color: unset;
}
.CodeMirror-matchingbracket {
background-color: #afa;
color: inherit !important;
font-weight: bold;
}
.cm-search-widget {
align-items: center;
background-color: var(--cm-gutter-surface);
border-bottom: 1px solid var(--cm-gutter-border);
cursor: default;
direction: ltr;
display: flex;
flex-shrink: 0;
justify-content: space-between;
padding: 0.5em;
user-select: none;
-moz-user-select: none;
-webkit-user-select: none;
z-index: 1000;
}
.cm-search-widget-input {
display: inline-flex;
flex-grow: 1;
}
.cm-search-widget .fa-icon {
fill: var(--cm-gutter-ink);
font-size: 140%;
}
.cm-search-widget .fa-icon:not(.fa-icon-ro):hover {
fill: #000;
}
.cm-search-widget-input input {
border: 1px solid var(--cm-gutter-ink);
display: inline-flex;
flex-grow: 1;
max-width: 16em;
}
.cm-search-widget-count {
align-items: center;
display: inline-flex;
flex-grow: 0;
font-size: 95%;
min-width: 6em;
visibility: hidden;
}
.cm-search-widget[data-query] .cm-search-widget-count:not(:empty) {
visibility: visible;
}
.cm-search-widget .cm-search-widget-button:hover {
color: #000;
}
.cm-search-widget .sourceURL[href=""] {
display: none;
}
.cm-searching {
background-color: var(--cm-searching-surface) !important;
border: 1px dotted black;
}
.CodeMirror-merge {
border-color: var(--cm-gutter-border);
}
.CodeMirror-merge-l-deleted {
background-image: none;
}
.CodeMirror-merge-l-inserted {
background-image: none;
}
/* This probably needs to be added to CodeMirror repo */
.CodeMirror-merge-gap {
background-color: var(--cm-gutter-surface);
border-color: var(--cm-gutter-border);
vertical-align: top;
}
.CodeMirror-merge-spacer {
background-color: var(--cm-gutter-surface);
}
.CodeMirror-hints {
z-index: 10000;
}