mirror of
https://github.com/kkapsner/CanvasBlocker
synced 2025-07-04 04:26:35 +02:00
Code cleanup.
This commit is contained in:
parent
289cea0fc0
commit
01c1145e28
9 changed files with 81 additions and 61 deletions
|
@ -208,15 +208,6 @@
|
|||
"displayAdvancedSettings": [true]
|
||||
}
|
||||
},
|
||||
// {
|
||||
// "name": "notificationDisplayTime",
|
||||
// "title": "notification display time",
|
||||
// "type": "integer",
|
||||
// "value": 30,
|
||||
// "displayDependencies": {
|
||||
// "blockMode": ["fakeReadout", "fakeInput"]
|
||||
// }
|
||||
// },
|
||||
{
|
||||
"name": "ignoreList",
|
||||
"title": "Ignore list",
|
||||
|
@ -253,7 +244,8 @@
|
|||
"displayAdvancedSettings": [true]
|
||||
}
|
||||
]
|
||||
},{
|
||||
},
|
||||
{
|
||||
"name": "enableStackList",
|
||||
"title": "Use file specific scoped white list",
|
||||
"type": "bool",
|
||||
|
@ -316,8 +308,14 @@
|
|||
}
|
||||
}
|
||||
].forEach(function(pref){
|
||||
var html = "<td><div class=\"content\"><span class=\"title\">__MSG_" + pref.name + "_title__</span><div class=\"description\">__MSG_" + pref.name + "_description__</div></div></td><td><div class=\"content\">";
|
||||
var inputAttributes = " data-storage-name=\"" + pref.name + "\" data-storage-type=\"" + pref.type + "\" class=\"setting\"";
|
||||
var html = "<td><div class=\"content\">" +
|
||||
"<span class=\"title\">__MSG_" + pref.name + "_title__</span>" +
|
||||
"<div class=\"description\">__MSG_" + pref.name + "_description__</div>" +
|
||||
"</div></td><td><div class=\"content\">";
|
||||
var inputAttributes =
|
||||
" data-storage-name=\"" + pref.name + "\"" +
|
||||
" data-storage-type=\"" + pref.type + "\"" +
|
||||
" class=\"setting\"";
|
||||
switch (pref.type){
|
||||
case "integer":
|
||||
html += "<input type=\"number\"" + inputAttributes + " value=\"" + pref.value + "\">";
|
||||
|
@ -326,13 +324,20 @@
|
|||
html += "<input type=\"text\"" + inputAttributes + " value=\"" + pref.value + "\">";
|
||||
break;
|
||||
case "bool":
|
||||
html += "<input type=\"checkbox\" style=\"display: inline\"" + inputAttributes + (pref.value? " checked=\"checked\"": "") + ">";
|
||||
html += "<input type=\"checkbox\" style=\"display: inline\"" +
|
||||
inputAttributes +
|
||||
(pref.value? " checked=\"checked\"": "") +
|
||||
">";
|
||||
break;
|
||||
case "menulist":
|
||||
html += "<select" + inputAttributes + "data-type=\"" + (typeof pref.value) + "\">" +
|
||||
pref.options.map(function(option){
|
||||
if (option.value !== ""){
|
||||
return "<option value=\"" + option.value + "\"" + (option.value === pref.value? " selected": "") + ">__MSG_" + pref.name + "_options." + option.label + "__</option>";
|
||||
return "<option value=\"" + option.value + "\"" +
|
||||
(option.value === pref.value? " selected": "") +
|
||||
">" +
|
||||
"__MSG_" + pref.name + "_options." + option.label + "__" +
|
||||
"</option>";
|
||||
}
|
||||
else {
|
||||
return "<option disabled>----------------</option>";
|
||||
|
|
|
@ -74,11 +74,6 @@
|
|||
showReleaseNotes: function(){
|
||||
logging.verbose("open release notes");
|
||||
window.open("../releaseNotes.txt", "_blank");
|
||||
// would be nicer but is not supported in fennec
|
||||
// browser.windows.create({
|
||||
// url: "../releaseNotes.txt",
|
||||
// type: "popup"
|
||||
// });
|
||||
},
|
||||
clearPersistentRnd: function(){
|
||||
logging.message("clear persistent rnd storage");
|
||||
|
@ -104,7 +99,11 @@
|
|||
var displayDependencies = row.setting.displayDependencies;
|
||||
if (displayDependencies){
|
||||
row.classList[(
|
||||
(Array.isArray(displayDependencies)? displayDependencies: [displayDependencies]).some(function(displayDependency){
|
||||
(
|
||||
Array.isArray(displayDependencies)?
|
||||
displayDependencies:
|
||||
[displayDependencies]
|
||||
).some(function(displayDependency){
|
||||
return Object.keys(displayDependency).every(function(key){
|
||||
return displayDependency[key].indexOf(settings[key]) !== -1;
|
||||
});
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue