This commit is contained in:
gorhill 2017-07-03 10:20:47 -04:00
parent a8382e821d
commit 2cb8ddbe03
No known key found for this signature in database
GPG Key ID: 25E1490B761470C2
1 changed files with 14 additions and 8 deletions

View File

@ -701,16 +701,22 @@ var netFilteringManager = (function() {
};
var parseStaticInputs = function() {
var filter = '';
var options = [];
var block = selectValue('select.static.action') === '';
var filter = '',
options = [],
block = selectValue('select.static.action') === '';
if ( !block ) {
filter = '@@';
}
var value = selectValue('select.static.url');
if ( value !== '' ) {
filter += '||' + value;
if ( value.slice(-1) === '/' ) {
value += '*';
} else if ( /[/?]/.test(value) === false ) {
value += '^';
}
value = '||' + value;
}
filter += value;
value = selectValue('select.static.type');
if ( value !== '' ) {
options.push(uglyTypeFromSelector('static'));
@ -974,7 +980,7 @@ var netFilteringManager = (function() {
if ( pos === -1 ) {
pos = path.length;
}
urls.unshift(rootURL + path.slice(0, pos));
urls.unshift(rootURL + path.slice(0, pos + 1));
}
var query = matches[4] || '';
if ( query !== '') {
@ -1042,7 +1048,7 @@ var netFilteringManager = (function() {
var rePlaceholder = /\{\{[^}]+?\}\}/g;
var nodes = [];
var match, pos = 0;
var select, option, i, value;
var select, option, n, i, value;
for (;;) {
match = rePlaceholder.exec(template);
if ( match === null ) {
@ -1088,8 +1094,8 @@ var netFilteringManager = (function() {
case '{{url}}':
select = document.createElement('select');
select.className = 'static url';
for ( i = 0; i < targetURLs.length; i++ ) {
value = targetURLs[i].replace(/^[a-z]+:\/\//, '');
for ( i = 0, n = targetURLs.length; i < n; i++ ) {
value = targetURLs[i].replace(/^[a-z-]+:\/\//, '');
option = document.createElement('option');
option.setAttribute('value', value);
option.textContent = shortenLongString(value, 128);