mirror of
https://github.com/jellyfin/jellyfin-web.git
synced 2024-11-17 10:58:20 -07:00
playlistedit.js
This commit is contained in:
parent
44ba92261d
commit
f5e62cbd65
@ -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();
|
||||
}
|
||||
}
|
||||
});
|
||||
};
|
||||
});
|
||||
|
Loading…
Reference in New Issue
Block a user