diff --git a/ApiClient.js b/ApiClient.js index 42aa7d52c0..9999c0fe0f 100644 --- a/ApiClient.js +++ b/ApiClient.js @@ -1733,6 +1733,35 @@ MediaBrowser.ApiClient = function ($, navigator, JSON, WebSocket, setTimeout) { }); }; + self.getVideoBackdrops = function (userId, itemId) { + + if (!userId) { + throw new Error("null userId"); + } + if (!itemId) { + throw new Error("null itemId"); + } + + var url = self.getUrl("Users/" + userId + "/Items/" + itemId + "/VideoBackdrops"); + + return self.ajax({ + type: "GET", + url: url, + dataType: "json" + }); + }; + + self.getSearchHints = function (options) { + + var url = self.getUrl("Search/Hints", options); + + return self.ajax({ + type: "GET", + url: url, + dataType: "json" + }); + }; + /** * Gets special features for an item */ diff --git a/dashboard-ui/itemdetails.html b/dashboard-ui/itemdetails.html index b8aab4258f..f429743365 100644 --- a/dashboard-ui/itemdetails.html +++ b/dashboard-ui/itemdetails.html @@ -170,6 +170,12 @@
+
+ +
diff --git a/dashboard-ui/scripts/Itemdetailpage.js b/dashboard-ui/scripts/Itemdetailpage.js index 5f6fe464dc..0dff815334 100644 --- a/dashboard-ui/scripts/Itemdetailpage.js +++ b/dashboard-ui/scripts/Itemdetailpage.js @@ -221,10 +221,15 @@ } $('#themeSongsCollapsible', page).hide(); + $('#videoBackdropsCollapsible', page).hide(); ApiClient.getThemeSongs(Dashboard.getCurrentUserId(), item.Id).done(function (result) { renderThemeSongs(page, item, result); }); + + ApiClient.getVideoBackdrops(Dashboard.getCurrentUserId(), item.Id).done(function (result) { + renderVideoBackdrops(page, item, result); + }); } function renderDetails(page, item, context) { @@ -310,6 +315,16 @@ } } + function renderVideoBackdrops(page, item, result) { + + if (result.Items.length) { + + $('#videoBackdropsCollapsible', page).show(); + + $('#videoBackdropsContent', page).html(getVideosHtml(result.Items)).trigger('create'); + } + } + function renderScenes(page, item) { var html = ''; @@ -446,98 +461,65 @@ $('#mediaInfoContent', page).html(html).trigger('create'); } - function renderSpecials(page, item) { + function getVideosHtml(items) { + var html = ''; + for (var i = 0, length = items.length; i < length; i++) { + + var item = items[i]; + + html += '
'; + html += ''; + + var imageTags = item.ImageTags || {}; + + if (imageTags.Primary) { + + var imgUrl = ApiClient.getImageUrl(item.Id, { + maxwidth: 500, + tag: imageTags.Primary, + type: "primary" + }); + + html += ''; + } else { + html += ''; + } + + html += '
' + item.Name + '
'; + html += '
'; + + if (item.RunTimeTicks != "") { + html += ticks_to_human(item.RunTimeTicks); + } + else { + html += " "; + } + html += '
'; + + html += '
'; + + html += '
'; + } + + return html; + } + + function renderSpecials(page, item) { + ApiClient.getSpecialFeatures(Dashboard.getCurrentUserId(), item.Id).done(function (specials) { - for (var i = 0, length = specials.length; i < length; i++) { - - var special = specials[i]; - - html += '
'; - html += ''; - - var imageTags = special.ImageTags || {}; - - if (imageTags.Primary) { - - var imgUrl = ApiClient.getImageUrl(special.Id, { - maxwidth: 500, - tag: imageTags.Primary, - type: "primary" - }); - - html += ''; - } else { - html += ''; - } - - html += '
' + special.Name + '
'; - html += '
'; - - if (special.RunTimeTicks != "") { - html += ticks_to_human(special.RunTimeTicks); - } - else { - html += " "; - } - html += '
'; - - html += '
'; - - html += '
'; - } - - $('#specialsContent', page).html(html); + $('#specialsContent', page).html(getVideosHtml(specials)); }); } function renderTrailers(page, item) { - var html = ''; ApiClient.getLocalTrailers(Dashboard.getCurrentUserId(), item.Id).done(function (trailers) { - for (var i = 0, length = trailers.length; i < length; i++) { - - var trailer = trailers[i]; - - html += '
'; - html += ''; - - var imageTags = trailer.ImageTags || {}; - - if (imageTags.Primary) { - - var imgUrl = ApiClient.getImageUrl(trailer.Id, { - maxwidth: 500, - tag: imageTags.Primary, - type: "primary" - }); - - html += ''; - } else { - html += ''; - } - - html += '
' + trailer.Name + '
'; - html += '
'; - - if (trailer.RunTimeTicks != "") { - html += ticks_to_human(trailer.RunTimeTicks); - } - else { - html += " "; - } - html += '
'; - - html += '
'; - - html += '
'; - } - - $('#trailersContent', page).html(html); + $('#trailersContent', page).html(getVideosHtml(trailers)); }); } @@ -633,15 +615,9 @@ self.play = play; - self.playTrailer = function (index) { - ApiClient.getLocalTrailers(Dashboard.getCurrentUserId(), currentItem.Id).done(function (trailers) { - MediaPlayer.play([trailers[index]]); - }); - }; - - self.playSpecial = function (index) { - ApiClient.getSpecialFeatures(Dashboard.getCurrentUserId(), currentItem.Id).done(function (specials) { - MediaPlayer.play([specials[index]]); + self.playById = function (id) { + ApiClient.getItem(Dashboard.getCurrentUserId(), id).done(function (item) { + MediaPlayer.play([item]); }); }; } diff --git a/dashboard-ui/scripts/search.js b/dashboard-ui/scripts/search.js index 7f1224f507..aa787e6e35 100644 --- a/dashboard-ui/scripts/search.js +++ b/dashboard-ui/scripts/search.js @@ -64,7 +64,7 @@ var currentTimeout = searchHintTimeout; - $.getJSON(ApiClient.getUrl("Search/Hints", { userId: Dashboard.getCurrentUserId(), searchTerm: searchTerm, limit: 10 })).done(function (result) { + ApiClient.getSearchHints(ApiClient.getUrl({ userId: Dashboard.getCurrentUserId(), searchTerm: searchTerm, limit: 10 })).done(function (result) { if (currentTimeout != searchHintTimeout) { return; @@ -253,7 +253,7 @@ } window.Search = new search(); - + $(document).on('pagehide', ".libraryPage", function () { hideFlyout(this); diff --git a/packages.config b/packages.config index 31331b60d3..56ad5f6568 100644 --- a/packages.config +++ b/packages.config @@ -1,6 +1,6 @@  - + \ No newline at end of file