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) {
|
2014-01-05 18:59:21 -07:00
|
|
|
|
|
2013-06-07 09:06:32 -07:00
|
|
|
|
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
|
|
|
|
|
2014-01-01 11:26:31 -07:00
|
|
|
|
html += '<thead><tr>';
|
2013-06-07 09:06:32 -07:00
|
|
|
|
html += '<th></th>';
|
|
|
|
|
html += '<th>Name</th>';
|
|
|
|
|
html += '<th>Album</th>';
|
2014-01-05 18:59:21 -07:00
|
|
|
|
html += '<th>Artist</th>';
|
|
|
|
|
html += '<th>Album Artist</th>';
|
2013-06-07 09:06:32 -07:00
|
|
|
|
html += '<th>Time</th>';
|
2014-01-01 11:26:31 -07:00
|
|
|
|
html += '</tr></thead>';
|
|
|
|
|
|
|
|
|
|
html += '<tbody>';
|
2013-04-08 13:46:59 -07:00
|
|
|
|
|
2014-06-04 15:58:12 -07:00
|
|
|
|
$.each(MediaController.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
|
|
|
|
|
2014-01-05 18:59:21 -07:00
|
|
|
|
var parentName = item.SeriesName || item.Album;
|
2013-04-10 21:57:12 -07:00
|
|
|
|
|
2013-06-07 09:06:32 -07:00
|
|
|
|
html += '<tr>';
|
2014-01-02 14:21:06 -07:00
|
|
|
|
html += '<td><button type="button" data-index="' + i + '" class="lnkPlay" data-icon="play" data-iconpos="notext">Play</button></td>';
|
2014-01-05 18:59:21 -07:00
|
|
|
|
html += '<td>';
|
|
|
|
|
html += '<a href="itemdetails.html?id=' + item.Id + '">' + name + '</a>';
|
|
|
|
|
html += '</td>';
|
|
|
|
|
|
|
|
|
|
html += '<td>';
|
|
|
|
|
if (parentName) {
|
|
|
|
|
var parentId = item.AlbumId || item.SeriesId || item.ParentId;
|
|
|
|
|
html += '<a href="itemdetails.html?id=' + parentId + '">' + parentName + '</a>';
|
|
|
|
|
}
|
|
|
|
|
html += '</td>';
|
|
|
|
|
|
|
|
|
|
html += '<td>';
|
|
|
|
|
html += LibraryBrowser.getArtistLinksHtml(item.Artists || []);
|
|
|
|
|
html += '</td>';
|
|
|
|
|
|
|
|
|
|
html += '<td>';
|
|
|
|
|
if (item.AlbumArtist) {
|
|
|
|
|
html += LibraryBrowser.getArtistLinksHtml([item.AlbumArtist]);
|
|
|
|
|
}
|
|
|
|
|
html += '</td>';
|
|
|
|
|
|
2013-06-07 10:29:33 -07:00
|
|
|
|
html += '<td>' + Dashboard.getDisplayTime(item.RunTimeTicks) + '</td>';
|
2014-01-02 14:21:06 -07:00
|
|
|
|
html += '<td><button type="button" data-index="' + i + '" class="lnkRemove" data-icon="delete" data-iconpos="notext">Remove</button></td>';
|
2013-06-07 09:06:32 -07:00
|
|
|
|
html += '</tr>';
|
|
|
|
|
});
|
2013-04-10 21:57:12 -07:00
|
|
|
|
|
2014-01-01 11:26:31 -07:00
|
|
|
|
html += '</tbody>';
|
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');
|
|
|
|
|
}
|
2014-01-05 18:59:21 -07:00
|
|
|
|
|
2013-06-07 09:06:32 -07:00
|
|
|
|
$(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
|
|
|
|
|
2014-04-09 21:12:04 -07:00
|
|
|
|
MediaController.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
|
|
|
|
|
2014-04-09 21:12:04 -07:00
|
|
|
|
MediaController.removeFromPlaylist(index);
|
2013-06-07 09:06:32 -07:00
|
|
|
|
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
|
|
|
|
|
2014-06-04 15:58:12 -07:00
|
|
|
|
reloadPlaylist(page);
|
2013-06-07 09:06:32 -07:00
|
|
|
|
});
|
2013-04-10 21:57:12 -07:00
|
|
|
|
|
|
|
|
|
|
|
|
|
|
})(jQuery, document);
|