mirror of
https://github.com/jellyfin/jellyfin-web
synced 2025-03-30 19:56:21 +00:00
moved playlist functionality into mediaplayer
This commit is contained in:
parent
75ff5c8f43
commit
283c35e6c7
2 changed files with 82 additions and 55 deletions
|
@ -3,55 +3,9 @@
|
|||
function playlist() {
|
||||
var self = this;
|
||||
|
||||
if (typeof(self.queue) == 'undefined') {
|
||||
self.queue = [];
|
||||
}
|
||||
|
||||
self.add = function (item) {
|
||||
|
||||
self.queue.push(item);
|
||||
|
||||
};
|
||||
|
||||
self.remove = function (elem) {
|
||||
var index = $(elem).attr("data-queue-index");
|
||||
|
||||
self.queue.splice(index, 1);
|
||||
|
||||
$(elem).parent().parent().remove();
|
||||
return false;
|
||||
};
|
||||
|
||||
self.play = function (elem) {
|
||||
var index = $(elem).attr("data-queue-index");
|
||||
|
||||
MediaPlayer.play(new Array(self.queue[index]));
|
||||
self.queue.splice(index, 1);
|
||||
};
|
||||
|
||||
self.playNext = function (item) {
|
||||
if (typeof self.queue[0] != "undefined") {
|
||||
MediaPlayer.play(new Array(self.queue[0]));
|
||||
self.queue.shift();
|
||||
}
|
||||
};
|
||||
|
||||
self.addNext = function (item) {
|
||||
if (typeof self.queue[0] != "undefined") {
|
||||
self.queue.unshift(item);
|
||||
}else {
|
||||
self.add(item);
|
||||
}
|
||||
};
|
||||
|
||||
self.inQueue = function (item) {
|
||||
$.each(Playlist.queue, function(i, queueItem){
|
||||
if (item.Id == queueItem.Id) {
|
||||
return true;
|
||||
}
|
||||
});
|
||||
return false;
|
||||
};
|
||||
|
||||
return self;
|
||||
}
|
||||
|
@ -69,7 +23,22 @@
|
|||
Dashboard.showLoadingMsg();
|
||||
|
||||
$("#queueTable").html('');
|
||||
$.each(Playlist.queue, function(i, item){
|
||||
|
||||
//currently playing item
|
||||
if (MediaPlayer.playing) {
|
||||
var html = '';
|
||||
html += '<tr>';
|
||||
html += '<td></td>';
|
||||
html += '<td>' + MediaPlayer.playing.Name + '</td>';
|
||||
html += '<td>' + MediaPlayer.playing.Album + '</td>';
|
||||
html += '<td>' + ticks_to_human(MediaPlayer.playing.RunTimeTicks) + '</td>';
|
||||
html += '<td>' + LibraryBrowser.getUserDataIconsHtml(MediaPlayer.playing) + '</td>';
|
||||
html += '<td></td>';
|
||||
html += '</tr>';
|
||||
$("#queueTable").append(html);
|
||||
}
|
||||
|
||||
$.each(MediaPlayer.queue, function(i, item){
|
||||
var html = '';
|
||||
var name = item.Name;
|
||||
|
||||
|
@ -89,12 +58,12 @@
|
|||
}
|
||||
|
||||
html += '<tr>';
|
||||
html += '<td><img src="css/images/media/playCircle.png" style="height: 28px;cursor:pointer;" data-queue-index="'+i+'" onclick="Playlist.play(this)" /></td>';
|
||||
html += '<td><img src="css/images/media/playCircle.png" style="height: 28px;cursor:pointer;" data-queue-index="'+i+'" onclick="MediaPlayer.queuePlay(this)" /></td>';
|
||||
html += '<td>' + name + '</td>';
|
||||
html += '<td>' + seriesName + '</td>';
|
||||
html += '<td>' + ticks_to_human(item.RunTimeTicks) + '</td>';
|
||||
html += '<td>' + LibraryBrowser.getUserDataIconsHtml(item) + '</td>';
|
||||
html += '<td><a href="" data-queue-index="'+i+'" onclick="Playlist.remove(this)">remove</a></td>';
|
||||
html += '<td><a href="" data-queue-index="'+i+'" onclick="MediaPlayer.queueRemove(this)">remove</a></td>';
|
||||
html += '</tr>';
|
||||
|
||||
$("#queueTable").append(html);
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue