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

64 lines
1.8 KiB
JavaScript
Raw Normal View History

2015-06-29 11:45:42 -07:00
(function ($, document) {
function reload(page) {
Dashboard.showLoadingMsg();
2015-07-01 08:47:41 -07:00
loadNextUp(page, 'home-nextup');
2015-06-29 11:45:42 -07:00
}
2015-07-26 22:03:34 -07:00
function loadNextUp(page) {
2015-06-29 11:45:42 -07:00
var limit = AppInfo.hasLowImageBandwidth ?
16 :
24;
var query = {
Limit: limit,
Fields: "PrimaryImageAspectRatio,SeriesInfo,DateCreated,SyncInfo",
UserId: Dashboard.getCurrentUserId(),
ImageTypeLimit: 1,
EnableImageTypes: "Primary,Backdrop,Banner,Thumb"
};
ApiClient.getNextUpEpisodes(query).done(function (result) {
if (result.Items.length) {
2015-07-01 08:47:41 -07:00
page.querySelector('.noNextUpItems').classList.add('hide');
2015-06-29 11:45:42 -07:00
} else {
2015-07-01 08:47:41 -07:00
page.querySelector('.noNextUpItems').classList.remove('hide');
2015-06-29 11:45:42 -07:00
}
2015-09-24 22:15:29 -07:00
var html = '';
2015-06-29 11:45:42 -07:00
2015-09-24 22:15:29 -07:00
html += LibraryBrowser.getPosterViewHtml({
items: result.Items,
shape: "backdrop",
showTitle: true,
showParentTitle: true,
overlayText: false,
lazy: true,
preferThumb: true,
showDetailsMenu: true,
centerText: true,
overlayPlayButton: AppInfo.enableAppLayouts,
context: 'home-nextup'
});
2015-06-29 11:45:42 -07:00
var elem = page.querySelector('#nextUpItems');
elem.innerHTML = html;
ImageLoader.lazyChildren(elem);
Dashboard.hideLoadingMsg();
2015-06-29 22:45:20 -07:00
LibraryBrowser.setLastRefreshed(page);
2015-06-29 11:45:42 -07:00
});
}
2015-08-18 08:35:51 -07:00
window.HomePage.renderNextUp = function (page, tabContent) {
if (LibraryBrowser.needsRefresh(tabContent)) {
reload(tabContent);
}
};
2015-06-29 11:45:42 -07:00
})(jQuery, document);