From a65280a36c8007b6578add951873759c9f4aeb4b Mon Sep 17 00:00:00 2001 From: Techywarrior Date: Tue, 9 Apr 2013 22:06:59 -0700 Subject: [PATCH] tv show poster view --- dashboard-ui/scripts/librarybrowser.js | 80 ++++++++++++++++++++++++++ dashboard-ui/scripts/tvshows.js | 2 +- 2 files changed, 81 insertions(+), 1 deletion(-) diff --git a/dashboard-ui/scripts/librarybrowser.js b/dashboard-ui/scripts/librarybrowser.js index a8cd2afae..b964632b2 100644 --- a/dashboard-ui/scripts/librarybrowser.js +++ b/dashboard-ui/scripts/librarybrowser.js @@ -238,6 +238,86 @@ return html; }, + getSeriesPosterViewHtml: function (options) { + + var items = options.items; + + var primaryImageAspectRatio = options.useAverageAspectRatio ? LibraryBrowser.getAveragePrimaryImageAspectRatio(items) : null; + + var html = ""; + + for (var i = 0, length = items.length; i < length; i++) { + var item = items[i]; + + var hasPrimaryImage = item.ImageTags && item.ImageTags.Primary; + + var href = item.url || "tvseries.html?id=" + item.Id; + + var showText = options.showTitle || !hasPrimaryImage; + + var cssClass = showText ? "posterViewItem" : "posterViewItem posterViewItemWithNoText"; + + html += "
"; + + if (options.preferBackdrop && item.BackdropImageTags && item.BackdropImageTags.length) { + html += ""; + } else if (hasPrimaryImage) { + + var height = 300; + var width = primaryImageAspectRatio ? parseInt(height * primaryImageAspectRatio) : null; + + html += ""; + + } else if (item.BackdropImageTags && item.BackdropImageTags.length) { + html += ""; + } + else if (item.MediaType == "Audio" || item.Type == "MusicAlbum" || item.Type == "MusicArtist") { + + html += ""; + } + else if (item.MediaType == "Video" || item.Type == "Season" || item.Type == "Series") { + + html += ""; + } + else { + + html += ""; + } + + if (showText) { + html += "
"; + html += item.Name; + html += "
"; + } + + if (options.showNewIndicator !== false) { + html += LibraryBrowser.getNewIndicatorHtml(item); + } + + html += "
"; + } + + return html; + }, + getNewIndicatorHtml: function (item) { if (item.RecentlyAddedItemCount) { diff --git a/dashboard-ui/scripts/tvshows.js b/dashboard-ui/scripts/tvshows.js index 229a0bc75..7fa337de8 100644 --- a/dashboard-ui/scripts/tvshows.js +++ b/dashboard-ui/scripts/tvshows.js @@ -86,7 +86,7 @@ ApiClient.getItems(Dashboard.getCurrentUserId(), query).done(function (result) { - $('#items', page).html(LibraryBrowser.getPosterViewHtml({ + $('#items', page).html(LibraryBrowser.getSeriesPosterViewHtml({ items: result.Items, useAverageAspectRatio: true