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

Don't shuffle first item

This commit is contained in:
ferferga 2020-06-22 18:02:45 +02:00
parent dba995c5f0
commit 3e1d24d9a2

View file

@ -60,16 +60,22 @@ define([], function () {
PlayQueueManager.prototype.shufflePlaylist = function () {
this._sortedPlaylist = [];
let currentPlaylistItem = this._playlist[this.getCurrentPlaylistIndex()];
for (let item of this._playlist) {
this._sortedPlaylist.push(item);
}
for (let i = this._playlist.length - 1; i > 0; i--) {
if (this._playlist[i] === currentPlaylistItem) {
this._playlist.splice(i, 1);
continue;
}
const j = Math.floor(Math.random() * i);
const temp = this._playlist[i];
this._playlist[i] = this._playlist[j];
this._playlist[j] = temp;
}
this._playlist.unshift(currentPlaylistItem);
this._shuffleMode = 'Shuffle';
};