diff --git a/ApiClient.js b/ApiClient.js index 7db97e6603..d139adfc3e 100644 --- a/ApiClient.js +++ b/ApiClient.js @@ -3171,144 +3171,6 @@ MediaBrowser.ApiClient = function ($, navigator, JSON, WebSocket, setTimeout, wi }); }; - /** - Gets a variety of item counts that a person appears in - */ - self.getPersonItemCounts = function (userId, name) { - - if (!userId) { - throw new Error("null userId"); - } - - if (!name) { - throw new Error("null name"); - } - - var url = self.getUrl("Persons/" + self.encodeName(name) + "/Counts", { - userId: userId - }); - - return self.ajax({ - type: "GET", - url: url, - dataType: "json" - }); - }; - - /** - Gets a variety of item counts that a genre appears in - */ - self.getGenreItemCounts = function (userId, name) { - - if (!userId) { - throw new Error("null userId"); - } - - if (!name) { - throw new Error("null name"); - } - - var url = self.getUrl("Genres/" + self.encodeName(name) + "/Counts", { - userId: userId - }); - - return self.ajax({ - type: "GET", - url: url, - dataType: "json" - }); - }; - - self.getMusicGenreItemCounts = function (userId, name) { - - if (!userId) { - throw new Error("null userId"); - } - - if (!name) { - throw new Error("null name"); - } - - var url = self.getUrl("MusicGenres/" + self.encodeName(name) + "/Counts", { - userId: userId - }); - - return self.ajax({ - type: "GET", - url: url, - dataType: "json" - }); - }; - - self.getGameGenreItemCounts = function (userId, name) { - - if (!userId) { - throw new Error("null userId"); - } - - if (!name) { - throw new Error("null name"); - } - - var url = self.getUrl("GameGenres/" + self.encodeName(name) + "/Counts", { - userId: userId - }); - - return self.ajax({ - type: "GET", - url: url, - dataType: "json" - }); - }; - - /** - Gets a variety of item counts that an artist appears in - */ - self.getArtistItemCounts = function (userId, name) { - - if (!userId) { - throw new Error("null userId"); - } - - if (!name) { - throw new Error("null name"); - } - - var url = self.getUrl("Artists/" + self.encodeName(name) + "/Counts", { - userId: userId - }); - - return self.ajax({ - type: "GET", - url: url, - dataType: "json" - }); - }; - - /** - Gets a variety of item counts that a studio appears in - */ - self.getStudioItemCounts = function (userId, name) { - - if (!userId) { - throw new Error("null userId"); - } - - if (!name) { - throw new Error("null name"); - } - - var url = self.getUrl("Studios/" + self.encodeName(name) + "/Counts", { - userId: userId - }); - - return self.ajax({ - type: "GET", - url: url, - dataType: "json" - }); - }; - /** * Clears a user's personal rating for an item * @param {String} userId diff --git a/dashboard-ui/scripts/gamegenrepage.js b/dashboard-ui/scripts/gamegenrepage.js index 16471c9cb2..4fac33383b 100644 --- a/dashboard-ui/scripts/gamegenrepage.js +++ b/dashboard-ui/scripts/gamegenrepage.js @@ -25,8 +25,6 @@ html += LibraryBrowser.getPosterDetailViewHtml({ items: result.Items, - countNameSingular: "Game", - countNamePlural: "Games", context: "games" }); diff --git a/dashboard-ui/scripts/gamestudiospage.js b/dashboard-ui/scripts/gamestudiospage.js index 076b62ccd7..9987d00ff9 100644 --- a/dashboard-ui/scripts/gamestudiospage.js +++ b/dashboard-ui/scripts/gamestudiospage.js @@ -26,8 +26,6 @@ html += LibraryBrowser.getPosterDetailViewHtml({ items: result.Items, - countNameSingular: "Game", - countNamePlural: "Games", context: "games" }); diff --git a/dashboard-ui/scripts/itembynamedetailpage.js b/dashboard-ui/scripts/itembynamedetailpage.js index fabd83b9e8..b05a5ab7a5 100644 --- a/dashboard-ui/scripts/itembynamedetailpage.js +++ b/dashboard-ui/scripts/itembynamedetailpage.js @@ -147,104 +147,77 @@ function renderTabs(page, item) { - var promise; + var html = '
'; + if (selectedRadio && selectedRadio.length) { + selectedRadio.attr("checked", "checked").checkboxradio("refresh").trigger('click'); + } else { + $('input:first', elem).attr("checked", "checked").checkboxradio("refresh").trigger('click'); + } - var elem = $('#itemTabs', page).html(html).trigger('create'); - - bindRadioEvents(page); - - var context = getParameterByName('context'); - var selectedRadio = null; - - if (context) { - selectedRadio = $('.context-' + context + ':first', elem); - } - - if (selectedRadio && selectedRadio.length) { - selectedRadio.attr("checked", "checked").checkboxradio("refresh").trigger('click'); - } else { - $('input:first', elem).attr("checked", "checked").checkboxradio("refresh").trigger('click'); - } - - }); } function bindRadioEvents(page) { diff --git a/dashboard-ui/scripts/librarybrowser.js b/dashboard-ui/scripts/librarybrowser.js index 47cd2ba5f1..f9d3778e0e 100644 --- a/dashboard-ui/scripts/librarybrowser.js +++ b/dashboard-ui/scripts/librarybrowser.js @@ -199,9 +199,7 @@ } else if (item.Type == "Genre" || item.Type == "Studio" || item.Type == "Person" || item.Type == "Artist" || item.Type == "MusicGenre" || item.Type == "GameGenre") { - childText = item.ChildCount == 1 ? "1 " + options.countNameSingular : item.ChildCount + " " + options.countNamePlural; - - html += '' + childText + '
'; + html += LibraryBrowser.getItemCountsHtml(options, item); } else if (item.Type == "Game") { @@ -236,6 +234,56 @@ return html; }, + getItemCountsHtml: function (options, item) { + + var childText; + + if (options.context == "movies") { + + if (item.MovieCount) { + + childText = item.MovieCount == 1 ? "1 Movie" : item.MovieCount + " Movies"; + } + else if (item.TrailerCount) { + + childText = item.TrailerCount == 1 ? "1 Trailer" : item.TrailerCount + " Trailers"; + } + + } + else if (options.context == "tv") { + + if (item.SeriesCount) { + + childText = item.SeriesCount == 1 ? "1 Show" : item.SeriesCount + " Shows"; + } + else if (item.EpisodeCount) { + + childText = item.EpisodeCount == 1 ? "1 Episode" : item.EpisodeCount + " Episodes"; + } + + } + else if (options.context == "games") { + + if (item.GameCount) { + + childText = item.GameCount == 1 ? "1 Game" : item.GameCount + " Games"; + } + } + else if (options.context == "music") { + + if (item.SongCount) { + + childText = item.SongCount == 1 ? "1 Song" : item.SongCount + " Songs"; + } + else if (item.MusicVideoCount) { + + childText = item.MusicVideoCount == 1 ? "1 Music Video" : item.MusicVideoCount + " Music Videos"; + } + } + + return childText ? '' + childText + '
' : ''; + }, + getSongHeaderCellHtml: function (text, cssClass, enableSorting, sortField, selectedSortField, sortDirection) { var html = cssClass ? '