From b68c383af69e22dcd06064119b3fdd30cf4c7e88 Mon Sep 17 00:00:00 2001 From: Techywarrior Date: Mon, 1 Apr 2013 18:28:01 -0700 Subject: [PATCH] TV recommended page --- dashboard-ui/scripts/tvrecommended.js | 57 ++++++++++++++++++++++++++- 1 file changed, 56 insertions(+), 1 deletion(-) diff --git a/dashboard-ui/scripts/tvrecommended.js b/dashboard-ui/scripts/tvrecommended.js index 5f282702b..076ebdf94 100644 --- a/dashboard-ui/scripts/tvrecommended.js +++ b/dashboard-ui/scripts/tvrecommended.js @@ -1 +1,56 @@ - \ No newline at end of file +(function ($, document) { + + $(document).on('pageshow', "#tvRecommendedPage", function () { + + var page = this; + + var options = { + + SortBy: "DateCreated", + SortOrder: "Descending", + IncludeItemTypes: "Episode", + Limit: 5, + Recursive: true, + Fields: "PrimaryImageAspectRatio" + }; + + ApiClient.getItems(Dashboard.getCurrentUserId(), options).done(function (result) { + + $('#recentlyAddedItems', page).html(Dashboard.getPosterViewHtml({ + items: result.Items, + useAverageAspectRatio: true + })); + + }); + + + options = { + + SortBy: "DatePlayed", + SortOrder: "Descending", + IncludeItemTypes: "Episode", + Filters: "IsResumable", + Limit: 5, + Recursive: true, + Fields: "PrimaryImageAspectRatio" + }; + + ApiClient.getItems(Dashboard.getCurrentUserId(), options).done(function (result) { + + if (result.Items.length) { + $('#resumableSection', page).show(); + } else { + $('#resumableSection', page).hide(); + } + + $('#resumableItems', page).html(Dashboard.getPosterViewHtml({ + items: result.Items, + useAverageAspectRatio: true + })); + + }); + + }); + + +})(jQuery, document); \ No newline at end of file