mirror of
https://github.com/jellyfin/jellyfin-web
synced 2025-03-30 19:56:21 +00:00
First separation commit.
Added LICENSE, README.md, CONTRIBUTORS.md
This commit is contained in:
parent
09513af31b
commit
4678528d00
657 changed files with 422 additions and 0 deletions
54
src/scripts/tvlatest.js
Normal file
54
src/scripts/tvlatest.js
Normal file
|
@ -0,0 +1,54 @@
|
|||
define(["loading", "components/categorysyncbuttons", "components/groupedcards", "cardBuilder", "apphost", "imageLoader"], function(loading, categorysyncbuttons, groupedcards, cardBuilder, appHost, imageLoader) {
|
||||
"use strict";
|
||||
|
||||
function getLatestPromise(context, params) {
|
||||
loading.show();
|
||||
var userId = ApiClient.getCurrentUserId(),
|
||||
parentId = params.topParentId,
|
||||
options = {
|
||||
IncludeItemTypes: "Episode",
|
||||
Limit: 30,
|
||||
Fields: "PrimaryImageAspectRatio,BasicSyncInfo",
|
||||
ParentId: parentId,
|
||||
ImageTypeLimit: 1,
|
||||
EnableImageTypes: "Primary,Backdrop,Thumb"
|
||||
};
|
||||
return ApiClient.getJSON(ApiClient.getUrl("Users/" + userId + "/Items/Latest", options))
|
||||
}
|
||||
|
||||
function loadLatest(context, params, promise) {
|
||||
promise.then(function(items) {
|
||||
var html = "";
|
||||
appHost.supports("imageanalysis");
|
||||
html += cardBuilder.getCardsHtml({
|
||||
items: items,
|
||||
shape: "backdrop",
|
||||
preferThumb: !0,
|
||||
showTitle: !0,
|
||||
showSeriesYear: !0,
|
||||
showParentTitle: !0,
|
||||
overlayText: !1,
|
||||
cardLayout: !1,
|
||||
showUnplayedIndicator: !1,
|
||||
showChildCountIndicator: !0,
|
||||
centerText: !0,
|
||||
lazy: !0,
|
||||
overlayPlayButton: !0,
|
||||
vibrant: !1,
|
||||
lines: 2
|
||||
});
|
||||
var elem = context.querySelector("#latestEpisodes");
|
||||
elem.innerHTML = html, imageLoader.lazyChildren(elem), loading.hide()
|
||||
})
|
||||
}
|
||||
return function(view, params, tabContent) {
|
||||
var self = this;
|
||||
categorysyncbuttons.init(tabContent);
|
||||
var latestPromise;
|
||||
self.preRender = function() {
|
||||
latestPromise = getLatestPromise(view, params)
|
||||
}, self.renderTab = function() {
|
||||
loadLatest(tabContent, params, latestPromise)
|
||||
}, tabContent.querySelector("#latestEpisodes").addEventListener("click", groupedcards.onItemsContainerClick)
|
||||
}
|
||||
});
|
Loading…
Add table
Add a link
Reference in a new issue