2013-06-07 09:06:32 -07:00
|
|
|
|
(function ($, document) {
|
2013-04-08 13:46:59 -07:00
|
|
|
|
|
2013-06-07 09:06:32 -07:00
|
|
|
|
function reloadPlaylist(page) {
|
|
|
|
|
|
|
|
|
|
var html = '';
|
2013-04-08 13:46:59 -07:00
|
|
|
|
|
2013-06-07 09:06:32 -07:00
|
|
|
|
html += '<table class="detailTable">';
|
2013-04-08 13:46:59 -07:00
|
|
|
|
|
2013-06-07 09:06:32 -07:00
|
|
|
|
html += '<tr>';
|
|
|
|
|
html += '<th></th>';
|
|
|
|
|
html += '<th>Name</th>';
|
|
|
|
|
html += '<th>Album</th>';
|
|
|
|
|
html += '<th>Time</th>';
|
|
|
|
|
html += '<th>Rating</th>';
|
|
|
|
|
html += '</tr>';
|
2013-04-08 13:46:59 -07:00
|
|
|
|
|
2013-06-07 09:06:32 -07:00
|
|
|
|
$.each(MediaPlayer.playlist, function (i, item) {
|
2013-04-10 21:57:12 -07:00
|
|
|
|
|
2013-06-07 09:06:32 -07:00
|
|
|
|
var name = LibraryBrowser.getPosterViewDisplayName(item);
|
2013-04-17 18:32:38 -07:00
|
|
|
|
|
2013-06-07 09:06:32 -07:00
|
|
|
|
var parentName = item.SeriesName || item.Album || item.ProductionYear || '';
|
2013-04-10 21:57:12 -07:00
|
|
|
|
|
2013-06-07 09:06:32 -07:00
|
|
|
|
html += '<tr>';
|
2013-06-07 09:17:45 -07:00
|
|
|
|
html += '<td><a href="#" data-index="' + i + '" class="lnkPlay"><img src="css/images/media/playcircle.png" style="height: 20px;" /></a></td>';
|
2013-06-07 09:06:32 -07:00
|
|
|
|
html += '<td>' + name + '</td>';
|
|
|
|
|
html += '<td>' + parentName + '</td>';
|
2013-06-07 10:29:33 -07:00
|
|
|
|
html += '<td>' + Dashboard.getDisplayTime(item.RunTimeTicks) + '</td>';
|
2013-06-07 09:06:32 -07:00
|
|
|
|
html += '<td>' + LibraryBrowser.getUserDataIconsHtml(item) + '</td>';
|
2013-06-07 09:17:45 -07:00
|
|
|
|
html += '<td><a href="#" data-index="' + i + '" class="lnkRemove"><img src="css/images/media/remove.png" style="height: 20px;" /></a></td>';
|
2013-06-07 09:06:32 -07:00
|
|
|
|
html += '</tr>';
|
|
|
|
|
});
|
2013-04-10 21:57:12 -07:00
|
|
|
|
|
2013-06-07 09:06:32 -07:00
|
|
|
|
html += '</table>';
|
2013-04-10 21:57:12 -07:00
|
|
|
|
|
2013-06-07 09:06:32 -07:00
|
|
|
|
$("#playlist", page).html(html).trigger('create');
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
$(document).on('pageinit', "#playlistPage", function () {
|
2013-04-10 21:57:12 -07:00
|
|
|
|
|
2013-06-07 09:06:32 -07:00
|
|
|
|
var page = this;
|
2013-05-03 21:02:46 -07:00
|
|
|
|
|
2013-06-07 09:06:32 -07:00
|
|
|
|
$(page).on('click', '.lnkPlay', function () {
|
2013-05-03 21:02:46 -07:00
|
|
|
|
|
2013-06-07 09:06:32 -07:00
|
|
|
|
var index = parseInt(this.getAttribute('data-index'));
|
2013-04-10 21:57:12 -07:00
|
|
|
|
|
2013-06-07 09:06:32 -07:00
|
|
|
|
MediaPlayer.currentPlaylistIndex(index);
|
2013-06-07 10:23:23 -07:00
|
|
|
|
reloadPlaylist(page);
|
2013-04-10 21:57:12 -07:00
|
|
|
|
|
2013-06-07 09:06:32 -07:00
|
|
|
|
}).on('click', '.lnkRemove', function () {
|
2013-04-10 21:57:12 -07:00
|
|
|
|
|
2013-06-07 09:06:32 -07:00
|
|
|
|
var index = parseInt(this.getAttribute('data-index'));
|
2013-04-10 21:57:12 -07:00
|
|
|
|
|
2013-06-07 09:06:32 -07:00
|
|
|
|
MediaPlayer.removeFromPlaylist(index);
|
|
|
|
|
reloadPlaylist(page);
|
|
|
|
|
});
|
2013-04-10 21:57:12 -07:00
|
|
|
|
|
2013-06-07 09:06:32 -07:00
|
|
|
|
}).on('pagebeforeshow', "#playlistPage", function () {
|
2013-04-10 21:57:12 -07:00
|
|
|
|
|
2013-06-07 09:06:32 -07:00
|
|
|
|
var page = this;
|
2013-04-10 21:57:12 -07:00
|
|
|
|
|
2013-06-07 09:06:32 -07:00
|
|
|
|
reloadPlaylist(page);
|
|
|
|
|
});
|
2013-04-10 21:57:12 -07:00
|
|
|
|
|
|
|
|
|
|
|
|
|
|
})(jQuery, document);
|