mirror of
https://github.com/kkapsner/CanvasBlocker
synced 2025-07-04 20:46:39 +02:00
Fixed bug that the update of the lists sometimes did not use the new value but the old one.
This commit is contained in:
parent
2b1a32e078
commit
26c5968b64
2 changed files with 18 additions and 14 deletions
26
lib/lists.js
26
lib/lists.js
|
@ -67,24 +67,26 @@
|
|||
black: []
|
||||
};
|
||||
|
||||
function updateList(type){
|
||||
function updateList(type, value){
|
||||
"use strict";
|
||||
|
||||
lists[type] = getDomainRegExpList(prefs[type + "List"]);
|
||||
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(){
|
||||
updateList(type);
|
||||
preferences.on(type + "List", function(value){
|
||||
updateList(type, value);
|
||||
});
|
||||
updateList(type);
|
||||
updateList(type, prefs[type + "List"]);
|
||||
});
|
||||
|
||||
function updateStackList(){
|
||||
function updateStackList(value){
|
||||
var list;
|
||||
try {
|
||||
var data = JSON.parse(prefs.stackList);
|
||||
var data = JSON.parse(value);
|
||||
if (!Array.isArray(data)){
|
||||
data = [data];
|
||||
}
|
||||
|
@ -103,10 +105,10 @@
|
|||
lists.stack = list;
|
||||
}
|
||||
lists.stack = [];
|
||||
preferences.on("stackList", function(){
|
||||
updateStackList();
|
||||
preferences.on("stackList", function(value){
|
||||
updateStackList(value);
|
||||
});
|
||||
updateStackList();
|
||||
updateStackList(prefs.stackList);
|
||||
|
||||
scope.get = function getList(type){
|
||||
"use strict";
|
||||
|
@ -127,6 +129,6 @@
|
|||
updateList("white");
|
||||
updateList("ignore");
|
||||
updateList("black");
|
||||
updateStackList();
|
||||
updateStackList(prefs.stackList);
|
||||
};
|
||||
}());
|
Loading…
Add table
Add a link
Reference in a new issue