1
0
Fork 0
mirror of https://github.com/jellyfin/jellyfin-web synced 2025-03-30 19:56:21 +00:00

Sort playback media sources alphabetically

Sorts the map of media sources received by the server alphabetically ignoring capitilisation.
This commit is contained in:
DesertCookie 2020-05-16 14:22:25 +02:00
parent a48e78edac
commit 5ad1c57b52

View file

@ -146,6 +146,17 @@ define(['loading', 'appRouter', 'layoutManager', 'connectionManager', 'userSetti
page.querySelector('.trackSelections').classList.remove('hide');
select.setLabel(globalize.translate('LabelVersion'));
var currentValue = select.value;
mediaSources.sort(function(a, b) {
var nameA = a.Name.toUpperCase();
var nameB = b.Name.toUpperCase();
if(nameA < nameB) {
return -1;
}
if(nameA > nameB) {
return 1;
}
return 0;
});
var selectedId = mediaSources[0].Id;
select.innerHTML = mediaSources.map(function (v) {
var selected = v.Id === selectedId ? ' selected' : '';