Enable "not permissions" filtering expression in logger

Related feedback:
https://github.com/uBlockOrigin/uBlock-issues/discussions/2714#discussioncomment-6959861
This commit is contained in:
Raymond Hill 2023-10-22 17:49:58 -04:00
parent 7ca18f77d9
commit 9bd483bec3
No known key found for this signature in database
GPG key ID: 25E1490B761470C2
3 changed files with 15 additions and 10 deletions

View file

@ -179,8 +179,11 @@ body[dir="rtl"] #netInspector #filterExprPicker {
background-color: rgb(var(--primary-70) / 25%); background-color: rgb(var(--primary-70) / 25%);
border: 1px solid rgb(var(--primary-70)); border: 1px solid rgb(var(--primary-70));
} }
#netInspector #filterExprPicker span.on[data-filtex] { #netInspector #filterExprPicker span.on[data-filtex],
#filterExprButton.active {
background-color: rgb(var(--primary-70) / 40%); background-color: rgb(var(--primary-70) / 40%);
}
#netInspector #filterExprPicker span.on[data-filtex] {
border: 1px solid rgb(var(--primary-70)); border: 1px solid rgb(var(--primary-70));
} }

View file

@ -2213,16 +2213,14 @@ const rowFilterer = (( ) => {
dom.cl.toggle(ev.target, 'expanded'); dom.cl.toggle(ev.target, 'expanded');
}; };
const onToggleBuiltinExpression = function(ev) { const builtinFilterExpression = function() {
builtinFilters.length = 0; builtinFilters.length = 0;
const filtexElems = qsa$('#filterExprPicker [data-filtex]');
dom.cl.toggle(ev.target, 'on');
const filtexElems = qsa$(ev.currentTarget, '[data-filtex]');
const orExprs = []; const orExprs = [];
let not = false; let not = false;
for ( const filtexElem of filtexElems ) { for ( const filtexElem of filtexElems ) {
let filtex = dom.attr(filtexElem, 'data-filtex'); const filtex = filtexElem.dataset.filtex;
let active = dom.cl.has(filtexElem, 'on'); const active = dom.cl.has(filtexElem, 'on');
if ( filtex === '!' ) { if ( filtex === '!' ) {
if ( orExprs.length !== 0 ) { if ( orExprs.length !== 0 ) {
builtinFilters.push({ builtinFilters.push({
@ -2250,11 +2248,15 @@ const rowFilterer = (( ) => {
dom.on('#filterButton', 'click', onFilterButton); dom.on('#filterButton', 'click', onFilterButton);
dom.on('#filterInput > input', 'input', onFilterChangedAsync); dom.on('#filterInput > input', 'input', onFilterChangedAsync);
dom.on('#filterExprButton', 'click', onToggleExtras); dom.on('#filterExprButton', 'click', onToggleExtras);
dom.on('#filterExprPicker', 'click', '[data-filtex]', onToggleBuiltinExpression); dom.on('#filterExprPicker', 'click', '[data-filtex]', ev => {
dom.cl.toggle(ev.target, 'on');
builtinFilterExpression();
});
// https://github.com/gorhill/uBlock/issues/404 // https://github.com/gorhill/uBlock/issues/404
// Ensure page state is in sync with the state of its various widgets. // Ensure page state is in sync with the state of its various widgets.
parseInput(); parseInput();
builtinFilterExpression();
filterAll(); filterAll();
return { filterOne, filterAll }; return { filterOne, filterAll };

View file

@ -66,9 +66,9 @@
</div> </div>
<div><span data-filtex="!" data-i18n="loggerRowFiltererBuiltinNot"></span><span data-filtex="\t(?:0,)?1\t" data-i18n="loggerRowFiltererBuiltin1p"></span><span data-filtex="\t(?:3(?:,\d)?|0,3)\t" data-i18n="loggerRowFiltererBuiltin3p"></span><span data-filtex="\t0,\d\t">tabless</span></div> <div><span data-filtex="!" data-i18n="loggerRowFiltererBuiltinNot"></span><span data-filtex="\t(?:0,)?1\t" data-i18n="loggerRowFiltererBuiltin1p"></span><span data-filtex="\t(?:3(?:,\d)?|0,3)\t" data-i18n="loggerRowFiltererBuiltin3p"></span><span data-filtex="\t0,\d\t">tabless</span></div>
<div><span data-filtex="!" data-i18n="loggerRowFiltererBuiltinNot"></span><span data-filtex="\tget\t">get</span><span data-filtex="\thead\t">head</span><span data-filtex="\tpost\t">post</span></div> <div><span data-filtex="!" data-i18n="loggerRowFiltererBuiltinNot"></span><span data-filtex="\tget\t">get</span><span data-filtex="\thead\t">head</span><span data-filtex="\tpost\t">post</span></div>
<div><span data-filtex="!" data-i18n="loggerRowFiltererBuiltinNot"></span> <div><span data-filtex="!" data-i18n="loggerRowFiltererBuiltinNot" class="on"></span>
<span style="flex-direction: column;"> <span style="flex-direction: column;">
<div><span data-filtex="\bcsp=[^\t]+\t(?:--|\+\+)\t">csp</span><span data-filtex="\bpermissions=[^\t]+\t(?:--|\+\+)\t">permissions</span><span data-filtex="\bredirect-rule=[^\t]+\t(?:--|\+\+)\t">redirect</span></div> <div><span data-filtex="\bcsp=[^\t]+\t(?:--|\+\+)\t">csp</span><span data-filtex="\bpermissions=[^\t]+\t(?:--|\+\+)\t" class="on">permissions</span><span data-filtex="\bredirect-rule=[^\t]+\t(?:--|\+\+)\t">redirect</span></div>
<div><span data-filtex="\bremoveparam=[^\t]+\t(?:--|\+\+)\t">removeparam</span><span data-filtex="\burltransform=[^\t]+\t(?:--|\+\+)\t">urltransform</span></div> <div><span data-filtex="\bremoveparam=[^\t]+\t(?:--|\+\+)\t">removeparam</span><span data-filtex="\burltransform=[^\t]+\t(?:--|\+\+)\t">urltransform</span></div>
</span> </span>
</div> </div>