Skip to content

Commit

Permalink
Mark default value in drop downs settings
Browse files Browse the repository at this point in the history
For #696
  • Loading branch information
kkapsner committed Apr 7, 2024
1 parent d159769 commit acce01b
Show file tree
Hide file tree
Showing 4 changed files with 39 additions and 1 deletion.
5 changes: 5 additions & 0 deletions _locales/en/messages.json
Original file line number Diff line number Diff line change
Expand Up @@ -109,6 +109,11 @@
"description": ""
},

"labelForDefaultOption": {
"message": " (default)",
"description": ""
},

"group_general": {
"message": "General",
"description": ""
Expand Down
18 changes: 17 additions & 1 deletion options/optionsGui.js
Original file line number Diff line number Diff line change
Expand Up @@ -51,23 +51,39 @@
const option = document.createElement("option");
if (typeof value === typeof setting.defaultValue){
option.value = value;
option.text = extension.getTranslation(setting.name + "_options." + value) || value;
if (setting.defaultValue === value){
option.selected = true;
option.selectedText = option.text;
option.notSelectedText = option.text + extension.getTranslation("labelForDefaultOption");
}
option.text = extension.getTranslation(setting.name + "_options." + value) || value;
}
else {
option.disabled = true;
option.text = "\u2500".repeat(20);
}
select.appendChild(option);
});
select.update = function(){
Array.from(select.options).forEach(function(option){
if (option.notSelectedText){
option.text = option.notSelectedText;
}
});
const selectedOption = select.options[select.selectedIndex];
if (selectedOption.selectedText){
selectedOption.text = selectedOption.selectedText;
}
};
return select;
}

const inputTypes = {
all: {
updateCallback: function(input, value, defaultValue){
if (input.update){
input.update();
}
input.classList[value === defaultValue? "remove": "add"]("changed");
}
},
Expand Down
1 change: 1 addition & 0 deletions releaseNotes.txt
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@ Version 1.10.1:
new features:
- added tag search
- added :changed tag
- mark default value in drop downs settings

fixes:
- lag and functionality loss on google sites
Expand Down
16 changes: 16 additions & 0 deletions versions/updates.json
Original file line number Diff line number Diff line change
Expand Up @@ -317,6 +317,22 @@
{
"version": "1.10.20240330",
"update_link": "https://canvasblocker.kkapsner.de/versions/canvasblocker_beta-1.10.20240330.xpi"
},
{
"version": "1.10.1.20240405",
"update_link": "https://canvasblocker.kkapsner.de/versions/canvasblocker_beta-1.10.1.20240405.xpi"
},
{
"version": "1.10.20240407",
"update_link": "https://canvasblocker.kkapsner.de/versions/canvasblocker_beta-1.10.20240407.xpi"
},
{
"version": "1.10.20240407.1",
"update_link": "https://canvasblocker.kkapsner.de/versions/canvasblocker_beta-1.10.20240407.1.xpi"
},
{
"version": "1.10.20240408",
"update_link": "https://canvasblocker.kkapsner.de/versions/canvasblocker_beta-1.10.20240408.xpi"
}
]
}
Expand Down

0 comments on commit acce01b

Please sign in to comment.