diff --git a/src/scripts/playlistedit.js b/src/scripts/playlistedit.js index ef0615e2ba..32a3a960a4 100644 --- a/src/scripts/playlistedit.js +++ b/src/scripts/playlistedit.js @@ -1,39 +1,50 @@ -define(["listView"], function(listView) { +define(["listView"], function (listView) { "use strict"; function getFetchPlaylistItemsFn(itemId) { - return function() { + return function () { var query = { Fields: "PrimaryImageAspectRatio,UserData", EnableImageTypes: "Primary,Backdrop,Banner,Thumb", UserId: ApiClient.getCurrentUserId() }; - return ApiClient.getJSON(ApiClient.getUrl("Playlists/" + itemId + "/Items", query)) - } + return ApiClient.getJSON(ApiClient.getUrl("Playlists/" + itemId + "/Items", query)); + }; } function getItemsHtmlFn(itemId) { - return function(items) { + return function (items) { return listView.getListViewHtml({ items: items, - showIndex: !1, - showRemoveFromPlaylist: !0, - playFromHere: !0, + showIndex: false, + showRemoveFromPlaylist: true, + playFromHere: true, action: "playallfromhere", - smallIcon: !0, - dragHandle: !0, + smallIcon: true, + dragHandle: true, playlistId: itemId - }) - } + }); + }; } function init(page, item) { var elem = page.querySelector("#childrenContent .itemsContainer"); - elem.classList.add("vertical-list"), elem.classList.remove("vertical-wrap"), elem.enableDragReordering(!0), elem.fetchData = getFetchPlaylistItemsFn(item.Id), elem.getItemsHtml = getItemsHtmlFn(item.Id) + elem.classList.add("vertical-list"); + elem.classList.remove("vertical-wrap"); + elem.enableDragReordering(true); + elem.fetchData = getFetchPlaylistItemsFn(item.Id); + elem.getItemsHtml = getItemsHtmlFn(item.Id); } + window.PlaylistViewer = { - render: function(page, item) { - page.playlistInit || (page.playlistInit = !0, init(page, item)), page.querySelector("#childrenContent").classList.add("verticalSection-extrabottompadding"), page.querySelector("#childrenContent .itemsContainer").refreshItems() + render: function (page, item) { + if (!page.playlistInit) { + page.playlistInit = true; + init(page, item); + } + + page.querySelector("#childrenContent").classList.add("verticalSection-extrabottompadding"); + page.querySelector("#childrenContent .itemsContainer").refreshItems(); } - } -}); \ No newline at end of file + }; +});