2013-04-01 18:28:01 -07:00
|
|
|
|
(function ($, document) {
|
|
|
|
|
|
2014-02-22 22:52:30 -07:00
|
|
|
|
function loadResume(page) {
|
2013-04-30 20:28:26 -07:00
|
|
|
|
|
2014-02-17 14:35:08 -07:00
|
|
|
|
var screenWidth = $(window).width();
|
|
|
|
|
|
2013-04-30 20:28:26 -07:00
|
|
|
|
var options = {
|
|
|
|
|
|
2014-02-22 22:52:30 -07:00
|
|
|
|
SortBy: "DatePlayed",
|
2013-04-30 20:28:26 -07:00
|
|
|
|
SortOrder: "Descending",
|
|
|
|
|
IncludeItemTypes: "Episode",
|
2014-02-22 22:52:30 -07:00
|
|
|
|
Filters: "IsResumable",
|
|
|
|
|
Limit: screenWidth >= 1920 ? 4 : (screenWidth >= 1440 ? 4 : 3),
|
2013-04-30 20:28:26 -07:00
|
|
|
|
Recursive: true,
|
2013-05-03 19:33:44 -07:00
|
|
|
|
Fields: "PrimaryImageAspectRatio,SeriesInfo,UserData",
|
2013-10-16 16:35:11 -07:00
|
|
|
|
ExcludeLocationTypes: "Virtual"
|
2013-04-30 20:28:26 -07:00
|
|
|
|
};
|
|
|
|
|
|
|
|
|
|
ApiClient.getItems(Dashboard.getCurrentUserId(), options).done(function (result) {
|
|
|
|
|
|
2014-02-22 22:52:30 -07:00
|
|
|
|
if (result.Items.length) {
|
|
|
|
|
$('#resumableSection', page).show();
|
|
|
|
|
} else {
|
|
|
|
|
$('#resumableSection', page).hide();
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
$('#resumableItems', page).html(LibraryBrowser.getPosterViewHtml({
|
2013-04-30 20:28:26 -07:00
|
|
|
|
items: result.Items,
|
|
|
|
|
useAverageAspectRatio: true,
|
|
|
|
|
shape: "backdrop",
|
|
|
|
|
showTitle: true,
|
2013-12-22 10:16:24 -07:00
|
|
|
|
showParentTitle: true,
|
|
|
|
|
overlayText: true
|
2014-02-22 22:52:30 -07:00
|
|
|
|
|
2014-01-14 08:50:39 -07:00
|
|
|
|
})).createPosterItemHoverMenu();
|
2013-04-30 20:28:26 -07:00
|
|
|
|
|
|
|
|
|
});
|
2014-02-22 22:52:30 -07:00
|
|
|
|
}
|
2013-04-30 20:28:26 -07:00
|
|
|
|
|
2014-02-22 22:52:30 -07:00
|
|
|
|
function loadNextUp(page) {
|
2013-04-30 20:28:26 -07:00
|
|
|
|
|
2014-02-22 22:52:30 -07:00
|
|
|
|
var options = {
|
|
|
|
|
|
|
|
|
|
Limit: 24,
|
|
|
|
|
Fields: "PrimaryImageAspectRatio,SeriesInfo,DateCreated",
|
|
|
|
|
UserId: Dashboard.getCurrentUserId(),
|
2013-10-24 10:49:24 -07:00
|
|
|
|
ExcludeLocationTypes: "Virtual"
|
2013-04-30 20:28:26 -07:00
|
|
|
|
};
|
|
|
|
|
|
2014-02-22 22:52:30 -07:00
|
|
|
|
ApiClient.getNextUpEpisodes(options).done(function (result) {
|
2013-04-30 20:28:26 -07:00
|
|
|
|
|
|
|
|
|
if (result.Items.length) {
|
|
|
|
|
$('#resumableSection', page).show();
|
|
|
|
|
} else {
|
|
|
|
|
$('#resumableSection', page).hide();
|
|
|
|
|
}
|
|
|
|
|
|
2014-02-22 22:52:30 -07:00
|
|
|
|
if (result.Items.length) {
|
|
|
|
|
|
|
|
|
|
$('#nextUpItems', page).html(LibraryBrowser.getPosterViewHtml({
|
|
|
|
|
items: result.Items,
|
|
|
|
|
useAverageAspectRatio: true,
|
|
|
|
|
shape: "backdrop",
|
|
|
|
|
showTitle: true,
|
|
|
|
|
showParentTitle: true,
|
|
|
|
|
overlayText: true
|
|
|
|
|
|
|
|
|
|
})).createPosterItemHoverMenu();
|
|
|
|
|
|
|
|
|
|
} else {
|
|
|
|
|
|
|
|
|
|
$('#nextUpItems', page).html('<br/><p>None found. Start watching your shows!</p>');
|
|
|
|
|
|
|
|
|
|
}
|
2013-04-30 20:28:26 -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-02-22 22:52:30 -07:00
|
|
|
|
loadResume(page);
|
|
|
|
|
loadNextUp(page);
|
2013-04-30 20:28:26 -07:00
|
|
|
|
});
|
2013-04-01 18:28:01 -07:00
|
|
|
|
|
|
|
|
|
|
|
|
|
|
})(jQuery, document);
|