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

87 lines
2.4 KiB
JavaScript
Raw Normal View History

2014-02-22 22:52:30 -07:00
(function ($, document) {
2015-05-12 21:55:19 -07:00
function getView() {
return 'Thumb';
}
2015-06-29 19:52:23 -07:00
function loadLatest(page) {
2014-02-22 22:52:30 -07:00
2015-06-29 22:45:20 -07:00
Dashboard.showLoadingMsg();
var userId = Dashboard.getCurrentUserId();
2014-02-22 22:52:30 -07:00
2014-05-01 19:54:33 -07:00
var parentId = LibraryMenu.getTopParentId();
2015-05-12 21:55:19 -07:00
var limit = 30;
if (AppInfo.hasLowImageBandwidth) {
limit = 16;
}
2015-05-07 07:04:10 -07:00
2014-02-22 22:52:30 -07:00
var options = {
IncludeItemTypes: "Episode",
2015-05-07 07:04:10 -07:00
Limit: limit,
2014-12-10 23:20:28 -07:00
Fields: "PrimaryImageAspectRatio,SyncInfo",
ParentId: parentId,
2014-11-30 12:01:33 -07:00
ImageTypeLimit: 1,
2014-12-01 05:43:34 -07:00
EnableImageTypes: "Primary,Backdrop,Banner,Thumb"
2014-02-22 22:52:30 -07:00
};
ApiClient.getJSON(ApiClient.getUrl('Users/' + userId + '/Items/Latest', options)).done(function (items) {
2014-02-22 22:52:30 -07:00
2015-05-12 21:55:19 -07:00
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,
2015-07-17 15:32:00 -07:00
showTitle: false,
2015-07-19 20:43:13 -07:00
overlayPlayButton: AppInfo.enableAppLayouts
2015-05-12 21:55:19 -07:00
});
}
2015-06-28 08:43:49 -07:00
var elem = page.querySelector('#latestEpisodes');
elem.innerHTML = html;
ImageLoader.lazyChildren(elem);
2015-06-29 22:45:20 -07:00
Dashboard.hideLoadingMsg();
LibraryBrowser.setLastRefreshed(page);
2014-02-22 22:52:30 -07:00
});
2015-06-29 19:52:23 -07:00
}
2015-09-21 10:46:02 -07:00
window.TvPage.renderLatestTab = function (page, tabContent) {
2015-06-29 19:52:23 -07:00
2015-09-21 10:46:02 -07:00
if (LibraryBrowser.needsRefresh(tabContent)) {
loadLatest(tabContent);
2015-06-29 19:52:23 -07:00
}
2015-09-21 10:46:02 -07:00
};
2014-02-22 22:52:30 -07:00
})(jQuery, document);