(function ($, document) { function loadResume(page) { var screenWidth = $(window).width(); var options = { SortBy: "DatePlayed", SortOrder: "Descending", IncludeItemTypes: "Episode", Filters: "IsResumable", Limit: screenWidth >= 1920 ? 4 : (screenWidth >= 1440 ? 4 : 3), Recursive: true, Fields: "PrimaryImageAspectRatio,SeriesInfo,UserData", ExcludeLocationTypes: "Virtual" }; ApiClient.getItems(Dashboard.getCurrentUserId(), options).done(function (result) { if (result.Items.length) { $('#resumableSection', page).show(); } else { $('#resumableSection', page).hide(); } $('#resumableItems', page).html(LibraryBrowser.getPosterViewHtml({ items: result.Items, shape: "backdrop", showTitle: true, showParentTitle: true, overlayText: true })).createPosterItemMenus(); }); } function loadNextUp(page) { var options = { Limit: 24, Fields: "PrimaryImageAspectRatio,SeriesInfo,DateCreated", UserId: Dashboard.getCurrentUserId(), ExcludeLocationTypes: "Virtual" }; ApiClient.getNextUpEpisodes(options).done(function (result) { if (result.Items.length) { $('.noNextUpItems', page).hide(); } else { $('.noNextUpItems', page).show(); } $('#nextUpItems', page).html(LibraryBrowser.getPosterViewHtml({ items: result.Items, shape: "backdrop", showTitle: true, showParentTitle: true, overlayText: true })).createPosterItemMenus(); }); } $(document).on('pagebeforeshow', "#tvRecommendedPage", function () { var page = this; loadResume(page); loadNextUp(page); }); })(jQuery, document);