mirror of
https://github.com/kkapsner/CanvasBlocker
synced 2024-12-22 12:50:36 +01:00
Do not struggle on unknown settings.
Fixes #169 Fixes #168 Fixes #164 Fixes #170
This commit is contained in:
parent
4348c71b55
commit
19a7a32e0f
@ -338,23 +338,25 @@
|
||||
const resetSymbol = Symbol("reset");
|
||||
function changeValue(name, newValue){
|
||||
var settingDefinition = scope.getDefinition(name);
|
||||
var oldValue = settings[name];
|
||||
if (newValue === resetSymbol){
|
||||
newValue = settingDefinition.defaultValue;
|
||||
}
|
||||
settings[name] = newValue;
|
||||
((eventHandler[name] || {})[defaultSymbol] || []).forEach(function(callback){
|
||||
callback({name, newValue, oldValue});
|
||||
});
|
||||
|
||||
if (settingDefinition.urlSpecific){
|
||||
urlContainer.get().forEach(function(entry){
|
||||
if (!entry.hasOwnProperty(name)){
|
||||
((eventHandler[name] || {})[entry.url] || []).forEach(function(callback){
|
||||
callback({name, newValue, oldValue, url: entry.url});
|
||||
});
|
||||
}
|
||||
if (settingDefinition){
|
||||
var oldValue = settings[name];
|
||||
if (newValue === resetSymbol){
|
||||
newValue = settingDefinition.defaultValue;
|
||||
}
|
||||
settings[name] = newValue;
|
||||
((eventHandler[name] || {})[defaultSymbol] || []).forEach(function(callback){
|
||||
callback({name, newValue, oldValue});
|
||||
});
|
||||
|
||||
if (settingDefinition.urlSpecific){
|
||||
urlContainer.get().forEach(function(entry){
|
||||
if (!entry.hasOwnProperty(name)){
|
||||
((eventHandler[name] || {})[entry.url] || []).forEach(function(callback){
|
||||
callback({name, newValue, oldValue, url: entry.url});
|
||||
});
|
||||
}
|
||||
});
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
Loading…
x
Reference in New Issue
Block a user