mirror of
https://github.com/gorhill/uBlock.git
synced 2026-03-11 09:04:36 +00:00
this fixes #757
This commit is contained in:
parent
6c83063367
commit
90b8ddf404
1 changed files with 10 additions and 1 deletions
|
|
@ -97,8 +97,17 @@ function handleImportFilePicker() {
|
||||||
if ( typeof this.result !== 'string' || this.result === '' ) {
|
if ( typeof this.result !== 'string' || this.result === '' ) {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
// https://github.com/gorhill/uBlock/issues/757
|
||||||
|
// Support RequestPolicy rule syntax
|
||||||
|
var result = this.result;
|
||||||
|
var matches = /\[origins-to-destinations\]([^\[]+)/.exec(result);
|
||||||
|
if ( matches && matches.length === 2 ) {
|
||||||
|
result = matches[1].trim()
|
||||||
|
.replace(/\|/g, ' ')
|
||||||
|
.replace(/\n/g, ' * noop\n');
|
||||||
|
}
|
||||||
var textarea = uDom('#rulesEditor');
|
var textarea = uDom('#rulesEditor');
|
||||||
textarea.val([textarea.val(), this.result].join('\n').trim());
|
textarea.val([textarea.val(), result].join('\n').trim());
|
||||||
rulesChanged();
|
rulesChanged();
|
||||||
};
|
};
|
||||||
var file = this.files[0];
|
var file = this.files[0];
|
||||||
|
|
|
||||||
Loading…
Reference in a new issue