diff --git a/dashboard-ui/scripts/Itemdetailpage.js b/dashboard-ui/scripts/Itemdetailpage.js
index 0e515a485..02cf34849 100644
--- a/dashboard-ui/scripts/Itemdetailpage.js
+++ b/dashboard-ui/scripts/Itemdetailpage.js
@@ -151,7 +151,7 @@
if (url) {
- var style = useBackgroundColor ? "background-color:" + Dashboard.getMetroColor(item.Id) + ";" : "";
+ var style = useBackgroundColor ? "background-color:" + LibraryBrowser.getMetroColor(item.Id) + ";" : "";
html += "";
}
@@ -700,7 +700,7 @@
html += '
';
} else {
- var style = "background-color:" + Dashboard.getMetroColor(cast.Name) + ";";
+ var style = "background-color:" + LibraryBrowser.getMetroColor(cast.Name) + ";";
html += '
';
}
diff --git a/dashboard-ui/scripts/indexpage.js b/dashboard-ui/scripts/indexpage.js
index dfd932416..e2ae9d52b 100644
--- a/dashboard-ui/scripts/indexpage.js
+++ b/dashboard-ui/scripts/indexpage.js
@@ -19,7 +19,7 @@
apiClient.getItems(userId, options).done(function (result) {
- $('#divCollections', page).html(Dashboard.getPosterViewHtml({
+ $('#divCollections', page).html(LibraryBrowser.getPosterViewHtml({
items: result.Items,
showTitle: true
}));
diff --git a/dashboard-ui/scripts/itembynamedetailpage.js b/dashboard-ui/scripts/itembynamedetailpage.js
index d810a1fff..86d396fd9 100644
--- a/dashboard-ui/scripts/itembynamedetailpage.js
+++ b/dashboard-ui/scripts/itembynamedetailpage.js
@@ -95,7 +95,7 @@
}
if (url) {
- var style = useBackgroundColor ? "background-color:" + Dashboard.getMetroColor(item.Id) + ";" : "";
+ var style = useBackgroundColor ? "background-color:" + LibraryBrowser.getMetroColor(item.Id) + ";" : "";
html += "";
}
diff --git a/dashboard-ui/scripts/itemlistpage.js b/dashboard-ui/scripts/itemlistpage.js
index 4d6d4e257..a2b0e827e 100644
--- a/dashboard-ui/scripts/itemlistpage.js
+++ b/dashboard-ui/scripts/itemlistpage.js
@@ -83,7 +83,7 @@
showTitle: query.Recursive
};
- var html = Dashboard.getPosterViewHtml(renderOptions);
+ var html = LibraryBrowser.getPosterViewHtml(renderOptions);
$('#listItems', $.mobile.activePage).html(html);
diff --git a/dashboard-ui/scripts/librarybrowser.js b/dashboard-ui/scripts/librarybrowser.js
index 5f282702b..60075ca7c 100644
--- a/dashboard-ui/scripts/librarybrowser.js
+++ b/dashboard-ui/scripts/librarybrowser.js
@@ -1 +1,124 @@
-
\ No newline at end of file
+var LibraryBrowser = {
+
+ getPosterViewHtml: 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 || (item.IsFolder ? (item.Id ? "itemList.html?parentId=" + item.Id : "#") : "itemdetails.html?id=" + item.Id);
+
+ var showText = options.showTitle || !hasPrimaryImage || (item.Type !== 'Movie' && item.Type !== 'Series' && item.Type !== 'Season' && item.Type !== 'Trailer');
+
+ var cssClass = showText ? "posterViewItem" : "posterViewItem posterViewItemWithNoText";
+
+ html += "
';
+ html += '
';
}
html += '';
@@ -86,7 +86,7 @@
ApiClient.getItems(Dashboard.getCurrentUserId(), query).done(function (result) {
- $('#items', page).html(Dashboard.getPosterViewHtml({
+ $('#items', page).html(LibraryBrowser.getPosterViewHtml({
items: result.Items,
useAverageAspectRatio: true
diff --git a/dashboard-ui/scripts/moviesrecommended.js b/dashboard-ui/scripts/moviesrecommended.js
index 7ede94fb5..450f5f883 100644
--- a/dashboard-ui/scripts/moviesrecommended.js
+++ b/dashboard-ui/scripts/moviesrecommended.js
@@ -16,7 +16,7 @@
ApiClient.getItems(Dashboard.getCurrentUserId(), options).done(function (result) {
- $('#recentlyAddedItems', page).html(Dashboard.getPosterViewHtml({
+ $('#recentlyAddedItems', page).html(LibraryBrowser.getPosterViewHtml({
items: result.Items,
useAverageAspectRatio: true
}));
@@ -43,7 +43,7 @@
$('#resumableSection', page).hide();
}
- $('#resumableItems', page).html(Dashboard.getPosterViewHtml({
+ $('#resumableItems', page).html(LibraryBrowser.getPosterViewHtml({
items: result.Items,
useAverageAspectRatio: true
}));
diff --git a/dashboard-ui/scripts/plugincatalogpage.js b/dashboard-ui/scripts/plugincatalogpage.js
index 16e6d23c6..32d50dcf4 100644
--- a/dashboard-ui/scripts/plugincatalogpage.js
+++ b/dashboard-ui/scripts/plugincatalogpage.js
@@ -54,7 +54,7 @@
}
}
- var color = plugin.tileColor || Dashboard.getMetroColor(plugin.name);
+ var color = plugin.tileColor || LibraryBrowser.getMetroColor(plugin.name);
html += "