mirror of
https://github.com/kkapsner/CanvasBlocker
synced 2025-01-03 18:42:00 +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");
|
const resetSymbol = Symbol("reset");
|
||||||
function changeValue(name, newValue){
|
function changeValue(name, newValue){
|
||||||
var settingDefinition = scope.getDefinition(name);
|
var settingDefinition = scope.getDefinition(name);
|
||||||
var oldValue = settings[name];
|
if (settingDefinition){
|
||||||
if (newValue === resetSymbol){
|
var oldValue = settings[name];
|
||||||
newValue = settingDefinition.defaultValue;
|
if (newValue === resetSymbol){
|
||||||
}
|
newValue = settingDefinition.defaultValue;
|
||||||
settings[name] = newValue;
|
}
|
||||||
((eventHandler[name] || {})[defaultSymbol] || []).forEach(function(callback){
|
settings[name] = newValue;
|
||||||
callback({name, newValue, oldValue});
|
((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.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