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

61 lines
1.7 KiB
JavaScript
Raw Normal View History

2016-03-30 23:33:37 -07:00
define(['jQuery'], function ($) {
function reload(page) {
Dashboard.showLoadingMsg();
loadNextUp(page, 'home-nextup');
}
function loadNextUp(page) {
var query = {
2016-05-16 10:11:49 -07:00
Limit: 24,
2016-03-30 23:33:37 -07:00
Fields: "PrimaryImageAspectRatio,SeriesInfo,DateCreated,SyncInfo",
UserId: Dashboard.getCurrentUserId(),
ImageTypeLimit: 1,
EnableImageTypes: "Primary,Backdrop,Banner,Thumb"
};
ApiClient.getNextUpEpisodes(query).then(function (result) {
if (result.Items.length) {
page.querySelector('.noNextUpItems').classList.add('hide');
} else {
page.querySelector('.noNextUpItems').classList.remove('hide');
}
var html = '';
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'
});
var elem = page.querySelector('#nextUpItems');
elem.innerHTML = html;
ImageLoader.lazyChildren(elem);
Dashboard.hideLoadingMsg();
});
2015-06-29 11:45:42 -07:00
}
2016-03-30 23:33:37 -07:00
return function (view, params, tabContent) {
var self = this;
self.renderTab = function () {
reload(tabContent);
};
};
});