2016-10-06 11:55:01 -07:00
|
|
|
|
define(['components/categorysyncbuttons', 'cardBuilder', 'apphost', 'emby-itemscontainer'], function (categorysyncbuttons, cardBuilder, appHost) {
|
2016-03-30 23:33:37 -07:00
|
|
|
|
|
2016-06-29 09:31:01 -07:00
|
|
|
|
function getNextUpPromise() {
|
2016-03-30 23:33:37 -07:00
|
|
|
|
|
|
|
|
|
var query = {
|
|
|
|
|
|
2016-05-16 10:11:49 -07:00
|
|
|
|
Limit: 24,
|
2016-08-01 22:55:52 -07:00
|
|
|
|
Fields: "PrimaryImageAspectRatio,SeriesInfo,DateCreated,BasicSyncInfo",
|
2016-03-30 23:33:37 -07:00
|
|
|
|
UserId: Dashboard.getCurrentUserId(),
|
|
|
|
|
ImageTypeLimit: 1,
|
2016-07-04 22:40:18 -07:00
|
|
|
|
EnableImageTypes: "Primary,Backdrop,Thumb"
|
2016-03-30 23:33:37 -07:00
|
|
|
|
};
|
|
|
|
|
|
2016-06-29 09:31:01 -07:00
|
|
|
|
return ApiClient.getNextUpEpisodes(query);
|
|
|
|
|
}
|
|
|
|
|
function loadNextUp(page, promise) {
|
|
|
|
|
|
|
|
|
|
promise.then(function (result) {
|
2016-03-30 23:33:37 -07:00
|
|
|
|
|
|
|
|
|
if (result.Items.length) {
|
|
|
|
|
page.querySelector('.noNextUpItems').classList.add('hide');
|
|
|
|
|
} else {
|
|
|
|
|
page.querySelector('.noNextUpItems').classList.remove('hide');
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
var html = '';
|
|
|
|
|
|
2016-10-06 11:55:01 -07:00
|
|
|
|
var supportsImageAnalysis = appHost.supports('imageanalysis');
|
|
|
|
|
|
2016-07-29 13:06:58 -07:00
|
|
|
|
html += cardBuilder.getCardsHtml({
|
2016-03-30 23:33:37 -07:00
|
|
|
|
items: result.Items,
|
|
|
|
|
shape: "backdrop",
|
|
|
|
|
showTitle: true,
|
|
|
|
|
showParentTitle: true,
|
|
|
|
|
overlayText: false,
|
|
|
|
|
lazy: true,
|
|
|
|
|
preferThumb: true,
|
|
|
|
|
showDetailsMenu: true,
|
|
|
|
|
centerText: true,
|
2016-10-06 11:55:01 -07:00
|
|
|
|
overlayPlayButton: AppInfo.enableAppLayouts && !supportsImageAnalysis,
|
|
|
|
|
context: 'home-nextup',
|
|
|
|
|
cardLayout: supportsImageAnalysis,
|
|
|
|
|
vibrant: supportsImageAnalysis
|
2016-03-30 23:33:37 -07:00
|
|
|
|
});
|
|
|
|
|
|
|
|
|
|
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) {
|
|
|
|
|
|
2016-06-29 09:31:01 -07:00
|
|
|
|
var self = this;
|
|
|
|
|
var nextUpPromise;
|
|
|
|
|
|
2016-07-18 20:57:55 -07:00
|
|
|
|
categorysyncbuttons.init(view);
|
|
|
|
|
|
2016-06-29 09:31:01 -07:00
|
|
|
|
self.preRender = function () {
|
|
|
|
|
nextUpPromise = getNextUpPromise();
|
|
|
|
|
};
|
2016-03-30 23:33:37 -07:00
|
|
|
|
|
|
|
|
|
self.renderTab = function () {
|
|
|
|
|
|
2016-06-29 09:31:01 -07:00
|
|
|
|
Dashboard.showLoadingMsg();
|
|
|
|
|
loadNextUp(view, nextUpPromise);
|
2016-03-30 23:33:37 -07:00
|
|
|
|
};
|
|
|
|
|
};
|
|
|
|
|
|
2016-03-18 21:26:17 -07:00
|
|
|
|
});
|