fix blacklist

This commit is contained in:
Alan Hamlett
2016-06-29 11:11:22 -07:00
parent 38c8a60698
commit 53b60eb90e
2 changed files with 14 additions and 12 deletions

View File

@@ -1,12 +1,12 @@
/**
* Creates an array from list using \n as delimiter
* and checks if the str is located in the list.
* and checks if any element in list is contained in the url.
*
* @param str
* @param url
* @param list
* @returns {boolean}
*/
function contains(str, list) {
function contains(url, list) {
var lines = list.split('\n');
for (var i = 0; i < lines.length; i ++) {
@@ -17,8 +17,8 @@ function contains(str, list) {
// If by any chance one line in the list is empty, ignore it
if(cleanLine === '') continue;
// If current line contains the str return true
if (cleanLine.indexOf(str) > -1) {
// If url contains the current line return true
if (url.indexOf(cleanLine) > -1) {
return true;
}
}