From cb3107a2b6fa0ad044b253e3c382eb84472274bb Mon Sep 17 00:00:00 2001 From: Luke Pulverenti Date: Sat, 27 Apr 2013 18:52:41 -0400 Subject: [PATCH] added page size selection --- dashboard-ui/css/librarybrowser.css | 14 ++++++++- dashboard-ui/scripts/boxsets.js | 6 ++++ dashboard-ui/scripts/gamegenrepage.js | 6 ++++ dashboard-ui/scripts/gamespage.js | 6 ++++ dashboard-ui/scripts/gamestudiospage.js | 6 ++++ dashboard-ui/scripts/gamesystemspage.js | 6 ++++ dashboard-ui/scripts/itembynamedetailpage.js | 6 ++++ dashboard-ui/scripts/itemlistpage.js | 6 ++++ dashboard-ui/scripts/librarybrowser.js | 31 +++++++++++++++++--- dashboard-ui/scripts/moviegenres.js | 6 ++++ dashboard-ui/scripts/moviepeople.js | 6 ++++ dashboard-ui/scripts/movies.js | 6 ++++ dashboard-ui/scripts/moviestudios.js | 6 ++++ dashboard-ui/scripts/movietrailers.js | 6 ++++ dashboard-ui/scripts/musicalbums.js | 6 ++++ dashboard-ui/scripts/musicartists.js | 6 ++++ dashboard-ui/scripts/musicgenres.js | 6 ++++ dashboard-ui/scripts/songs.js | 6 ++++ dashboard-ui/scripts/tvgenres.js | 6 ++++ dashboard-ui/scripts/tvpeople.js | 6 ++++ dashboard-ui/scripts/tvshows.js | 6 ++++ dashboard-ui/scripts/tvstudios.js | 6 ++++ dashboard-ui/songs.html | 4 +-- 23 files changed, 162 insertions(+), 7 deletions(-) diff --git a/dashboard-ui/css/librarybrowser.css b/dashboard-ui/css/librarybrowser.css index ed9da01108..46d6c09676 100644 --- a/dashboard-ui/css/librarybrowser.css +++ b/dashboard-ui/css/librarybrowser.css @@ -56,6 +56,14 @@ margin: .5em 0 .25em; } +.labelPageSize { + margin-left: 1em; +} + +.labelPageSize, .selectPageSize { + display: none; +} + @media all and (min-width: 650px) { .libraryPage .ui-content { padding: 10px 20px 100px; @@ -68,6 +76,10 @@ .viewControls + .listTopPaging { margin-left: 1em; } + + .labelPageSize, .selectPageSize { + display: inline; + } } @media all and (min-width: 750px) { @@ -538,4 +550,4 @@ .itemsContainer { text-align: center; -} \ No newline at end of file +} diff --git a/dashboard-ui/scripts/boxsets.js b/dashboard-ui/scripts/boxsets.js index f1db319234..2adf2bbd2f 100644 --- a/dashboard-ui/scripts/boxsets.js +++ b/dashboard-ui/scripts/boxsets.js @@ -48,6 +48,12 @@ reloadItems(page); }); + $('.selectPageSize', page).on('change', function () { + query.Limit = parseInt(this.value); + query.StartIndex = 0; + reloadItems(page); + }); + Dashboard.hideLoadingMsg(); }); } diff --git a/dashboard-ui/scripts/gamegenrepage.js b/dashboard-ui/scripts/gamegenrepage.js index e6517bcd98..89f3f054cc 100644 --- a/dashboard-ui/scripts/gamegenrepage.js +++ b/dashboard-ui/scripts/gamegenrepage.js @@ -48,6 +48,12 @@ reloadItems(page); }); + $('.selectPageSize', page).on('change', function () { + query.Limit = parseInt(this.value); + query.StartIndex = 0; + reloadItems(page); + }); + Dashboard.hideLoadingMsg(); }); } diff --git a/dashboard-ui/scripts/gamespage.js b/dashboard-ui/scripts/gamespage.js index f988c7296d..927f7ecb48 100644 --- a/dashboard-ui/scripts/gamespage.js +++ b/dashboard-ui/scripts/gamespage.js @@ -58,6 +58,12 @@ reloadItems(page); }); + $('.selectPageSize', page).on('change', function () { + query.Limit = parseInt(this.value); + query.StartIndex = 0; + reloadItems(page); + }); + Dashboard.hideLoadingMsg(); }); } diff --git a/dashboard-ui/scripts/gamestudiospage.js b/dashboard-ui/scripts/gamestudiospage.js index f62a806e55..267c79c434 100644 --- a/dashboard-ui/scripts/gamestudiospage.js +++ b/dashboard-ui/scripts/gamestudiospage.js @@ -48,6 +48,12 @@ reloadItems(page); }); + $('.selectPageSize', page).on('change', function () { + query.Limit = parseInt(this.value); + query.StartIndex = 0; + reloadItems(page); + }); + Dashboard.hideLoadingMsg(); }); } diff --git a/dashboard-ui/scripts/gamesystemspage.js b/dashboard-ui/scripts/gamesystemspage.js index f0e819e261..40d62530da 100644 --- a/dashboard-ui/scripts/gamesystemspage.js +++ b/dashboard-ui/scripts/gamesystemspage.js @@ -48,6 +48,12 @@ reloadItems(page); }); + $('.selectPageSize', page).on('change', function () { + query.Limit = parseInt(this.value); + query.StartIndex = 0; + reloadItems(page); + }); + Dashboard.hideLoadingMsg(); }); } diff --git a/dashboard-ui/scripts/itembynamedetailpage.js b/dashboard-ui/scripts/itembynamedetailpage.js index ab8fec3fbe..837c8c6f23 100644 --- a/dashboard-ui/scripts/itembynamedetailpage.js +++ b/dashboard-ui/scripts/itembynamedetailpage.js @@ -422,6 +422,12 @@ loadItems(page, query); }); + $('.selectPageSize', page).on('change', function () { + query.Limit = parseInt(this.value); + query.StartIndex = 0; + loadItems(page); + }); + Dashboard.hideLoadingMsg(); }); } diff --git a/dashboard-ui/scripts/itemlistpage.js b/dashboard-ui/scripts/itemlistpage.js index ddd7c01c24..59e663539b 100644 --- a/dashboard-ui/scripts/itemlistpage.js +++ b/dashboard-ui/scripts/itemlistpage.js @@ -57,6 +57,12 @@ reloadItems(page); }); + $('.selectPageSize', page).on('change', function () { + query.Limit = parseInt(this.value); + query.StartIndex = 0; + reloadItems(page); + }); + Dashboard.hideLoadingMsg(); }); diff --git a/dashboard-ui/scripts/librarybrowser.js b/dashboard-ui/scripts/librarybrowser.js index a2966509fb..d5b60c11fc 100644 --- a/dashboard-ui/scripts/librarybrowser.js +++ b/dashboard-ui/scripts/librarybrowser.js @@ -253,7 +253,7 @@ if (item.Artists && item.Artists.length) { var artist = item.Artists[0]; - + html += '' + artist + ''; } else { html += ''; @@ -283,7 +283,7 @@ } itemByNameContext = itemByNameContext || ""; - + // Handle search hints var id = item.Id || item.ItemId; @@ -652,6 +652,29 @@ html += ''; html += ''; + + var id = "selectPageSize" + new Date().getTime(); + + var options = ''; + + function getOption(val) { + + if (query.Limit == val) { + + return ''; + + } else { + return ''; + } + } + + options += getOption(20); + options += getOption(50); + options += getOption(100); + options += getOption(200); + options += getOption(300); + + html += ''; } html += ''; @@ -1372,7 +1395,7 @@ html += '
'; html += ''; html += ''; html += '
'; @@ -1383,7 +1406,7 @@ maxwidth: lightboxWidth, tag: tag - + }) + '" />'; html += ''; diff --git a/dashboard-ui/scripts/moviegenres.js b/dashboard-ui/scripts/moviegenres.js index bed499bf67..7854e81717 100644 --- a/dashboard-ui/scripts/moviegenres.js +++ b/dashboard-ui/scripts/moviegenres.js @@ -48,6 +48,12 @@ reloadItems(page); }); + $('.selectPageSize', page).on('change', function () { + query.Limit = parseInt(this.value); + query.StartIndex = 0; + reloadItems(page); + }); + Dashboard.hideLoadingMsg(); }); } diff --git a/dashboard-ui/scripts/moviepeople.js b/dashboard-ui/scripts/moviepeople.js index 93cb7549d0..e1909afe4f 100644 --- a/dashboard-ui/scripts/moviepeople.js +++ b/dashboard-ui/scripts/moviepeople.js @@ -49,6 +49,12 @@ reloadItems(page); }); + $('.selectPageSize', page).on('change', function () { + query.Limit = parseInt(this.value); + query.StartIndex = 0; + reloadItems(page); + }); + Dashboard.hideLoadingMsg(); }); } diff --git a/dashboard-ui/scripts/movies.js b/dashboard-ui/scripts/movies.js index 16d1760af6..38509a2d89 100644 --- a/dashboard-ui/scripts/movies.js +++ b/dashboard-ui/scripts/movies.js @@ -60,6 +60,12 @@ reloadItems(page); }); + $('.selectPageSize', page).on('change', function () { + query.Limit = parseInt(this.value); + query.StartIndex = 0; + reloadItems(page); + }); + Dashboard.hideLoadingMsg(); }); } diff --git a/dashboard-ui/scripts/moviestudios.js b/dashboard-ui/scripts/moviestudios.js index eb57f50fb1..c4212640aa 100644 --- a/dashboard-ui/scripts/moviestudios.js +++ b/dashboard-ui/scripts/moviestudios.js @@ -48,6 +48,12 @@ reloadItems(page); }); + $('.selectPageSize', page).on('change', function () { + query.Limit = parseInt(this.value); + query.StartIndex = 0; + reloadItems(page); + }); + Dashboard.hideLoadingMsg(); }); } diff --git a/dashboard-ui/scripts/movietrailers.js b/dashboard-ui/scripts/movietrailers.js index 3bb24a8f62..fc21b0514a 100644 --- a/dashboard-ui/scripts/movietrailers.js +++ b/dashboard-ui/scripts/movietrailers.js @@ -58,6 +58,12 @@ reloadItems(page); }); + $('.selectPageSize', page).on('change', function () { + query.Limit = parseInt(this.value); + query.StartIndex = 0; + reloadItems(page); + }); + Dashboard.hideLoadingMsg(); }); } diff --git a/dashboard-ui/scripts/musicalbums.js b/dashboard-ui/scripts/musicalbums.js index f1bc15eefb..f9e4ce3baa 100644 --- a/dashboard-ui/scripts/musicalbums.js +++ b/dashboard-ui/scripts/musicalbums.js @@ -48,6 +48,12 @@ reloadItems(page); }); + $('.selectPageSize', page).on('change', function () { + query.Limit = parseInt(this.value); + query.StartIndex = 0; + reloadItems(page); + }); + Dashboard.hideLoadingMsg(); }); } diff --git a/dashboard-ui/scripts/musicartists.js b/dashboard-ui/scripts/musicartists.js index 20d242a21f..b57e5c404c 100644 --- a/dashboard-ui/scripts/musicartists.js +++ b/dashboard-ui/scripts/musicartists.js @@ -48,6 +48,12 @@ reloadItems(page); }); + $('.selectPageSize', page).on('change', function () { + query.Limit = parseInt(this.value); + query.StartIndex = 0; + reloadItems(page); + }); + Dashboard.hideLoadingMsg(); }); } diff --git a/dashboard-ui/scripts/musicgenres.js b/dashboard-ui/scripts/musicgenres.js index 4c581eb846..30f7ecd6ce 100644 --- a/dashboard-ui/scripts/musicgenres.js +++ b/dashboard-ui/scripts/musicgenres.js @@ -48,6 +48,12 @@ reloadItems(page); }); + $('.selectPageSize', page).on('change', function () { + query.Limit = parseInt(this.value); + query.StartIndex = 0; + reloadItems(page); + }); + Dashboard.hideLoadingMsg(); }); } diff --git a/dashboard-ui/scripts/songs.js b/dashboard-ui/scripts/songs.js index 3874e0860b..c67084daff 100644 --- a/dashboard-ui/scripts/songs.js +++ b/dashboard-ui/scripts/songs.js @@ -46,6 +46,12 @@ reloadItems(page); }); + $('.selectPageSize', page).on('change', function () { + query.Limit = parseInt(this.value); + query.StartIndex = 0; + reloadItems(page); + }); + Dashboard.hideLoadingMsg(); }); } diff --git a/dashboard-ui/scripts/tvgenres.js b/dashboard-ui/scripts/tvgenres.js index 428b5712e4..82875a2e17 100644 --- a/dashboard-ui/scripts/tvgenres.js +++ b/dashboard-ui/scripts/tvgenres.js @@ -48,6 +48,12 @@ reloadItems(page); }); + $('.selectPageSize', page).on('change', function () { + query.Limit = parseInt(this.value); + query.StartIndex = 0; + reloadItems(page); + }); + Dashboard.hideLoadingMsg(); }); } diff --git a/dashboard-ui/scripts/tvpeople.js b/dashboard-ui/scripts/tvpeople.js index 3058717656..5905d57903 100644 --- a/dashboard-ui/scripts/tvpeople.js +++ b/dashboard-ui/scripts/tvpeople.js @@ -49,6 +49,12 @@ reloadItems(page); }); + $('.selectPageSize', page).on('change', function () { + query.Limit = parseInt(this.value); + query.StartIndex = 0; + reloadItems(page); + }); + Dashboard.hideLoadingMsg(); }); } diff --git a/dashboard-ui/scripts/tvshows.js b/dashboard-ui/scripts/tvshows.js index f3cd8cd6cd..af0d746cbc 100644 --- a/dashboard-ui/scripts/tvshows.js +++ b/dashboard-ui/scripts/tvshows.js @@ -59,6 +59,12 @@ reloadItems(page); }); + $('.selectPageSize', page).on('change', function () { + query.Limit = parseInt(this.value); + query.StartIndex = 0; + reloadItems(page); + }); + Dashboard.hideLoadingMsg(); }); } diff --git a/dashboard-ui/scripts/tvstudios.js b/dashboard-ui/scripts/tvstudios.js index 38a846c4f4..fe2eed28d9 100644 --- a/dashboard-ui/scripts/tvstudios.js +++ b/dashboard-ui/scripts/tvstudios.js @@ -48,6 +48,12 @@ reloadItems(page); }); + $('.selectPageSize', page).on('change', function () { + query.Limit = parseInt(this.value); + query.StartIndex = 0; + reloadItems(page); + }); + Dashboard.hideLoadingMsg(); }); } diff --git a/dashboard-ui/songs.html b/dashboard-ui/songs.html index 6deafeb86d..0d4147df7b 100644 --- a/dashboard-ui/songs.html +++ b/dashboard-ui/songs.html @@ -33,8 +33,8 @@ Sort By: - - + +