mirror of
https://github.com/kkapsner/CanvasBlocker
synced 2024-12-22 12:50:36 +01:00
parent
56401048d1
commit
d159769997
@ -66,6 +66,11 @@
|
|||||||
}
|
}
|
||||||
|
|
||||||
const inputTypes = {
|
const inputTypes = {
|
||||||
|
all: {
|
||||||
|
updateCallback: function(input, value, defaultValue){
|
||||||
|
input.classList[value === defaultValue? "remove": "add"]("changed");
|
||||||
|
}
|
||||||
|
},
|
||||||
number: {
|
number: {
|
||||||
input: function(value){
|
input: function(value){
|
||||||
const input = document.createElement("input");
|
const input = document.createElement("input");
|
||||||
@ -73,8 +78,9 @@
|
|||||||
input.value = value;
|
input.value = value;
|
||||||
return input;
|
return input;
|
||||||
},
|
},
|
||||||
updateCallback: function(input, value){
|
updateCallback: function(input, value, defaultValue){
|
||||||
input.value = value;
|
input.value = value;
|
||||||
|
inputTypes.all.updateCallback(input, value, defaultValue);
|
||||||
return input.value;
|
return input.value;
|
||||||
},
|
},
|
||||||
getValue: function(input){
|
getValue: function(input){
|
||||||
@ -95,8 +101,9 @@
|
|||||||
input.value = value;
|
input.value = value;
|
||||||
return input;
|
return input;
|
||||||
},
|
},
|
||||||
updateCallback: function(input, value){
|
updateCallback: function(input, value, defaultValue){
|
||||||
input.value = value;
|
input.value = value;
|
||||||
|
inputTypes.all.updateCallback(input, value, defaultValue);
|
||||||
return input.value;
|
return input.value;
|
||||||
},
|
},
|
||||||
getValue: function(input){
|
getValue: function(input){
|
||||||
@ -111,8 +118,9 @@
|
|||||||
input.style.display = "inline-block";
|
input.style.display = "inline-block";
|
||||||
return input;
|
return input;
|
||||||
},
|
},
|
||||||
updateCallback: function(input, value){
|
updateCallback: function(input, value, defaultValue){
|
||||||
input.checked = value;
|
input.checked = value;
|
||||||
|
inputTypes.all.updateCallback(input, value, defaultValue);
|
||||||
return input.checked;
|
return input.checked;
|
||||||
},
|
},
|
||||||
getValue: function(input){
|
getValue: function(input){
|
||||||
@ -169,7 +177,7 @@
|
|||||||
container && container.hasOwnProperty(key)?
|
container && container.hasOwnProperty(key)?
|
||||||
container[key]:
|
container[key]:
|
||||||
setting.defaultKeyValue,
|
setting.defaultKeyValue,
|
||||||
url
|
setting.defaultKeyValue
|
||||||
);
|
);
|
||||||
});
|
});
|
||||||
keyInput.addEventListener("change", function(){
|
keyInput.addEventListener("change", function(){
|
||||||
@ -189,7 +197,7 @@
|
|||||||
container && container.hasOwnProperty(key)?
|
container && container.hasOwnProperty(key)?
|
||||||
container[key]:
|
container[key]:
|
||||||
setting.defaultKeyValue,
|
setting.defaultKeyValue,
|
||||||
url
|
setting.defaultKeyValue
|
||||||
);
|
);
|
||||||
logging.message("setting", setting.name, "(", key, ") was not changed");
|
logging.message("setting", setting.name, "(", key, ") was not changed");
|
||||||
}
|
}
|
||||||
@ -232,7 +240,7 @@
|
|||||||
urlCell.textContent = entry.url;
|
urlCell.textContent = entry.url;
|
||||||
row.appendChild(urlCell);
|
row.appendChild(urlCell);
|
||||||
let input = createInput(setting, entry.url);
|
let input = createInput(setting, entry.url);
|
||||||
type.updateCallback(input, setting.get(entry.url));
|
type.updateCallback(input, setting.get(entry.url), setting.defaultValue);
|
||||||
if (!entry.hasOwnProperty(setting.name)){
|
if (!entry.hasOwnProperty(setting.name)){
|
||||||
input.classList.add("notSpecifiedForUrl");
|
input.classList.add("notSpecifiedForUrl");
|
||||||
}
|
}
|
||||||
@ -319,14 +327,17 @@
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
if (type){
|
if (type){
|
||||||
setting.on(function(){type.updateCallback(input, setting.get(url));}, url);
|
setting.on(function(){
|
||||||
|
type.updateCallback(input, setting.get(url), setting.defaultValue);
|
||||||
|
}, url);
|
||||||
input.addEventListener("change", function(){
|
input.addEventListener("change", function(){
|
||||||
const value = type.getValue(input);
|
const value = type.getValue(input);
|
||||||
if (setting.set(value, url)){
|
if (setting.set(value, url)){
|
||||||
|
type.updateCallback(input, value, setting.defaultValue);
|
||||||
logging.message("changed setting", setting.name, ":", value);
|
logging.message("changed setting", setting.name, ":", value);
|
||||||
}
|
}
|
||||||
else {
|
else {
|
||||||
type.updateCallback(input, setting.get(url));
|
type.updateCallback(input, setting.get(url), setting.defaultValue);
|
||||||
logging.message("setting", setting.name, "was not changed");
|
logging.message("setting", setting.name, "was not changed");
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
@ -4,6 +4,7 @@ Version 1.10.1:
|
|||||||
|
|
||||||
new features:
|
new features:
|
||||||
- added tag search
|
- added tag search
|
||||||
|
- added :changed tag
|
||||||
|
|
||||||
fixes:
|
fixes:
|
||||||
- lag and functionality loss on google sites
|
- lag and functionality loss on google sites
|
||||||
|
Loading…
x
Reference in New Issue
Block a user