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

65 lines
1.6 KiB
JavaScript
Raw Normal View History

2015-06-29 11:45:42 -07:00
(function ($, document) {
$(document).on('pagebeforeshowready', "#homeUpcomingPage", function () {
Dashboard.showLoadingMsg();
var page = this;
var limit = AppInfo.hasLowImageBandwidth ?
24 :
40;
var query = {
Limit: limit,
Fields: "AirTime,UserData,SeriesStudio,SyncInfo",
UserId: Dashboard.getCurrentUserId(),
ImageTypeLimit: 1,
EnableImageTypes: "Primary,Backdrop,Banner,Thumb"
};
query.ParentId = LibraryMenu.getTopParentId();
var context = '';
if (query.ParentId) {
context = 'tv';
}
ApiClient.getJSON(ApiClient.getUrl("Shows/Upcoming", query)).done(function (result) {
var items = result.Items;
if (items.length) {
page.querySelector('.noItemsMessage').style.display = 'none';
} else {
page.querySelector('.noItemsMessage').style.display = 'block';
}
var elem = page.querySelector('#upcomingItems');
elem.innerHTML = LibraryBrowser.getPosterViewHtml({
items: items,
showLocationTypeIndicator: false,
shape: "backdrop",
showTitle: true,
showPremiereDate: true,
showPremiereDateIndex: true,
preferThumb: true,
context: context || 'home-upcoming',
lazy: true,
showDetailsMenu: true
});
ImageLoader.lazyChildren(elem);
Dashboard.hideLoadingMsg();
});
});
})(jQuery, document);