mirror of
https://github.com/jellyfin/jellyfin-web
synced 2025-03-30 19:56:21 +00:00
Merge pull request #1237 from DesertCookie/sorted-media-sources
Sort multi-version movie dropdown menu
This commit is contained in:
commit
7ec3724db6
2 changed files with 25 additions and 1 deletions
|
@ -36,6 +36,7 @@
|
||||||
- [MrTimscampi](https://github.com/MrTimscampi)
|
- [MrTimscampi](https://github.com/MrTimscampi)
|
||||||
- [ConfusedPolarBear](https://github.com/ConfusedPolarBear)
|
- [ConfusedPolarBear](https://github.com/ConfusedPolarBear)
|
||||||
- [Sarab Singh](https://github.com/sarab97)
|
- [Sarab Singh](https://github.com/sarab97)
|
||||||
|
- [DesertCookie](https://github.com/desertcookie)
|
||||||
- [GuilhermeHideki](https://github.com/GuilhermeHideki)
|
- [GuilhermeHideki](https://github.com/GuilhermeHideki)
|
||||||
- [Andrei Oanca](https://github.com/OancaAndrei)
|
- [Andrei Oanca](https://github.com/OancaAndrei)
|
||||||
- [Cromefire_](https://github.com/cromefire)
|
- [Cromefire_](https://github.com/cromefire)
|
||||||
|
|
|
@ -171,7 +171,30 @@ function renderTrackSelections(page, instance, item, forceReload) {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
const mediaSources = item.MediaSources;
|
let mediaSources = item.MediaSources;
|
||||||
|
|
||||||
|
const resolutionNames = [];
|
||||||
|
const sourceNames = [];
|
||||||
|
mediaSources.forEach(function (v) {
|
||||||
|
(v.Name.endsWith('p') || v.Name.endsWith('i')) && !Number.isNaN(parseInt(v.Name, 10)) ? resolutionNames.push(v) : sourceNames.push(v);
|
||||||
|
});
|
||||||
|
|
||||||
|
resolutionNames.sort((a, b) => parseInt(b.Name, 10) - parseInt(a.Name, 10));
|
||||||
|
sourceNames.sort(function(a, b) {
|
||||||
|
const nameA = a.Name.toUpperCase();
|
||||||
|
const nameB = b.Name.toUpperCase();
|
||||||
|
if (nameA < nameB) {
|
||||||
|
return -1;
|
||||||
|
} else if (nameA > nameB) {
|
||||||
|
return 1;
|
||||||
|
}
|
||||||
|
return 0;
|
||||||
|
});
|
||||||
|
|
||||||
|
mediaSources = [];
|
||||||
|
resolutionNames.forEach(v => mediaSources.push(v));
|
||||||
|
sourceNames.forEach(v => mediaSources.push(v));
|
||||||
|
|
||||||
instance._currentPlaybackMediaSources = mediaSources;
|
instance._currentPlaybackMediaSources = mediaSources;
|
||||||
|
|
||||||
page.querySelector('.trackSelections').classList.remove('hide');
|
page.querySelector('.trackSelections').classList.remove('hide');
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue