";
+ }
- return html;
- },
+ return html;
+ },
getAveragePrimaryImageAspectRatio: function (items) {
@@ -258,10 +258,10 @@
if (str) {
var char = String(str.substr(0, 1).charCodeAt());
- var sum = 0;
- for (var i = 0; i < char.length; i++) {
- sum += parseInt(char.charAt(i));
- }
+ var sum = 0;
+ for (var i = 0; i < char.length; i++) {
+ sum += parseInt(char.charAt(i));
+ }
var index = String(sum).substr(-1);
return LibraryBrowser.metroColors[index];
@@ -271,45 +271,72 @@
},
- renderLinks: function (item) {
- var page = $.mobile.activePage;
-//console.log(item);
- if (item.ProviderIds) {
+ renderLinks: function (item) {
+ var page = $.mobile.activePage;
+ //console.log(item);
+ if (item.ProviderIds) {
- var html = 'Links: ';
- var links = [];
+ var html = 'Links: ';
+ var links = [];
- if (item.ProviderIds.Imdb) {
- if (item.Type == "Movie" || item.Type == "Episode")
- links.push('IMDb');
- else if (item.Type == "Person")
- links.push('IMDb');
- }
- if (item.ProviderIds.Tmdb) {
- if (item.Type == "Movie")
- links.push('TMDB');
- else if (item.Type == "Person")
- links.push('TMDB');
- }
- if (item.ProviderIds.Tvdb)
- links.push('TVDB');
- if (item.ProviderIds.Tvcom) {
- if (item.Type == "Episode")
- links.push('TV.com');
- else if (item.Type == "Person")
- links.push('TV.com');
- }
- if (item.ProviderIds.Musicbrainz)
- links.push('MusicBrainz');
- if (item.ProviderIds.Gamesdb)
- links.push('GamesDB');
+ if (item.ProviderIds.Imdb) {
+ if (item.Type == "Movie" || item.Type == "Episode")
+ links.push('IMDb');
+ else if (item.Type == "Person")
+ links.push('IMDb');
+ }
+ if (item.ProviderIds.Tmdb) {
+ if (item.Type == "Movie")
+ links.push('TMDB');
+ else if (item.Type == "Person")
+ links.push('TMDB');
+ }
+ if (item.ProviderIds.Tvdb)
+ links.push('TVDB');
+ if (item.ProviderIds.Tvcom) {
+ if (item.Type == "Episode")
+ links.push('TV.com');
+ else if (item.Type == "Person")
+ links.push('TV.com');
+ }
+ if (item.ProviderIds.Musicbrainz)
+ links.push('MusicBrainz');
+ if (item.ProviderIds.Gamesdb)
+ links.push('GamesDB');
- html += links.join(' / ');
+ html += links.join(' / ');
- $('#itemLinks', page).html(html);
+ $('#itemLinks', page).html(html);
- } else {
- $('#itemLinks', page).hide();
- }
- }
+ } else {
+ $('#itemLinks', page).hide();
+ }
+ },
+
+ getPagingHtml: function (query, totalRecordCount) {
+
+ var html = '';
+
+ var pageCount = Math.ceil(totalRecordCount / query.Limit);
+ var pageNumber = (query.StartIndex / query.Limit) + 1;
+
+ var dropdownHtml = '';
+
+ var recordsEnd = Math.min(query.StartIndex + query.Limit, totalRecordCount);
+
+ html += '
';
+ html += 'Results ' + (query.StartIndex + 1) + '-' + recordsEnd + ' of ' + totalRecordCount + ', page ' + dropdownHtml + ' of ' + pageCount;
+ html += '
';
+
+ return html;
+ }
};
\ No newline at end of file
diff --git a/dashboard-ui/scripts/mediaplayer.js b/dashboard-ui/scripts/mediaplayer.js
index bdb8c52734..b4e6b06e73 100644
--- a/dashboard-ui/scripts/mediaplayer.js
+++ b/dashboard-ui/scripts/mediaplayer.js
@@ -1,4 +1,4 @@
-var MediaPlayer = (function (document, clearTimeout, screen, localStorage, _V_, $) {
+var MediaPlayer = (function (document, clearTimeout, screen, localStorage, _V_, $, setInterval) {
var testableAudioElement = document.createElement('audio');
var testableVideoElement = document.createElement('video');
@@ -360,4 +360,4 @@
return self;
-})(document, clearTimeout, screen, localStorage, _V_, $);
\ No newline at end of file
+})(document, clearTimeout, screen, localStorage, _V_, $, setInterval);
\ No newline at end of file
diff --git a/dashboard-ui/scripts/movies.js b/dashboard-ui/scripts/movies.js
index 1cf2449410..015a8aa078 100644
--- a/dashboard-ui/scripts/movies.js
+++ b/dashboard-ui/scripts/movies.js
@@ -138,31 +138,6 @@
return html;
}
- function getPagingHtml(result) {
-
- var html = '';
-
- var pageCount = Math.round(result.TotalRecordCount / query.Limit);
- var pageNumber = (query.StartIndex / query.Limit) + 1;
-
- var dropdownHtml = '';
-
- html += '
';
- html += 'Results ' + (query.StartIndex + 1) + '-' + (query.StartIndex + query.Limit) + ' of ' + result.TotalRecordCount + ', page ' + dropdownHtml + ' of ' + pageCount;
- html += '
';
-
- return html;
- }
-
function reloadItems(page) {
Dashboard.showLoadingMsg();
@@ -174,7 +149,7 @@
var showPaging = result.TotalRecordCount > query.Limit;
if (showPaging) {
- html += getPagingHtml(result);
+ html += LibraryBrowser.getPagingHtml(query, result.TotalRecordCount);
}
if (view == "Poster") {
@@ -188,7 +163,7 @@
}
if (showPaging) {
- html += getPagingHtml(result);
+ html += LibraryBrowser.getPagingHtml(query, result.TotalRecordCount);
}
var elem = $('#items', page);
diff --git a/dashboard-ui/scripts/tvshows.js b/dashboard-ui/scripts/tvshows.js
index 0e637014ab..26d716f47c 100644
--- a/dashboard-ui/scripts/tvshows.js
+++ b/dashboard-ui/scripts/tvshows.js
@@ -1,159 +1,184 @@
(function ($, document) {
- // The base query options
- var query = {
+ // The base query options
+ var query = {
- SortBy: "SortName",
- SortOrder: "Ascending",
- IncludeItemTypes: "Series",
- Recursive: true,
- Fields: "PrimaryImageAspectRatio,SeriesInfo"
- };
+ SortBy: "SortName",
+ SortOrder: "Ascending",
+ IncludeItemTypes: "Series",
+ Recursive: true,
+ Fields: "PrimaryImageAspectRatio,SeriesInfo"
+ };
- function getTableHtml(items) {
+ function getTableHtml(items) {
- var html = '
';
+ var html = '
';
- html += '';
+ html += '';
- html += '
';
- html += '
';
- html += '
Name
';
- html += '
Year
';
- html += '
Official Rating
';
- html += '
Runtime
';
- html += '
Community Rating
';
- html += '
';
+ html += '
';
+ html += '
';
+ html += '
Name
';
+ html += '
Year
';
+ html += '
Official Rating
';
+ html += '
Runtime
';
+ html += '
Community Rating
';
+ html += '
';
- html += '';
+ html += '';
- html += '';
+ html += '';
- for (var i = 0, length = items.length; i < length; i++) {
+ for (var i = 0, length = items.length; i < length; i++) {
- html += getRowHtml(items[i]);
- }
+ html += getRowHtml(items[i]);
+ }
- html += '';
+ html += '';
- html += '
';
+ html += '
';
- return html;
- }
+ return html;
+ }
- function getRowHtml(item) {
+ function getRowHtml(item) {
- var html = '