mirror of
https://github.com/gorhill/uBlock.git
synced 2024-09-04 01:59:38 +02:00
Fix linter incorrectly reporting header=
option
Related feedback: - https://www.reddit.com/r/uBlockOrigin/comments/13thksi/filter_blocking_rule_based_on_post_methods_value/jlvhuoy/
This commit is contained in:
parent
45187077cf
commit
d776edf06b
@ -70,6 +70,7 @@ let cachedUserFilters = '';
|
|||||||
if ( response instanceof Object === false ) { return; }
|
if ( response instanceof Object === false ) { return; }
|
||||||
if ( response.hintUpdateToken !== undefined ) {
|
if ( response.hintUpdateToken !== undefined ) {
|
||||||
const mode = cmEditor.getMode();
|
const mode = cmEditor.getMode();
|
||||||
|
cmEditor.setOption('filterOnHeaders', response.filterOnHeaders === true);
|
||||||
if ( mode.setHints instanceof Function ) {
|
if ( mode.setHints instanceof Function ) {
|
||||||
mode.setHints(response);
|
mode.setHints(response);
|
||||||
}
|
}
|
||||||
|
@ -73,6 +73,7 @@ import './codemirror/ubo-static-filtering.js';
|
|||||||
});
|
});
|
||||||
if ( hints instanceof Object ) {
|
if ( hints instanceof Object ) {
|
||||||
const mode = cmEditor.getMode();
|
const mode = cmEditor.getMode();
|
||||||
|
cmEditor.setOption('filterOnHeaders', hints.filterOnHeaders === true);
|
||||||
if ( mode.setHints instanceof Function ) {
|
if ( mode.setHints instanceof Function ) {
|
||||||
mode.setHints(hints);
|
mode.setHints(hints);
|
||||||
}
|
}
|
||||||
|
@ -37,6 +37,16 @@ const preparseDirectiveHints = [];
|
|||||||
const originHints = [];
|
const originHints = [];
|
||||||
let hintHelperRegistered = false;
|
let hintHelperRegistered = false;
|
||||||
|
|
||||||
|
|
||||||
|
/******************************************************************************/
|
||||||
|
|
||||||
|
let filterOnHeaders = false;
|
||||||
|
|
||||||
|
CodeMirror.defineOption('filterOnHeaders', false, (cm, state) => {
|
||||||
|
filterOnHeaders = state;
|
||||||
|
self.dispatchEvent(new Event('filterOnHeaders'));
|
||||||
|
});
|
||||||
|
|
||||||
/******************************************************************************/
|
/******************************************************************************/
|
||||||
|
|
||||||
CodeMirror.defineMode('ubo-static-filtering', function() {
|
CodeMirror.defineMode('ubo-static-filtering', function() {
|
||||||
@ -206,6 +216,10 @@ CodeMirror.defineMode('ubo-static-filtering', function() {
|
|||||||
return '+';
|
return '+';
|
||||||
};
|
};
|
||||||
|
|
||||||
|
self.addEventListener('filterOnHeaders', ( ) => {
|
||||||
|
astParser.options.filterOnHeaders = filterOnHeaders;
|
||||||
|
});
|
||||||
|
|
||||||
return {
|
return {
|
||||||
lineComment: '!',
|
lineComment: '!',
|
||||||
token: function(stream) {
|
token: function(stream) {
|
||||||
@ -285,7 +299,6 @@ CodeMirror.defineMode('ubo-static-filtering', function() {
|
|||||||
hintHelperRegistered = true;
|
hintHelperRegistered = true;
|
||||||
initHints();
|
initHints();
|
||||||
}
|
}
|
||||||
astParser.options.filterOnHeaders = details.filterOnHeaders === true;
|
|
||||||
},
|
},
|
||||||
parser: astParser,
|
parser: astParser,
|
||||||
};
|
};
|
||||||
@ -978,6 +991,10 @@ CodeMirror.registerHelper('fold', 'ubo-static-filtering', (( ) => {
|
|||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
|
self.addEventListener('filterOnHeaders', ( ) => {
|
||||||
|
astParser.options.filterOnHeaders = filterOnHeaders;
|
||||||
|
});
|
||||||
|
|
||||||
CodeMirror.defineInitHook(cm => {
|
CodeMirror.defineInitHook(cm => {
|
||||||
cm.on('changes', onChanges);
|
cm.on('changes', onChanges);
|
||||||
cm.on('beforeChange', onBeforeChanges);
|
cm.on('beforeChange', onBeforeChanges);
|
||||||
|
Loading…
Reference in New Issue
Block a user