2013-04-01 18:28:01 -07:00
|
|
|
|
(function ($, document) {
|
|
|
|
|
|
2014-06-15 16:30:04 -07:00
|
|
|
|
function reload(page) {
|
|
|
|
|
|
|
|
|
|
var query = {
|
|
|
|
|
|
|
|
|
|
Limit: 24,
|
2014-12-10 23:20:28 -07:00
|
|
|
|
Fields: "PrimaryImageAspectRatio,SeriesInfo,DateCreated,SyncInfo",
|
2014-06-15 16:30:04 -07:00
|
|
|
|
UserId: Dashboard.getCurrentUserId(),
|
2014-11-30 12:01:33 -07:00
|
|
|
|
ExcludeLocationTypes: "Virtual",
|
|
|
|
|
ImageTypeLimit: 1,
|
2014-12-01 05:43:34 -07:00
|
|
|
|
EnableImageTypes: "Primary,Backdrop,Banner,Thumb"
|
2014-06-15 16:30:04 -07:00
|
|
|
|
};
|
|
|
|
|
|
|
|
|
|
query.ParentId = LibraryMenu.getTopParentId();
|
2014-07-10 21:27:46 -07:00
|
|
|
|
var context = '';
|
|
|
|
|
|
2014-06-15 16:30:04 -07:00
|
|
|
|
if (query.ParentId) {
|
|
|
|
|
|
|
|
|
|
$('.scopedLibraryViewNav', page).show();
|
|
|
|
|
$('.globalNav', page).hide();
|
|
|
|
|
$('.scopedContent', page).show();
|
2014-07-10 21:27:46 -07:00
|
|
|
|
context = 'tv';
|
2014-12-18 21:20:07 -07:00
|
|
|
|
$('.nextUpHeader', page).removeClass('firstListHeader');
|
2014-06-15 16:30:04 -07:00
|
|
|
|
|
|
|
|
|
loadResume(page);
|
|
|
|
|
|
|
|
|
|
} else {
|
|
|
|
|
$('.scopedLibraryViewNav', page).hide();
|
|
|
|
|
$('.globalNav', page).show();
|
|
|
|
|
$('.scopedContent', page).hide();
|
2014-12-18 21:20:07 -07:00
|
|
|
|
$('.nextUpHeader', page).addClass('firstListHeader');
|
2014-06-15 16:30:04 -07:00
|
|
|
|
}
|
|
|
|
|
|
2014-07-10 21:27:46 -07:00
|
|
|
|
loadNextUp(page, context || 'home-nextup');
|
2014-06-15 16:30:04 -07:00
|
|
|
|
}
|
|
|
|
|
|
2014-07-10 21:27:46 -07:00
|
|
|
|
function loadNextUp(page, context) {
|
2013-04-30 20:28:26 -07:00
|
|
|
|
|
2014-06-14 16:13:09 -07:00
|
|
|
|
var query = {
|
2014-02-22 22:52:30 -07:00
|
|
|
|
|
|
|
|
|
Limit: 24,
|
2014-12-10 23:20:28 -07:00
|
|
|
|
Fields: "PrimaryImageAspectRatio,SeriesInfo,DateCreated,SyncInfo",
|
2014-02-22 22:52:30 -07:00
|
|
|
|
UserId: Dashboard.getCurrentUserId(),
|
2014-11-30 12:01:33 -07:00
|
|
|
|
ExcludeLocationTypes: "Virtual",
|
|
|
|
|
ImageTypeLimit: 1,
|
2014-12-01 05:43:34 -07:00
|
|
|
|
EnableImageTypes: "Primary,Backdrop,Banner,Thumb"
|
2013-04-30 20:28:26 -07:00
|
|
|
|
};
|
|
|
|
|
|
2014-06-14 16:13:09 -07:00
|
|
|
|
query.ParentId = LibraryMenu.getTopParentId();
|
2014-06-15 16:30:04 -07:00
|
|
|
|
|
2014-06-14 16:13:09 -07:00
|
|
|
|
ApiClient.getNextUpEpisodes(query).done(function (result) {
|
2013-04-30 20:28:26 -07:00
|
|
|
|
|
|
|
|
|
if (result.Items.length) {
|
2014-03-31 14:04:22 -07:00
|
|
|
|
$('.noNextUpItems', page).hide();
|
2013-04-30 20:28:26 -07:00
|
|
|
|
} else {
|
2014-03-31 14:04:22 -07:00
|
|
|
|
$('.noNextUpItems', page).show();
|
2013-04-30 20:28:26 -07:00
|
|
|
|
}
|
|
|
|
|
|
2014-09-29 21:47:30 -07:00
|
|
|
|
var html = LibraryBrowser.getPosterViewHtml({
|
2014-03-31 14:04:22 -07:00
|
|
|
|
items: result.Items,
|
2014-08-01 19:34:45 -07:00
|
|
|
|
shape: "homePageBackdrop",
|
2014-03-31 14:04:22 -07:00
|
|
|
|
showTitle: true,
|
|
|
|
|
showParentTitle: true,
|
2014-08-01 19:34:45 -07:00
|
|
|
|
overlayText: true,
|
2014-07-10 21:27:46 -07:00
|
|
|
|
context: context,
|
2014-05-29 12:34:20 -07:00
|
|
|
|
lazy: true
|
2014-02-22 22:52:30 -07:00
|
|
|
|
|
2014-09-29 21:47:30 -07:00
|
|
|
|
});
|
|
|
|
|
|
|
|
|
|
$('#nextUpItems', page).html(html).trigger('create').createCardMenus();
|
2013-04-30 20:28:26 -07:00
|
|
|
|
|
|
|
|
|
});
|
2014-02-22 22:52:30 -07:00
|
|
|
|
}
|
|
|
|
|
|
2014-06-15 16:30:04 -07:00
|
|
|
|
function loadResume(page) {
|
|
|
|
|
|
|
|
|
|
var parentId = LibraryMenu.getTopParentId();
|
|
|
|
|
|
|
|
|
|
var options = {
|
|
|
|
|
|
|
|
|
|
SortBy: "DatePlayed",
|
|
|
|
|
SortOrder: "Descending",
|
|
|
|
|
IncludeItemTypes: "Episode",
|
|
|
|
|
Filters: "IsResumable",
|
2014-12-12 20:56:30 -07:00
|
|
|
|
Limit: 6,
|
2014-06-15 16:30:04 -07:00
|
|
|
|
Recursive: true,
|
2014-12-10 23:20:28 -07:00
|
|
|
|
Fields: "PrimaryImageAspectRatio,SeriesInfo,UserData,SyncInfo",
|
2014-06-15 16:30:04 -07:00
|
|
|
|
ExcludeLocationTypes: "Virtual",
|
2014-11-30 12:01:33 -07:00
|
|
|
|
ParentId: parentId,
|
|
|
|
|
ImageTypeLimit: 1,
|
2014-12-01 05:43:34 -07:00
|
|
|
|
EnableImageTypes: "Primary,Backdrop,Banner,Thumb"
|
2014-06-15 16:30:04 -07:00
|
|
|
|
};
|
|
|
|
|
|
|
|
|
|
ApiClient.getItems(Dashboard.getCurrentUserId(), options).done(function (result) {
|
|
|
|
|
|
|
|
|
|
if (result.Items.length) {
|
|
|
|
|
$('#resumableSection', page).show();
|
|
|
|
|
} else {
|
|
|
|
|
$('#resumableSection', page).hide();
|
2014-06-23 09:05:19 -07:00
|
|
|
|
$('.nextUpHeader', page).addClass('firstListHeader');
|
2014-06-15 16:30:04 -07:00
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
$('#resumableItems', page).html(LibraryBrowser.getPosterViewHtml({
|
|
|
|
|
items: result.Items,
|
2014-08-01 19:34:45 -07:00
|
|
|
|
shape: "homePageBackdrop",
|
2014-06-15 16:30:04 -07:00
|
|
|
|
showTitle: true,
|
|
|
|
|
showParentTitle: true,
|
2014-08-01 19:34:45 -07:00
|
|
|
|
overlayText: true,
|
2014-07-10 21:27:46 -07:00
|
|
|
|
lazy: true,
|
|
|
|
|
context: 'tv'
|
2014-06-15 16:30:04 -07:00
|
|
|
|
|
2014-08-01 19:34:45 -07:00
|
|
|
|
})).trigger('create').createCardMenus();
|
2014-06-15 16:30:04 -07:00
|
|
|
|
|
|
|
|
|
});
|
|
|
|
|
}
|
|
|
|
|
|
2014-02-22 22:52:30 -07:00
|
|
|
|
$(document).on('pagebeforeshow', "#tvRecommendedPage", function () {
|
|
|
|
|
|
|
|
|
|
var page = this;
|
2013-04-30 20:28:26 -07:00
|
|
|
|
|
2014-06-15 16:30:04 -07:00
|
|
|
|
reload(page);
|
2013-04-30 20:28:26 -07:00
|
|
|
|
});
|
2013-04-01 18:28:01 -07:00
|
|
|
|
|
|
|
|
|
|
|
|
|
|
})(jQuery, document);
|