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

73 lines
1.8 KiB
JavaScript
Raw Normal View History

2013-10-24 10:49:24 -07:00
(function ($, document) {
2015-06-29 19:52:23 -07:00
function loadUpcoming(page) {
2015-06-15 21:52:01 -07:00
2015-06-16 12:17:12 -07:00
Dashboard.showLoadingMsg();
2015-05-07 07:04:10 -07:00
var limit = AppInfo.hasLowImageBandwidth ?
2015-06-29 19:52:23 -07:00
24 :
40;
2015-05-07 07:04:10 -07:00
var query = {
2013-10-24 10:49:24 -07:00
2015-05-07 07:04:10 -07:00
Limit: limit,
2014-12-18 21:20:07 -07:00
Fields: "AirTime,UserData,SeriesStudio,SyncInfo",
2014-11-30 12:01:33 -07:00
UserId: Dashboard.getCurrentUserId(),
ImageTypeLimit: 1,
2014-12-01 05:43:34 -07:00
EnableImageTypes: "Primary,Backdrop,Banner,Thumb"
2013-10-24 10:49:24 -07:00
};
2014-06-14 16:13:09 -07:00
query.ParentId = LibraryMenu.getTopParentId();
2014-07-10 21:27:46 -07:00
var context = '';
if (query.ParentId) {
context = 'tv';
}
2014-07-01 22:16:59 -07:00
ApiClient.getJSON(ApiClient.getUrl("Shows/Upcoming", query)).done(function (result) {
2014-03-05 22:17:13 -07:00
var items = result.Items;
2014-03-31 14:04:22 -07:00
if (items.length) {
2015-06-28 07:45:21 -07:00
page.querySelector('.noItemsMessage').style.display = 'none';
2014-03-31 14:04:22 -07:00
} else {
2015-06-28 07:45:21 -07:00
page.querySelector('.noItemsMessage').style.display = 'block';
2013-10-24 10:49:24 -07:00
}
2015-06-28 07:45:21 -07:00
var elem = page.querySelector('#upcomingItems');
elem.innerHTML = LibraryBrowser.getPosterViewHtml({
2014-03-05 22:17:13 -07:00
items: items,
2013-10-24 10:49:24 -07:00
showLocationTypeIndicator: false,
2015-01-22 23:15:15 -07:00
shape: "backdrop",
2013-10-24 10:49:24 -07:00
showTitle: true,
showPremiereDate: true,
showPremiereDateIndex: true,
2014-05-29 12:34:20 -07:00
preferThumb: true,
2014-07-10 21:27:46 -07:00
context: context || 'home-upcoming',
lazy: true,
2015-05-14 19:16:57 -07:00
showDetailsMenu: true
2014-03-05 22:17:13 -07:00
2015-06-28 07:45:21 -07:00
});
ImageLoader.lazyChildren(elem);
2015-06-16 12:17:12 -07:00
Dashboard.hideLoadingMsg();
2015-06-29 22:45:20 -07:00
LibraryBrowser.setLastRefreshed(page);
2013-10-24 10:49:24 -07:00
});
2015-06-29 19:52:23 -07:00
}
$(document).on('pagebeforeshowready', "#tvUpcomingPage", function () {
var page = this;
2015-06-29 22:45:20 -07:00
if (LibraryBrowser.needsRefresh(page)) {
2015-06-29 19:52:23 -07:00
loadUpcoming(page);
}
2013-10-24 10:49:24 -07:00
});
})(jQuery, document);