Merge pull request #65 from toptalo/feature/wildcard

Add ability to use wildcard in white/black url lists
This commit is contained in:
Alan Hamlett
2018-07-10 00:35:34 -07:00
committed by GitHub

View File

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