From fcd176ee1d575428e51d069c07e69b4b8f230445 Mon Sep 17 00:00:00 2001 From: toptalo Date: Fri, 6 Apr 2018 19:50:28 +0300 Subject: [PATCH] Add the ability to use wildcard in white/black lists --- assets/js/helpers/contains.js | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/assets/js/helpers/contains.js b/assets/js/helpers/contains.js index cd9c53f..d40f1b2 100644 --- a/assets/js/helpers/contains.js +++ b/assets/js/helpers/contains.js @@ -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; } }