mirror of
https://github.com/kkapsner/CanvasBlocker
synced 2025-07-04 12:36:37 +02:00
Introduced stackList.
This commit is contained in:
parent
24d67113d6
commit
d2f5a0cca1
6 changed files with 112 additions and 24 deletions
26
lib/lists.js
26
lib/lists.js
|
@ -69,6 +69,32 @@ Object.keys(lists).forEach(function(type){
|
|||
updateList(type);
|
||||
});
|
||||
|
||||
function updateStackList(){
|
||||
try {
|
||||
var data = JSON.parse(prefs.stackList);
|
||||
if (!Array.isArray(data)){
|
||||
data = [data];
|
||||
}
|
||||
var list = data.filter(function(entry){
|
||||
return typeof entry === "object" && typeof entry.url === "string";
|
||||
});
|
||||
}
|
||||
catch(e){
|
||||
var list = [];
|
||||
}
|
||||
list.match = function(stack){
|
||||
return this.some(function(stackRule){
|
||||
return stack.match(stackRule);
|
||||
});
|
||||
};
|
||||
lists.stack = list;
|
||||
}
|
||||
lists.stack = [];
|
||||
preferences.on("stackList", function(){
|
||||
updateStackList();
|
||||
});
|
||||
updateStackList();
|
||||
|
||||
exports.get = function getList(type){
|
||||
"use strict";
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue