-
${TabSuggested}
${TabLatest}
-
${TabUpcoming}
${TabShows}
${TabEpisodes}
${TabGenres}
diff --git a/dashboard-ui/scripts/favorites.js b/dashboard-ui/scripts/favorites.js
new file mode 100644
index 0000000000..5f56c38909
--- /dev/null
+++ b/dashboard-ui/scripts/favorites.js
@@ -0,0 +1,112 @@
+(function ($, document, apiClient) {
+
+ function getSections() {
+
+ return [
+ { name: "Favorite Movies", types: "Movie", id: "favoriteMovies", shape: 'backdrop', preferThumb: true, showTitle: false },
+ { name: "Favorite Shows", types: "Series", id: "favoriteShows", shape: 'backdrop', preferThumb: true, showTitle: false },
+ { name: "Favorite Games", types: "Game", id: "favoriteGames", shape: 'auto', preferThumb: false, showTitle: true }
+ ];
+
+ }
+
+ function loadSection(elem, userId, section, isSingleSection) {
+
+ var screenWidth = $(window).width();
+
+ var options = {
+
+ SortBy: isSingleSection ? "SortName" : "Random",
+ SortOrder: "Ascending",
+ IncludeItemTypes: section.types,
+ Filters: "IsFavorite",
+ Limit: screenWidth >= 1920 ? 10 : (screenWidth >= 1440 ? 8 : 6),
+ Recursive: true,
+ Fields: "PrimaryImageAspectRatio",
+ CollapseBoxSetItems: false,
+ ExcludeLocationTypes: "Virtual"
+ };
+
+ if (isSingleSection) {
+ options.Limit = null;
+ }
+
+ ApiClient.getItems(userId, options).done(function (result) {
+
+ var html = '';
+
+ if (result.Items.length) {
+ html += '';
+ html += '
';
+ html += LibraryBrowser.getPosterViewHtml({
+ items: result.Items,
+ preferThumb: section.preferThumb,
+ shape: section.shape,
+ overlayText: screenWidth >= 600,
+ context: 'home-favorites',
+ showTitle: section.showTitle,
+ lazy: true
+ });
+
+ if (result.TotalRecordCount > result.Items.length) {
+ html += '
';
+
+ var href = "favorites.html?sectionid=" + section.id;
+
+ html += '
More ...';
+ html += '
';
+ }
+ html += '
';
+ }
+
+ $(elem).html(html).trigger('create').createPosterItemMenus();
+ });
+ }
+
+ function loadSections(page, userId) {
+
+ var sections = getSections();
+
+ var sectionid = getParameterByName('sectionid');
+
+ if (sectionid) {
+ sections = sections.filter(function (s) {
+
+ return s.id == sectionid;
+ });
+ }
+
+ var i, length;
+
+ var elem = $('.sections', page);
+
+ if (!elem.html().length) {
+ var html = '';
+ for (i = 0, length = sections.length; i < length; i++) {
+
+ html += '
';
+ }
+
+ elem.html(html);
+ }
+
+ for (i = 0, length = sections.length; i < length; i++) {
+
+ var section = sections[i];
+
+ elem = $('.section' + section.id, page);
+
+ loadSection(elem, userId, section, sections.length == 1);
+ }
+ }
+
+ $(document).on('pagebeforeshow', "#favoritesPage", function () {
+
+ var page = this;
+
+ var userId = Dashboard.getCurrentUserId();
+
+ loadSections(page, userId);
+ });
+
+})(jQuery, document, ApiClient);
\ No newline at end of file
diff --git a/dashboard-ui/scripts/gamesrecommendedpage.js b/dashboard-ui/scripts/gamesrecommendedpage.js
index 0623729783..17cadd47ef 100644
--- a/dashboard-ui/scripts/gamesrecommendedpage.js
+++ b/dashboard-ui/scripts/gamesrecommendedpage.js
@@ -22,7 +22,8 @@
$('#recentlyAddedItems', page).html(LibraryBrowser.getPosterViewHtml({
items: result.Items,
transparent: true,
- borderless: true
+ borderless: true,
+ shape: 'auto'
}));
});
@@ -50,7 +51,8 @@
$('#recentlyPlayedItems', page).html(LibraryBrowser.getPosterViewHtml({
items: result.Items,
transparent: true,
- borderless: true
+ borderless: true,
+ shape: 'auto'
}));
});
diff --git a/dashboard-ui/scripts/indexpage.js b/dashboard-ui/scripts/indexpage.js
index 8ea46dc110..d808ee3a65 100644
--- a/dashboard-ui/scripts/indexpage.js
+++ b/dashboard-ui/scripts/indexpage.js
@@ -192,7 +192,8 @@
preferThumb: true,
shape: 'backdrop',
showTitle: true,
- centerText: true
+ centerText: true,
+ context: 'home'
});
html += '
';
}
@@ -263,7 +264,8 @@
shape: 'backdrop',
overlayText: screenWidth >= 600,
showTitle: true,
- showParentTitle: true
+ showParentTitle: true,
+ context: 'home'
});
html += '
';
}
diff --git a/dashboard-ui/scripts/itemdetailpage.js b/dashboard-ui/scripts/itemdetailpage.js
index 558009545d..92ce73c52d 100644
--- a/dashboard-ui/scripts/itemdetailpage.js
+++ b/dashboard-ui/scripts/itemdetailpage.js
@@ -28,13 +28,13 @@
currentItem = item;
- renderHeader(page, item);
+ var context = getContext(item);
+
+ renderHeader(page, item, context);
LibraryBrowser.renderName(item, $('.itemName', page));
LibraryBrowser.renderParentName(item, $('.parentName', page));
- var context = getContext(item);
-
Dashboard.getCurrentUser().done(function (user) {
var imageHref = user.Configuration.IsAdministrator ? "edititemimages.html?id=" + item.Id : "";
@@ -145,6 +145,11 @@
function getContext(item) {
// should return either movies, tv, music or games
+ var context = getParameterByName('context');
+
+ if (context) {
+ return context;
+ }
if (item.Type == "Episode" || item.Type == "Series" || item.Type == "Season") {
return "tv";
@@ -164,46 +169,66 @@
return "";
}
- function renderHeader(page, item) {
+ function renderHeader(page, item, context) {
$('.itemTabs', page).hide();
+ $('.channelHeader', page).hide();
+ var elem;
- if (item.Type == "MusicAlbum") {
+ if (context == 'home') {
+ elem = $('.homeTabs', page).show();
+ $('a', elem).removeClass('ui-btn-active');
+ $('.lnkHomeHome', page).addClass('ui-btn-active');
+ }
+ else if (context == 'home-nextup') {
+ elem = $('.homeTabs', page).show();
+ $('a', elem).removeClass('ui-btn-active');
+ $('.lnkHomeNextUp', page).addClass('ui-btn-active');
+ }
+ else if (context == 'home-favorites') {
+ elem = $('.homeTabs', page).show();
+ $('a', elem).removeClass('ui-btn-active');
+ $('.lnkHomeFavorites', page).addClass('ui-btn-active');
+ }
+ else if (context == 'home-upcoming') {
+ elem = $('.homeTabs', page).show();
+ $('a', elem).removeClass('ui-btn-active');
+ $('.lnkHomeUpcoming', page).addClass('ui-btn-active');
+ }
+ else if (item.Type == "MusicAlbum") {
$('#albumTabs', page).show();
}
- if (item.Type == "MusicVideo") {
+ else if (item.Type == "MusicVideo") {
$('#musicVideoTabs', page).show();
}
- if (item.Type == "Audio") {
+ else if (item.Type == "Audio") {
$('#songTabs', page).show();
}
- if (item.Type == "Movie") {
+ else if (item.Type == "Movie") {
$('#movieTabs', page).show();
}
- if (item.Type == "ChannelVideoItem" || item.Type == "ChannelAudioItem" || item.Type == "ChannelFolderItem") {
+ else if (item.Type == "ChannelVideoItem" || item.Type == "ChannelAudioItem" || item.Type == "ChannelFolderItem") {
$('#channelTabs', page).show();
$('.channelHeader', page).show().html('
' + item.ChannelName + '').trigger('create');
- } else {
- $('.channelHeader', page).hide();
}
- if (item.Type == "BoxSet") {
+ else if (item.Type == "BoxSet") {
$('#boxsetTabs', page).show();
}
- if (item.MediaType == "Game") {
+ else if (item.MediaType == "Game") {
$('#gameTabs', page).show();
}
- if (item.Type == "GameSystem") {
+ else if (item.Type == "GameSystem") {
$('#gameSystemTabs', page).show();
}
- if (item.Type == "Episode" || item.Type == "Season" || item.Type == "Series") {
+ else if (item.Type == "Episode" || item.Type == "Season" || item.Type == "Series") {
$('#tvShowsTabs', page).show();
}
}
@@ -219,7 +244,7 @@
} else {
$('#childrenCollapsible', page).removeClass('hide');
}
- renderChildren(page, item, user);
+ renderChildren(page, item, user, context);
}
else {
$('#childrenCollapsible', page).addClass('hide');
@@ -280,7 +305,7 @@
function renderDetails(page, item, context) {
- renderSimilarItems(page, item);
+ renderSimilarItems(page, item, context);
renderSiblingLinks(page, item);
if (item.Taglines && item.Taglines.length) {
@@ -333,7 +358,7 @@
}
if (item.Artists && item.Artists.length && item.Type != "MusicAlbum") {
- $('#artist', page).show().html(getArtistLinksHtml(item.Artists)).trigger('create');
+ $('#artist', page).show().html(getArtistLinksHtml(item.Artists, context)).trigger('create');
} else {
$('#artist', page).hide();
}
@@ -401,7 +426,7 @@
//}
}
- function getArtistLinksHtml(artists) {
+ function getArtistLinksHtml(artists, context) {
var html = [];
@@ -409,7 +434,7 @@
var artist = artists[i];
- html.push('
' + artist + '');
+ html.push('
' + artist + '');
}
@@ -453,7 +478,8 @@
function renderSiblingLinks(page, item) {
$('.lnkSibling', page).addClass('hide');
-
+ return;
+
if ((item.Type != "Episode" && item.Type != "Season" && item.Type != "Audio") || item.IndexNumber == null) {
return;
}
@@ -507,7 +533,7 @@
});
}
- function renderSimilarItems(page, item) {
+ function renderSimilarItems(page, item, context) {
var promise;
@@ -554,7 +580,8 @@
showParentTitle: item.Type == "MusicAlbum",
centerText: item.Type != "MusicAlbum",
showTitle: item.Type == "MusicAlbum" || item.Type == "Game",
- borderless: item.Type == "Game"
+ borderless: item.Type == "Game",
+ context: context
});
$('#similarContent', page).html(html).createPosterItemMenus();
@@ -632,7 +659,7 @@
}
}
- function renderChildren(page, item, user) {
+ function renderChildren(page, item, user, context) {
var fields = "ItemCounts,AudioInfo,PrimaryImageAspectRatio";
@@ -684,7 +711,8 @@
items: result.Items,
shape: "portrait",
showTitle: true,
- centerText: true
+ centerText: true,
+ context: context
});
}
else if (item.Type == "Season") {
@@ -692,16 +720,17 @@
items: result.Items,
shape: "smallBackdrop",
showTitle: true,
- displayAsSpecial: item.Type == "Season" && item.IndexNumber
+ displayAsSpecial: item.Type == "Season" && item.IndexNumber,
+ context: context
});
}
else if (item.Type == "GameSystem") {
html = LibraryBrowser.getPosterViewHtml({
items: result.Items,
shape: "auto",
- context: 'games',
showTitle: true,
- centerText: true
+ centerText: true,
+ context: context
});
}
@@ -717,7 +746,7 @@
{ name: 'Books', type: 'Book' }
];
- renderCollectionItems(page, collectionItemTypes, result.Items, user);
+ renderCollectionItems(page, collectionItemTypes, result.Items, user, context);
}
}
});
@@ -781,7 +810,7 @@
$('.collectionItems', page).trigger('create').createPosterItemMenus();
}
- function renderCollectionItemType(page, type, items, user) {
+ function renderCollectionItemType(page, type, items, user, context) {
var html = '';
@@ -804,7 +833,8 @@
items: items,
shape: shape,
showTitle: true,
- centerText: true
+ centerText: true,
+ context: context
});
html += '
';
diff --git a/dashboard-ui/scripts/librarybrowser.js b/dashboard-ui/scripts/librarybrowser.js
index 6cce39df1d..3d30e12186 100644
--- a/dashboard-ui/scripts/librarybrowser.js
+++ b/dashboard-ui/scripts/librarybrowser.js
@@ -340,8 +340,19 @@
closePlayMenu: function () {
$('.playFlyout').popup("close").remove();
},
+
+ getHref: function (item, context) {
- getHref: function (item, itemByNameContext) {
+ var href = LibraryBrowser.getHrefInternal(item);
+
+ if (context) {
+ href += "&context=" + context;
+ }
+
+ return href;
+ },
+
+ getHrefInternal: function (item) {
if (!item) {
throw new Error('item cannot be null');
@@ -351,8 +362,6 @@
return item.url;
}
- itemByNameContext = itemByNameContext || "";
-
// Handle search hints
var id = item.Id || item.ItemId;
@@ -369,7 +378,7 @@
}
if (item.CollectionType == 'tvshows') {
- return 'tvrecommended.html?topParentId=' + item.Id;
+ return 'tvlatest.html?topParentId=' + item.Id;
}
if (item.CollectionType == 'music') {
@@ -411,30 +420,33 @@
return "itemdetails.html?id=" + id;
}
if (item.Type == "Genre") {
- return "itembynamedetails.html?genre=" + ApiClient.encodeName(item.Name) + "&context=" + itemByNameContext;
+ return "itembynamedetails.html?genre=" + ApiClient.encodeName(item.Name);
}
if (item.Type == "MusicGenre") {
- return "itembynamedetails.html?musicgenre=" + ApiClient.encodeName(item.Name) + "&context=" + itemByNameContext;
+ return "itembynamedetails.html?musicgenre=" + ApiClient.encodeName(item.Name);
}
if (item.Type == "GameGenre") {
- return "itembynamedetails.html?gamegenre=" + ApiClient.encodeName(item.Name) + "&context=" + itemByNameContext;
+ return "itembynamedetails.html?gamegenre=" + ApiClient.encodeName(item.Name);
}
if (item.Type == "Studio") {
- return "itembynamedetails.html?studio=" + ApiClient.encodeName(item.Name) + "&context=" + itemByNameContext;
+ return "itembynamedetails.html?studio=" + ApiClient.encodeName(item.Name);
}
if (item.Type == "Person") {
- return "itembynamedetails.html?person=" + ApiClient.encodeName(item.Name) + "&context=" + itemByNameContext;
+ return "itembynamedetails.html?person=" + ApiClient.encodeName(item.Name);
}
if (item.Type == "Recording") {
return "livetvrecording.html?id=" + id;
}
if (item.Type == "MusicArtist") {
- return "itembynamedetails.html?musicartist=" + ApiClient.encodeName(item.Name) + "&context=" + (itemByNameContext || "music");
+ return "itembynamedetails.html?musicartist=" + ApiClient.encodeName(item.Name);
}
- return item.IsFolder ? (id ? "itemlist.html?parentId=" + id : "#") : "itemdetails.html?id=" + id;
+ if (item.IsFolder) {
+ return id ? "itemlist.html?parentId=" + id : "#";
+ }
+ return "itemdetails.html?id=" + id;
},
getImageUrl: function (item, type, index, options) {
@@ -793,7 +805,7 @@
cssClass = options.centerText ? "posterItemText posterItemTextCentered" : "posterItemText";
var lines = [];
-
+
if (options.showParentTitle) {
lines.push(item.EpisodeTitle ? item.Name : (item.SeriesName || item.Album || item.AlbumArtist || item.GameSystem || ""));
diff --git a/dashboard-ui/scripts/librarymenu.js b/dashboard-ui/scripts/librarymenu.js
index e2bc35fc49..922b6ec913 100644
--- a/dashboard-ui/scripts/librarymenu.js
+++ b/dashboard-ui/scripts/librarymenu.js
@@ -4,7 +4,7 @@
var html = '