(function ($, document) { function reloadPlaylist(page) { var html = ''; html += ''; html += ''; html += ''; html += ''; html += ''; html += ''; html += ''; html += ''; $.each(MediaPlayer.playlist, function (i, item) { var name = LibraryBrowser.getPosterViewDisplayName(item); var parentName = item.SeriesName || item.Album || item.ProductionYear || ''; html += ''; html += ''; html += ''; html += ''; html += ''; html += ''; html += ''; html += ''; }); html += '
NameAlbumTimeRating
' + name + '' + parentName + '' + ticks_to_human(item.RunTimeTicks) + '' + LibraryBrowser.getUserDataIconsHtml(item) + '
'; $("#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')); MediaPlayer.currentPlaylistIndex(index); reloadPlaylist(page); }).on('click', '.lnkRemove', function () { var index = parseInt(this.getAttribute('data-index')); MediaPlayer.removeFromPlaylist(index); reloadPlaylist(page); }); }).on('pagebeforeshow', "#playlistPage", function () { var page = this; reloadPlaylist(page); }); })(jQuery, document);