Zone selector sorting vs uppercases

This makes the sorting of the Zone in the Zone selector
with the uppercase grouped with the lowercase for a same letter
but uppercase always first.
(Note: Accented char are considered as a different letter. We would need to support exception cases for all the existing charsets. These are only entities descriptors, not really for literature.)
This commit is contained in:
Alezia Kurdis 2020-05-28 23:32:44 -04:00 committed by GitHub
parent b7393b2398
commit 0b330dfcd6
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23

View file

@ -2905,21 +2905,24 @@ function getExistingZoneList() {
}; };
listExistingZones.push(thisZone); listExistingZones.push(thisZone);
} }
listExistingZones.sort(zoneSortOrder()); listExistingZones.sort(zoneSortOrder);
return listExistingZones; return listExistingZones;
} }
function zoneSortOrder() { function zoneSortOrder(a, b) {
return function(a, b) { var nameA = a.name.toUpperCase();
var nameA = a.name.toUpperCase(); var nameB = b.name.toUpperCase();
var nameB = b.name.toUpperCase(); if (nameA > nameB) {
if (nameA > nameB) { return 1;
return 1; } else if (nameA < nameB) {
} else if (nameA < nameB) { return -1;
return -1;
}
return 0;
} }
if (a.name > b.name) {
return 1;
} else if (a.name < b.name) {
return -1;
}
return 0;
} }
}()); // END LOCAL_SCOPE }()); // END LOCAL_SCOPE