(function ($, document) { function reloadPlaylist(page) { var html = ''; html += ''; html += ''; html += ''; html += ''; html += ''; html += ''; html += ''; html += ''; html += ''; html += ''; $.each(MediaController.playlist(), function (i, item) { var name = LibraryBrowser.getPosterViewDisplayName(item); var parentName = item.SeriesName || item.Album; html += ''; html += ''; html += ''; html += ''; html += ''; html += ''; html += ''; html += ''; html += ''; }); html += ''; html += '
' + Globalize.translate('HeaderName') + '' + Globalize.translate('HeaderAlbum') + '' + Globalize.translate('HeaderArtist') + '' + Globalize.translate('HeaderAlbumArtist') + '' + Globalize.translate('HeaderTime') + '
'; html += '' + name + ''; html += ''; if (parentName) { var parentId = item.AlbumId || item.SeriesId || item.ParentId; html += '' + parentName + ''; } html += ''; html += LibraryBrowser.getArtistLinksHtml(item.Artists || []); html += ''; if (item.AlbumArtist) { html += LibraryBrowser.getArtistLinksHtml([item.AlbumArtist]); } html += '' + Dashboard.getDisplayTime(item.RunTimeTicks) + '
'; $("#playlist", page).html(html).trigger('create'); } $(document).on('pageinit', "#playlistPage", function () { var page = this; $(page).on('click', '.lnkPlay', function () { var index = parseInt(this.getAttribute('data-index')); MediaController.currentPlaylistIndex(index); reloadPlaylist(page); }).on('click', '.lnkRemove', function () { var index = parseInt(this.getAttribute('data-index')); MediaController.removeFromPlaylist(index); reloadPlaylist(page); }); }).on('pagebeforeshow', "#playlistPage", function () { var page = this; reloadPlaylist(page); }); })(jQuery, document);