1
0
Fork 0
mirror of https://github.com/jellyfin/jellyfin-web synced 2025-03-30 19:56:21 +00:00
jellyfin-web/dashboard-ui/scripts/tvrecommended.js

86 lines
2.3 KiB
JavaScript
Raw Normal View History

2013-04-01 18:28:01 -07:00
(function ($, document) {
2014-02-23 00:52:30 -05:00
function loadResume(page) {
2013-04-30 23:28:26 -04:00
var screenWidth = $(window).width();
2014-05-01 22:54:33 -04:00
var parentId = LibraryMenu.getTopParentId();
2013-04-30 23:28:26 -04:00
var options = {
2014-02-23 00:52:30 -05:00
SortBy: "DatePlayed",
2013-04-30 23:28:26 -04:00
SortOrder: "Descending",
IncludeItemTypes: "Episode",
2014-02-23 00:52:30 -05:00
Filters: "IsResumable",
2014-05-05 01:05:43 -04:00
Limit: screenWidth >= 1920 ? 5 : (screenWidth >= 1440 ? 4 : 3),
2013-04-30 23:28:26 -04:00
Recursive: true,
2013-05-03 22:33:44 -04:00
Fields: "PrimaryImageAspectRatio,SeriesInfo,UserData",
2014-05-01 22:54:33 -04:00
ExcludeLocationTypes: "Virtual",
ParentId: parentId
2013-04-30 23:28:26 -04:00
};
ApiClient.getItems(Dashboard.getCurrentUserId(), options).done(function (result) {
2014-02-23 00:52:30 -05:00
if (result.Items.length) {
$('#resumableSection', page).show();
} else {
$('#resumableSection', page).hide();
}
$('#resumableItems', page).html(LibraryBrowser.getPosterViewHtml({
2013-04-30 23:28:26 -04:00
items: result.Items,
shape: "backdrop",
showTitle: true,
2013-12-22 12:16:24 -05:00
showParentTitle: true,
2014-05-09 15:43:06 -04:00
overlayText: screenWidth >= 600
2014-02-23 00:52:30 -05:00
})).createPosterItemMenus();
2013-04-30 23:28:26 -04:00
});
2014-02-23 00:52:30 -05:00
}
2013-04-30 23:28:26 -04:00
2014-02-23 00:52:30 -05:00
function loadNextUp(page) {
2013-04-30 23:28:26 -04:00
2014-05-09 15:43:06 -04:00
var screenWidth = $(window).width();
2014-05-01 22:54:33 -04:00
var parentId = LibraryMenu.getTopParentId();
2014-02-23 00:52:30 -05:00
var options = {
Limit: 24,
Fields: "PrimaryImageAspectRatio,SeriesInfo,DateCreated",
UserId: Dashboard.getCurrentUserId(),
2014-05-01 22:54:33 -04:00
ExcludeLocationTypes: "Virtual",
ParentId: parentId
2013-04-30 23:28:26 -04:00
};
2014-02-23 00:52:30 -05:00
ApiClient.getNextUpEpisodes(options).done(function (result) {
2013-04-30 23:28:26 -04:00
if (result.Items.length) {
2014-03-31 17:04:22 -04:00
$('.noNextUpItems', page).hide();
2013-04-30 23:28:26 -04:00
} else {
2014-03-31 17:04:22 -04:00
$('.noNextUpItems', page).show();
2013-04-30 23:28:26 -04:00
}
2014-03-31 17:04:22 -04:00
$('#nextUpItems', page).html(LibraryBrowser.getPosterViewHtml({
items: result.Items,
shape: "backdrop",
showTitle: true,
showParentTitle: true,
2014-05-09 15:43:06 -04:00
overlayText: screenWidth >= 600
2014-02-23 00:52:30 -05:00
2014-03-31 17:04:22 -04:00
})).createPosterItemMenus();
2013-04-30 23:28:26 -04:00
});
2014-02-23 00:52:30 -05:00
}
$(document).on('pagebeforeshow', "#tvRecommendedPage", function () {
var page = this;
2013-04-30 23:28:26 -04:00
2014-02-23 00:52:30 -05:00
loadResume(page);
loadNextUp(page);
2013-04-30 23:28:26 -04:00
});
2013-04-01 18:28:01 -07:00
})(jQuery, document);