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:
parent
dba995c5f0
commit
3e1d24d9a2
1 changed files with 6 additions and 0 deletions
|
@ -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';
|
||||
};
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue