2015-06-29 11:45:42 -07:00
|
|
|
|
(function ($, document) {
|
|
|
|
|
|
|
|
|
|
function getView() {
|
|
|
|
|
|
|
|
|
|
return 'Thumb';
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
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(),
|
|
|
|
|
ExcludeLocationTypes: "Virtual",
|
|
|
|
|
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
|
|
|
|
}
|
|
|
|
|
var view = getView();
|
|
|
|
|
var html = '';
|
|
|
|
|
|
|
|
|
|
if (view == 'ThumbCard') {
|
|
|
|
|
|
|
|
|
|
html += LibraryBrowser.getPosterViewHtml({
|
|
|
|
|
items: result.Items,
|
|
|
|
|
shape: "backdrop",
|
|
|
|
|
showTitle: true,
|
|
|
|
|
preferThumb: true,
|
|
|
|
|
showParentTitle: true,
|
|
|
|
|
lazy: true,
|
|
|
|
|
cardLayout: true,
|
2015-07-27 09:21:18 -07:00
|
|
|
|
showDetailsMenu: true,
|
|
|
|
|
context: 'home-nextup'
|
2015-06-29 11:45:42 -07:00
|
|
|
|
});
|
|
|
|
|
|
|
|
|
|
} else if (view == 'Thumb') {
|
|
|
|
|
|
|
|
|
|
html += LibraryBrowser.getPosterViewHtml({
|
|
|
|
|
items: result.Items,
|
|
|
|
|
shape: "backdrop",
|
|
|
|
|
showTitle: true,
|
|
|
|
|
showParentTitle: true,
|
|
|
|
|
overlayText: false,
|
|
|
|
|
lazy: true,
|
|
|
|
|
preferThumb: true,
|
2015-07-17 15:32:00 -07:00
|
|
|
|
showDetailsMenu: true,
|
|
|
|
|
centerText: true,
|
2015-07-27 09:21:18 -07:00
|
|
|
|
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);
|