2013-04-10 14:03:28 -07:00
|
|
|
|
(function (window) {
|
2013-04-08 13:46:59 -07:00
|
|
|
|
|
2013-04-10 14:03:28 -07:00
|
|
|
|
function playlist() {
|
|
|
|
|
var self = this;
|
2013-04-08 13:46:59 -07:00
|
|
|
|
|
2013-04-10 21:57:12 -07:00
|
|
|
|
if (typeof(self.queue) == 'undefined') {
|
|
|
|
|
self.queue = [];
|
|
|
|
|
}
|
2013-04-08 13:46:59 -07:00
|
|
|
|
|
2013-04-10 14:03:28 -07:00
|
|
|
|
self.add = function (item) {
|
2013-04-08 13:46:59 -07:00
|
|
|
|
|
2013-04-10 21:57:12 -07:00
|
|
|
|
self.queue.push(item);
|
|
|
|
|
|
2013-04-10 14:03:28 -07:00
|
|
|
|
};
|
2013-04-08 13:46:59 -07:00
|
|
|
|
|
2013-04-10 14:03:28 -07:00
|
|
|
|
self.remove = function (index) {
|
2013-04-10 10:11:23 -07:00
|
|
|
|
|
2013-04-10 21:57:12 -07:00
|
|
|
|
self.queue.splice(index, 1);
|
2013-04-10 14:03:28 -07:00
|
|
|
|
};
|
2013-04-10 10:11:23 -07:00
|
|
|
|
|
2013-04-10 21:57:12 -07:00
|
|
|
|
self.play = function (elem) {
|
|
|
|
|
var index = $(elem).attr("data-queue-index");
|
2013-04-10 10:11:23 -07:00
|
|
|
|
|
2013-04-10 21:57:12 -07:00
|
|
|
|
MediaPlayer.play(new Array(self.queue[index]));
|
|
|
|
|
self.queue.shift();
|
2013-04-10 14:03:28 -07:00
|
|
|
|
};
|
2013-04-10 10:11:23 -07:00
|
|
|
|
|
2013-04-10 14:03:28 -07:00
|
|
|
|
return self;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
window.Playlist = new playlist();
|
2013-04-10 21:57:12 -07:00
|
|
|
|
})(window);
|
|
|
|
|
|
|
|
|
|
(function ($, document) {
|
|
|
|
|
|
|
|
|
|
$(document).on('pagebeforeshow', "#playlistPage", function () {
|
|
|
|
|
|
|
|
|
|
var page = this;
|
|
|
|
|
|
|
|
|
|
Dashboard.showLoadingMsg();
|
|
|
|
|
|
|
|
|
|
$.each(Playlist.queue, function(i, item){
|
|
|
|
|
var html = '';
|
|
|
|
|
var name = item.Name;
|
|
|
|
|
|
|
|
|
|
if (item.IndexNumber != null) {
|
|
|
|
|
name = item.IndexNumber + " - " + name;
|
|
|
|
|
}
|
|
|
|
|
if (item.ParentIndexNumber != null) {
|
|
|
|
|
name = item.ParentIndexNumber + "." + name;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
//$('#itemImage', page).html(LibraryBrowser.getDetailImageHtml(item));
|
|
|
|
|
|
|
|
|
|
if (item.SeriesName || item.Album) {
|
|
|
|
|
var seriesName = item.SeriesName || item.Album;
|
|
|
|
|
}else {
|
|
|
|
|
var seriesName = item.ProductionYear;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
html += '<tr>';
|
|
|
|
|
html += '<td><img src="css/images/media/playCircle.png" style="height: 28px;" data-queue-index="'+i+'" onclick="Playlist.play(this)" /></td>';
|
|
|
|
|
html += '<td>' + name + '</td>';
|
|
|
|
|
html += '<td>' + seriesName + '</td>';
|
|
|
|
|
html += '<td>' + ticks_to_human(item.RunTimeTicks) + '</td>';
|
|
|
|
|
html += '<td></td>';
|
|
|
|
|
html += '</tr>';
|
|
|
|
|
|
|
|
|
|
$("#queueTable").append(html);
|
|
|
|
|
});
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
Dashboard.hideLoadingMsg();
|
|
|
|
|
});
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
})(jQuery, document);
|