playlistedit.js

This commit is contained in:
grafixeyehero 2019-10-08 01:02:37 +03:00
parent 44ba92261d
commit f5e62cbd65

View File

@ -1,39 +1,50 @@
define(["listView"], function(listView) { define(["listView"], function (listView) {
"use strict"; "use strict";
function getFetchPlaylistItemsFn(itemId) { function getFetchPlaylistItemsFn(itemId) {
return function() { return function () {
var query = { var query = {
Fields: "PrimaryImageAspectRatio,UserData", Fields: "PrimaryImageAspectRatio,UserData",
EnableImageTypes: "Primary,Backdrop,Banner,Thumb", EnableImageTypes: "Primary,Backdrop,Banner,Thumb",
UserId: ApiClient.getCurrentUserId() UserId: ApiClient.getCurrentUserId()
}; };
return ApiClient.getJSON(ApiClient.getUrl("Playlists/" + itemId + "/Items", query)) return ApiClient.getJSON(ApiClient.getUrl("Playlists/" + itemId + "/Items", query));
} };
} }
function getItemsHtmlFn(itemId) { function getItemsHtmlFn(itemId) {
return function(items) { return function (items) {
return listView.getListViewHtml({ return listView.getListViewHtml({
items: items, items: items,
showIndex: !1, showIndex: false,
showRemoveFromPlaylist: !0, showRemoveFromPlaylist: true,
playFromHere: !0, playFromHere: true,
action: "playallfromhere", action: "playallfromhere",
smallIcon: !0, smallIcon: true,
dragHandle: !0, dragHandle: true,
playlistId: itemId playlistId: itemId
}) });
} };
} }
function init(page, item) { function init(page, item) {
var elem = page.querySelector("#childrenContent .itemsContainer"); 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 = { window.PlaylistViewer = {
render: function(page, item) { render: function (page, item) {
page.playlistInit || (page.playlistInit = !0, init(page, item)), page.querySelector("#childrenContent").classList.add("verticalSection-extrabottompadding"), page.querySelector("#childrenContent .itemsContainer").refreshItems() if (!page.playlistInit) {
page.playlistInit = true;
init(page, item);
} }
page.querySelector("#childrenContent").classList.add("verticalSection-extrabottompadding");
page.querySelector("#childrenContent .itemsContainer").refreshItems();
} }
};
}); });