sorting arrays (schemes and highlights) as they are getting /added to the dropdown menu

This commit is contained in:
Amir H. Zekavati
2024-04-04 12:17:10 -07:00
committed by GitHub
parent e8c53edca7
commit 8acaa9b147
+9 -2
View File
@@ -1011,15 +1011,22 @@ function setHighlight(scheme) {
localStorageSet('highlight', scheme);
}
function sortArrayCaseInsenstive(array) {
return array.sort((a, b) => {
return a.toLowerCase().localeCompare(b.toLowerCase());
});
}
// Add scheme options to dropdown selector
schemes.forEach(function (scheme) {
sortArrayCaseInsenstive(schemes).forEach(function (scheme) {
var option = document.createElement('option');
option.textContent = scheme;
option.value = scheme;
$('#scheme-selector').appendChild(option);
});
highlights.forEach(function (scheme) {
sortArrayCaseInsenstive(highlights).forEach(function (scheme) {
var option = document.createElement('option');
option.textContent = scheme;
option.value = scheme;