Add the ability to use wildcard in white/black lists

This commit is contained in:
toptalo
2018-04-06 19:50:28 +03:00
parent 3f9b7d32c5
commit fcd176ee1d

View File

@@ -17,8 +17,10 @@ function contains(url, list) {
// If by any chance one line in the list is empty, ignore it
if(cleanLine === '') continue;
// If url contains the current line return true
if (url.indexOf(cleanLine) > -1) {
var lineRe = new RegExp(cleanLine.replace('.', '\.').replace('*', '.*'));
// If url matches the current line return true
if (lineRe.test(url)) {
return true;
}
}