From f5e62cbd65e59d504eb8f18cabf23d6db756b0f6 Mon Sep 17 00:00:00 2001 From: grafixeyehero Date: Tue, 8 Oct 2019 01:02:37 +0300 Subject: [PATCH] playlistedit.js --- src/scripts/playlistedit.js | 45 +++++++++++++++++++++++-------------- 1 file changed, 28 insertions(+), 17 deletions(-) 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 + }; +});