jellyfin-web/dashboard-ui/scripts/tvlatest.js

81 lines
2.3 KiB
JavaScript
Raw Normal View History

2016-03-18 12:43:17 -07:00
define([], function () {
function getView() {
return 'Thumb';
}
function loadLatest(context, params) {
Dashboard.showLoadingMsg();
var userId = Dashboard.getCurrentUserId();
var parentId = params.topParentId;
var options = {
IncludeItemTypes: "Episode",
2016-05-16 10:11:49 -07:00
Limit: 30,
2016-03-18 12:43:17 -07:00
Fields: "PrimaryImageAspectRatio,SyncInfo",
ParentId: parentId,
ImageTypeLimit: 1,
EnableImageTypes: "Primary,Backdrop,Banner,Thumb"
};
ApiClient.getJSON(ApiClient.getUrl('Users/' + userId + '/Items/Latest', options)).then(function (items) {
var view = getView();
var html = '';
if (view == 'ThumbCard') {
html += LibraryBrowser.getPosterViewHtml({
items: items,
shape: "backdrop",
preferThumb: true,
inheritThumb: false,
showUnplayedIndicator: false,
showChildCountIndicator: true,
overlayText: false,
showParentTitle: true,
lazy: true,
showTitle: true,
cardLayout: true
});
} else if (view == 'Thumb') {
html += LibraryBrowser.getPosterViewHtml({
items: items,
shape: "backdrop",
preferThumb: true,
inheritThumb: false,
showParentTitle: false,
showUnplayedIndicator: false,
showChildCountIndicator: true,
overlayText: false,
centerText: true,
lazy: true,
showTitle: false,
overlayPlayButton: AppInfo.enableAppLayouts
});
}
var elem = context.querySelector('#latestEpisodes');
elem.innerHTML = html;
ImageLoader.lazyChildren(elem);
Dashboard.hideLoadingMsg();
});
2015-05-12 21:55:19 -07:00
}
2016-03-18 12:43:17 -07:00
return function (view, params, tabContent) {
var self = this;
self.renderTab = function() {
2016-03-18 20:14:53 -07:00
loadLatest(tabContent, params);
2014-02-22 22:52:30 -07:00
};
2015-09-21 10:46:02 -07:00
};
2016-03-18 12:43:17 -07:00
});