1
0
Fork 0
mirror of https://github.com/kkapsner/CanvasBlocker synced 2025-07-04 20:46:39 +02:00

Code linting.

This commit is contained in:
kkapsner 2017-10-03 15:35:31 +02:00
parent cde71f8a62
commit ef38abe545
24 changed files with 642 additions and 559 deletions

View file

@ -1,4 +1,3 @@
/* jslint moz: true */
/* This Source Code Form is subject to the terms of the Mozilla Public
* License, v. 2.0. If a copy of the MPL was not distributed with this
* file, You can obtain one at http://mozilla.org/MPL/2.0/. */
@ -21,8 +20,6 @@
function getDomainRegExpList(domainList){
"use strict";
var list = domainList
.split(",")
.map(function(entry){
@ -35,7 +32,7 @@
var regExp;
var domain = !!entry.match(/^[\w.]+$/);
if (domain){
regExp = new RegExp("(?:^|\\.)" + entry.replace(/([\\\+\*\?\[\^\]\$\(\)\{\}\=\!\|\.])/g, "\\$1") + "\\.?$", "i");
regExp = new RegExp("(?:^|\\.)" + entry.replace(/([\\+*?[^\]$(){}=!|.])/g, "\\$1") + "\\.?$", "i");
}
else {
regExp = new RegExp(entry, "i");
@ -68,15 +65,12 @@
};
function updateList(type, value){
"use strict";
if (typeof value === "undefined"){
value = prefs[type + "List"];
}
lists[type] = getDomainRegExpList(value);
}
Object.keys(lists).forEach(function(type){
"use strict";
preferences.on(type + "List", function(value){
updateList(type, value);
});
@ -111,13 +105,9 @@
updateStackList(prefs.stackList);
scope.get = function getList(type){
"use strict";
return lists[type];
};
scope.appendTo = function appendToList(type, entry){
"use strict";
prefs[type + "List"] += (prefs[type + "List"]? ",": "") + entry;
var obj = {};
obj[type + "List"] = prefs[type + "List"];