diff --git a/dashboard-ui/css/librarybrowser.css b/dashboard-ui/css/librarybrowser.css index d3293ed275..cc8e0d5b37 100644 --- a/dashboard-ui/css/librarybrowser.css +++ b/dashboard-ui/css/librarybrowser.css @@ -637,7 +637,7 @@ a.itemTag:hover { top: 0; right: 0; text-align: center; - padding: 3px 10px; + padding: 3px 5px; border-bottom-left-radius: 10px; color: #fff; background: rgb(0, 143, 187); diff --git a/dashboard-ui/scripts/boxsets.js b/dashboard-ui/scripts/boxsets.js index caedcf102f..f341bc0b13 100644 --- a/dashboard-ui/scripts/boxsets.js +++ b/dashboard-ui/scripts/boxsets.js @@ -24,6 +24,8 @@ $('.listTopPaging', page).html(LibraryBrowser.getPagingHtml(query, result.TotalRecordCount, true)).trigger('create'); + updateFilterControls(page); + var checkSortOption = $('.radioSortBy:checked', page); $('.viewSummary', page).html(LibraryBrowser.getViewSummaryHtml(query, checkSortOption)).trigger('create'); @@ -37,7 +39,11 @@ $('#items', page).html(html).trigger('create'); $('.btnChangeToDefaultSort', page).on('click', function () { - $('.defaultSort', page)[0].click(); + query.StartIndex = 0; + query.SortOrder = 'Ascending'; + query.SortBy = $('.defaultSort', page).data('sortby'); + + reloadItems(page); }); $('.selectPage', page).on('change', function () { @@ -61,12 +67,43 @@ reloadItems(page); }); - LibraryBrowser.saveQueryValues('boxsets', query); - + LibraryBrowser.saveQueryValues('boxsets', query); + Dashboard.hideLoadingMsg(); }); } + function updateFilterControls(page) { + + // Reset form values using the last used query + $('.radioSortBy', page).each(function () { + + this.checked = (query.SortBy || '').toLowerCase() == this.getAttribute('data-sortby').toLowerCase(); + + }).checkboxradio('refresh'); + + $('.radioSortOrder', page).each(function () { + + this.checked = (query.SortOrder || '').toLowerCase() == this.getAttribute('data-sortorder').toLowerCase(); + + }).checkboxradio('refresh'); + + $('.chkStandardFilter', page).each(function () { + + var filters = "," + (query.Filters || ""); + var filterName = this.getAttribute('data-filter'); + + this.checked = filters.indexOf(',' + filterName) != -1; + + }).checkboxradio('refresh'); + + $('#chkTrailer', page).checked(query.HasTrailer == true).checkboxradio('refresh'); + $('#chkThemeSong', page).checked(query.HasThemeSong == true).checkboxradio('refresh'); + $('#chkThemeVideo', page).checked(query.HasThemeVideo == true).checkboxradio('refresh'); + + $('.alphabetPicker', page).alphaValue(query.NameStartsWithOrGreater); + } + $(document).on('pageinit', "#boxsetsPage", function () { var page = this; @@ -152,33 +189,7 @@ }).on('pageshow', "#boxsetsPage", function () { - // Reset form values using the last used query - $('.radioSortBy', this).each(function () { - - this.checked = (query.SortBy || '').toLowerCase() == this.getAttribute('data-sortby').toLowerCase(); - - }).checkboxradio('refresh'); - - $('.radioSortOrder', this).each(function () { - - this.checked = (query.SortOrder || '').toLowerCase() == this.getAttribute('data-sortorder').toLowerCase(); - - }).checkboxradio('refresh'); - - $('.chkStandardFilter', this).each(function () { - - var filters = "," + (query.Filters || ""); - var filterName = this.getAttribute('data-filter'); - - this.checked = filters.indexOf(',' + filterName) != -1; - - }).checkboxradio('refresh'); - - $('#chkTrailer', this).checked(query.HasTrailer == true).checkboxradio('refresh'); - $('#chkThemeSong', this).checked(query.HasThemeSong == true).checkboxradio('refresh'); - $('#chkThemeVideo', this).checked(query.HasThemeVideo == true).checkboxradio('refresh'); - - $('.alphabetPicker', this).alphaValue(query.NameStartsWithOrGreater); + updateFilterControls(this); }); })(jQuery, document); \ No newline at end of file diff --git a/dashboard-ui/scripts/episodes.js b/dashboard-ui/scripts/episodes.js index 619ba81175..037b4a4f1c 100644 --- a/dashboard-ui/scripts/episodes.js +++ b/dashboard-ui/scripts/episodes.js @@ -26,6 +26,8 @@ $('.listTopPaging', page).html(LibraryBrowser.getPagingHtml(query, result.TotalRecordCount, true)).trigger('create'); + updateFilterControls(); + var checkSortOption = $('.radioSortBy:checked', page); $('.viewSummary', page).html(LibraryBrowser.getViewSummaryHtml(query, checkSortOption)).trigger('create'); @@ -43,7 +45,12 @@ $('#items', page).html(html).trigger('create'); $('.btnChangeToDefaultSort', page).on('click', function () { - $('.defaultSort', page)[0].click(); + + query.StartIndex = 0; + query.SortOrder = 'Ascending'; + query.SortBy = $('.defaultSort', page).data('sortby'); + + reloadItems(page); }); $('.selectPage', page).on('change', function () { @@ -75,6 +82,54 @@ }); } + function updateFilterControls(page) { + + + // Reset form values using the last used query + $('.radioSortBy', page).each(function () { + + this.checked = (query.SortBy || '').toLowerCase() == this.getAttribute('data-sortby').toLowerCase(); + + }).checkboxradio('refresh'); + + $('.radioSortOrder', page).each(function () { + + this.checked = (query.SortOrder || '').toLowerCase() == this.getAttribute('data-sortorder').toLowerCase(); + + }).checkboxradio('refresh'); + + $('.chkStandardFilter', page).each(function () { + + var filters = "," + (query.Filters || ""); + var filterName = this.getAttribute('data-filter'); + + this.checked = filters.toLowerCase().indexOf(',' + filterName.toLowerCase()) != -1; + + }).checkboxradio('refresh'); + + $('.chkVideoTypeFilter', page).each(function () { + + var filters = "," + (query.VideoTypes || ""); + var filterName = this.getAttribute('data-filter'); + + this.checked = filters.indexOf(',' + filterName) != -1; + + }).checkboxradio('refresh'); + + $('#chk3D', page).checked(query.Is3D == true).checkboxradio('refresh'); + + $('#chkSubtitle', page).checked(query.HasSubtitles == true).checkboxradio('refresh'); + $('#chkTrailer', page).checked(query.HasTrailer == true).checkboxradio('refresh'); + $('#chkThemeSong', page).checked(query.HasThemeSong == true).checkboxradio('refresh'); + $('#chkThemeVideo', page).checked(query.HasThemeVideo == true).checkboxradio('refresh'); + $('#chkSpecialFeature', page).checked(query.ParentIndexNumber == 0).checkboxradio('refresh'); + + $('#chkMissingEpisode', page).checked(query.MaxPremiereDate != null).checkboxradio('refresh'); + $('#chkFutureEpisode', page).checked(query.MinPremiereDate != null).checkboxradio('refresh'); + + $('.alphabetPicker', page).alphaValue(query.NameStartsWithOrGreater); + } + function formatDigit(i) { return i < 10 ? "0" + i : i; } @@ -188,7 +243,7 @@ $('#chkMissingEpisode', this).on('change', function () { var futureChecked = $('#chkFutureEpisode', page).checked(); - + query.LocationTypes = this.checked || futureChecked ? "virtual" : null; query.HasPremiereDate = this.checked || futureChecked ? true : null; query.MaxPremiereDate = this.checked ? getDateFormat(new Date()) : null; @@ -230,7 +285,7 @@ query.Limit = limit; query.StartIndex = 0; } - + LibraryBrowser.loadSavedQueryValues('episodes', query); var filters = getParameterByName('filters'); @@ -252,50 +307,7 @@ }).on('pageshow', "#episodesPage", function () { - // Reset form values using the last used query - $('.radioSortBy', this).each(function () { - - this.checked = (query.SortBy || '').toLowerCase() == this.getAttribute('data-sortby').toLowerCase(); - - }).checkboxradio('refresh'); - - $('.radioSortOrder', this).each(function () { - - this.checked = (query.SortOrder || '').toLowerCase() == this.getAttribute('data-sortorder').toLowerCase(); - - }).checkboxradio('refresh'); - - $('.chkStandardFilter', this).each(function () { - - var filters = "," + (query.Filters || ""); - var filterName = this.getAttribute('data-filter'); - - this.checked = filters.toLowerCase().indexOf(',' + filterName.toLowerCase()) != -1; - - }).checkboxradio('refresh'); - - $('.chkVideoTypeFilter', this).each(function () { - - var filters = "," + (query.VideoTypes || ""); - var filterName = this.getAttribute('data-filter'); - - this.checked = filters.indexOf(',' + filterName) != -1; - - }).checkboxradio('refresh'); - - $('#chk3D', this).checked(query.Is3D == true).checkboxradio('refresh'); - - $('#chkSubtitle', this).checked(query.HasSubtitles == true).checkboxradio('refresh'); - $('#chkTrailer', this).checked(query.HasTrailer == true).checkboxradio('refresh'); - $('#chkThemeSong', this).checked(query.HasThemeSong == true).checkboxradio('refresh'); - $('#chkThemeVideo', this).checked(query.HasThemeVideo == true).checkboxradio('refresh'); - $('#chkSpecialFeature', this).checked(query.ParentIndexNumber == 0).checkboxradio('refresh'); - - $('#chkMissingEpisode', this).checked(query.MaxPremiereDate != null).checkboxradio('refresh'); - $('#chkFutureEpisode', this).checked(query.MinPremiereDate != null).checkboxradio('refresh'); - - $('.alphabetPicker', this).alphaValue(query.NameStartsWithOrGreater); - + updateFilterControls(this); }); })(jQuery, document); \ No newline at end of file diff --git a/dashboard-ui/scripts/gamegenrepage.js b/dashboard-ui/scripts/gamegenrepage.js index 7f92d489c5..d29f35847a 100644 --- a/dashboard-ui/scripts/gamegenrepage.js +++ b/dashboard-ui/scripts/gamegenrepage.js @@ -23,6 +23,8 @@ $('.listTopPaging', page).html(LibraryBrowser.getPagingHtml(query, result.TotalRecordCount, true)).trigger('create'); + updateFilterControls(page); + var checkSortOption = $('.radioSortBy:checked', page); $('.viewSummary', page).html(LibraryBrowser.getViewSummaryHtml(query, checkSortOption)).trigger('create'); @@ -36,7 +38,11 @@ $('#items', page).html(html).trigger('create'); $('.btnChangeToDefaultSort', page).on('click', function () { - $('.defaultSort', page)[0].click(); + query.StartIndex = 0; + query.SortOrder = 'Ascending'; + query.SortBy = $('.defaultSort', page).data('sortby'); + + reloadItems(page); }); $('.selectPage', page).on('change', function () { @@ -60,12 +66,28 @@ reloadItems(page); }); - LibraryBrowser.saveQueryValues('gamegenres', query); - + LibraryBrowser.saveQueryValues('gamegenres', query); + Dashboard.hideLoadingMsg(); }); } + function updateFilterControls(page) { + + // Reset form values using the last used query + $('.radioSortBy', page).each(function () { + + this.checked = (query.SortBy || '').toLowerCase() == this.getAttribute('data-sortby').toLowerCase(); + + }).checkboxradio('refresh'); + + $('.radioSortOrder', page).each(function () { + + this.checked = (query.SortOrder || '').toLowerCase() == this.getAttribute('data-sortorder').toLowerCase(); + + }).checkboxradio('refresh'); + } + $(document).on('pageinit', "#gameGenresPage", function () { var page = this; @@ -115,18 +137,7 @@ }).on('pageshow', "#gameGenresPage", function () { - // Reset form values using the last used query - $('.radioSortBy', this).each(function () { - - this.checked = (query.SortBy || '').toLowerCase() == this.getAttribute('data-sortby').toLowerCase(); - - }).checkboxradio('refresh'); - - $('.radioSortOrder', this).each(function () { - - this.checked = (query.SortOrder || '').toLowerCase() == this.getAttribute('data-sortorder').toLowerCase(); - - }).checkboxradio('refresh'); + updateFilterControls(this); }); })(jQuery, document); \ No newline at end of file diff --git a/dashboard-ui/scripts/gamespage.js b/dashboard-ui/scripts/gamespage.js index 1991714194..e51c2af8e4 100644 --- a/dashboard-ui/scripts/gamespage.js +++ b/dashboard-ui/scripts/gamespage.js @@ -27,6 +27,8 @@ $('.listTopPaging', page).html(LibraryBrowser.getPagingHtml(query, result.TotalRecordCount, true)).trigger('create'); + updateFilterControls(page); + var checkSortOption = $('.radioSortBy:checked', page); $('.viewSummary', page).html(LibraryBrowser.getViewSummaryHtml(query, checkSortOption)).trigger('create'); @@ -62,7 +64,11 @@ $('#items', page).html(html).trigger('create'); $('.btnChangeToDefaultSort', page).on('click', function () { - $('.defaultSort', page)[0].click(); + query.StartIndex = 0; + query.SortOrder = 'Ascending'; + query.SortBy = $('.defaultSort', page).data('sortby'); + + reloadItems(page); }); $('.selectPage', page).on('change', function () { @@ -86,12 +92,58 @@ reloadItems(page); }); - LibraryBrowser.saveQueryValues('games', query); - + LibraryBrowser.saveQueryValues('games', query); + Dashboard.hideLoadingMsg(); }); } + function updateFilterControls(page) { + + // Reset form values using the last used query + $('.radioSortBy', page).each(function () { + + this.checked = (query.SortBy || '').toLowerCase() == this.getAttribute('data-sortby').toLowerCase(); + + }).checkboxradio('refresh'); + + $('.radioSortOrder', page).each(function () { + + this.checked = (query.SortOrder || '').toLowerCase() == this.getAttribute('data-sortorder').toLowerCase(); + + }).checkboxradio('refresh'); + + $('.radioPlayers', page).each(function () { + + var val = this.getAttribute('data-value'); + + if (val == "all") { + + this.checked = query.MinPlayers == null; + } else { + this.checked = query.MinPlayers == val; + } + + }).checkboxradio('refresh'); + + $('.chkStandardFilter', page).each(function () { + + var filters = "," + (query.Filters || ""); + var filterName = this.getAttribute('data-filter'); + + this.checked = filters.indexOf(',' + filterName) != -1; + + }).checkboxradio('refresh'); + + $('#selectView', page).val(view).selectmenu('refresh'); + + $('#chkTrailer', page).checked(query.HasTrailer == true).checkboxradio('refresh'); + $('#chkThemeSong', page).checked(query.HasThemeSong == true).checkboxradio('refresh'); + $('#chkThemeVideo', page).checked(query.HasThemeVideo == true).checkboxradio('refresh'); + + $('.alphabetPicker', page).alphaValue(query.NameStartsWith); + } + $(document).on('pageinit', "#gamesPage", function () { var page = this; @@ -109,13 +161,13 @@ }); $('.radioPlayers', this).on('click', function () { - + query.StartIndex = 0; var val = this.getAttribute('data-value'); query.MinPlayers = val == "all" ? null : val; - + reloadItems(page); }); @@ -205,49 +257,7 @@ }).on('pageshow', "#gamesPage", function () { - - // Reset form values using the last used query - $('.radioSortBy', this).each(function () { - - this.checked = (query.SortBy || '').toLowerCase() == this.getAttribute('data-sortby').toLowerCase(); - - }).checkboxradio('refresh'); - - $('.radioSortOrder', this).each(function () { - - this.checked = (query.SortOrder || '').toLowerCase() == this.getAttribute('data-sortorder').toLowerCase(); - - }).checkboxradio('refresh'); - - $('.radioPlayers', this).each(function () { - - var val = this.getAttribute('data-value'); - - if (val == "all") { - - this.checked = query.MinPlayers == null; - } else { - this.checked = query.MinPlayers == val; - } - - }).checkboxradio('refresh'); - - $('.chkStandardFilter', this).each(function () { - - var filters = "," + (query.Filters || ""); - var filterName = this.getAttribute('data-filter'); - - this.checked = filters.indexOf(',' + filterName) != -1; - - }).checkboxradio('refresh'); - - $('#selectView', this).val(view).selectmenu('refresh'); - - $('#chkTrailer', this).checked(query.HasTrailer == true).checkboxradio('refresh'); - $('#chkThemeSong', this).checked(query.HasThemeSong == true).checkboxradio('refresh'); - $('#chkThemeVideo', this).checked(query.HasThemeVideo == true).checkboxradio('refresh'); - - $('.alphabetPicker', this).alphaValue(query.NameStartsWith); + updateFilterControls(this); }); })(jQuery, document); \ No newline at end of file diff --git a/dashboard-ui/scripts/gamestudiospage.js b/dashboard-ui/scripts/gamestudiospage.js index 0beeba2d1f..2b5ee7dd4f 100644 --- a/dashboard-ui/scripts/gamestudiospage.js +++ b/dashboard-ui/scripts/gamestudiospage.js @@ -24,6 +24,8 @@ $('.listTopPaging', page).html(LibraryBrowser.getPagingHtml(query, result.TotalRecordCount, true)).trigger('create'); + updateFilterControls(page); + var checkSortOption = $('.radioSortBy:checked', page); $('.viewSummary', page).html(LibraryBrowser.getViewSummaryHtml(query, checkSortOption)).trigger('create'); @@ -37,7 +39,11 @@ $('#items', page).html(html).trigger('create'); $('.btnChangeToDefaultSort', page).on('click', function () { - $('.defaultSort', page)[0].click(); + query.StartIndex = 0; + query.SortOrder = 'Ascending'; + query.SortBy = $('.defaultSort', page).data('sortby'); + + reloadItems(page); }); $('.selectPage', page).on('change', function () { @@ -60,13 +66,29 @@ query.StartIndex = 0; reloadItems(page); }); - - LibraryBrowser.saveQueryValues('gamestudios', query); + + LibraryBrowser.saveQueryValues('gamestudios', query); Dashboard.hideLoadingMsg(); }); } + function updateFilterControls(page) { + + // Reset form values using the last used query + $('.radioSortBy', page).each(function () { + + this.checked = (query.SortBy || '').toLowerCase() == this.getAttribute('data-sortby').toLowerCase(); + + }).checkboxradio('refresh'); + + $('.radioSortOrder', page).each(function () { + + this.checked = (query.SortOrder || '').toLowerCase() == this.getAttribute('data-sortorder').toLowerCase(); + + }).checkboxradio('refresh'); + } + $(document).on('pageinit', "#gameStudiosPage", function () { var page = this; @@ -116,19 +138,7 @@ }).on('pageshow', "#gameStudiosPage", function () { - // Reset form values using the last used query - $('.radioSortBy', this).each(function () { - - this.checked = (query.SortBy || '').toLowerCase() == this.getAttribute('data-sortby').toLowerCase(); - - }).checkboxradio('refresh'); - - $('.radioSortOrder', this).each(function () { - - this.checked = (query.SortOrder || '').toLowerCase() == this.getAttribute('data-sortorder').toLowerCase(); - - }).checkboxradio('refresh'); - + updateFilterControls(this); }); })(jQuery, document); \ No newline at end of file diff --git a/dashboard-ui/scripts/gamesystemspage.js b/dashboard-ui/scripts/gamesystemspage.js index c3ada8a30e..78210f571b 100644 --- a/dashboard-ui/scripts/gamesystemspage.js +++ b/dashboard-ui/scripts/gamesystemspage.js @@ -25,6 +25,8 @@ $('.listTopPaging', page).html(LibraryBrowser.getPagingHtml(query, result.TotalRecordCount, true)).trigger('create'); + updateFilterControls(page); + var checkSortOption = $('.radioSortBy:checked', page); $('.viewSummary', page).html(LibraryBrowser.getViewSummaryHtml(query, checkSortOption)).trigger('create'); @@ -39,7 +41,11 @@ $('#items', page).html(html).trigger('create'); $('.btnChangeToDefaultSort', page).on('click', function () { - $('.defaultSort', page)[0].click(); + query.StartIndex = 0; + query.SortOrder = 'Ascending'; + query.SortBy = $('.defaultSort', page).data('sortby'); + + reloadItems(page); }); $('.selectPage', page).on('change', function () { @@ -63,12 +69,37 @@ reloadItems(page); }); - LibraryBrowser.saveQueryValues('gamesystems', query); - + LibraryBrowser.saveQueryValues('gamesystems', query); + Dashboard.hideLoadingMsg(); }); } + function updateFilterControls(page) { + + // Reset form values using the last used query + $('.radioSortBy', page).each(function () { + + this.checked = (query.SortBy || '').toLowerCase() == this.getAttribute('data-sortby').toLowerCase(); + + }).checkboxradio('refresh'); + + $('.radioSortOrder', page).each(function () { + + this.checked = (query.SortOrder || '').toLowerCase() == this.getAttribute('data-sortorder').toLowerCase(); + + }).checkboxradio('refresh'); + + $('.chkStandardFilter', page).each(function () { + + var filters = "," + (query.Filters || ""); + var filterName = this.getAttribute('data-filter'); + + this.checked = filters.indexOf(',' + filterName) != -1; + + }).checkboxradio('refresh'); + } + $(document).on('pageinit', "#gamesystemsPage", function () { var page = this; @@ -116,27 +147,7 @@ }).on('pageshow', "#gamesystemsPage", function () { - // Reset form values using the last used query - $('.radioSortBy', this).each(function () { - - this.checked = (query.SortBy || '').toLowerCase() == this.getAttribute('data-sortby').toLowerCase(); - - }).checkboxradio('refresh'); - - $('.radioSortOrder', this).each(function () { - - this.checked = (query.SortOrder || '').toLowerCase() == this.getAttribute('data-sortorder').toLowerCase(); - - }).checkboxradio('refresh'); - - $('.chkStandardFilter', this).each(function () { - - var filters = "," + (query.Filters || ""); - var filterName = this.getAttribute('data-filter'); - - this.checked = filters.indexOf(',' + filterName) != -1; - - }).checkboxradio('refresh'); + updateFilterControls(this); }); })(jQuery, document); diff --git a/dashboard-ui/scripts/itemlistpage.js b/dashboard-ui/scripts/itemlistpage.js index 7c800ccaa8..7d1218c85d 100644 --- a/dashboard-ui/scripts/itemlistpage.js +++ b/dashboard-ui/scripts/itemlistpage.js @@ -10,7 +10,7 @@ Fields: "DateCreated", StartIndex: 0 }; - + var currentItem; function reloadItems(page) { @@ -28,6 +28,8 @@ $('.listTopPaging', page).html(LibraryBrowser.getPagingHtml(query, result.TotalRecordCount, true)).trigger('create'); + updateFilterControls(page); + var checkSortOption = $('.radioSortBy:checked', page); $('.viewSummary', page).html(LibraryBrowser.getViewSummaryHtml(query, checkSortOption)).trigger('create'); @@ -48,7 +50,11 @@ $('#items', page).html(html).trigger('create'); $('.btnChangeToDefaultSort', page).on('click', function () { - $('.defaultSort', page)[0].click(); + query.StartIndex = 0; + query.SortOrder = 'Ascending'; + query.SortBy = $('.defaultSort', page).data('sortby'); + + reloadItems(page); }); $('.selectPage', page).on('change', function () { @@ -71,8 +77,8 @@ query.StartIndex = 0; reloadItems(page); }); - - LibraryBrowser.saveQueryValues(getParameterByName('parentId'), query); + + LibraryBrowser.saveQueryValues(getParameterByName('parentId'), query); Dashboard.hideLoadingMsg(); }); @@ -113,6 +119,35 @@ }); } + function updateFilterControls(page) { + + // Reset form values using the last used query + $('.radioSortBy', page).each(function () { + + this.checked = (query.SortBy || '').toLowerCase() == this.getAttribute('data-sortby').toLowerCase(); + + }).checkboxradio('refresh'); + + $('.radioSortOrder', page).each(function () { + + this.checked = (query.SortOrder || '').toLowerCase() == this.getAttribute('data-sortorder').toLowerCase(); + + }).checkboxradio('refresh'); + + $('.chkStandardFilter', page).each(function () { + + var filters = "," + (query.Filters || ""); + var filterName = this.getAttribute('data-filter'); + + this.checked = filters.indexOf(',' + filterName) != -1; + + }).checkboxradio('refresh'); + + $('#selectView', page).val(view).selectmenu('refresh'); + + $('.alphabetPicker', page).alphaValue(query.NameStartsWithOrGreater); + } + $(document).on('pageinit', "#itemListPage", function () { var page = this; @@ -181,36 +216,12 @@ query.SortOrder = "Ascending"; query.StartIndex = 0; query.NameStartsWithOrGreater = ''; - - LibraryBrowser.loadSavedQueryValues(getParameterByName('parentId'), query); + + LibraryBrowser.loadSavedQueryValues(getParameterByName('parentId'), query); reloadItems(this); - // Reset form values using the last used query - $('.radioSortBy', this).each(function () { - - this.checked = (query.SortBy || '').toLowerCase() == this.getAttribute('data-sortby').toLowerCase(); - - }).checkboxradio('refresh'); - - $('.radioSortOrder', this).each(function () { - - this.checked = (query.SortOrder || '').toLowerCase() == this.getAttribute('data-sortorder').toLowerCase(); - - }).checkboxradio('refresh'); - - $('.chkStandardFilter', this).each(function () { - - var filters = "," + (query.Filters || ""); - var filterName = this.getAttribute('data-filter'); - - this.checked = filters.indexOf(',' + filterName) != -1; - - }).checkboxradio('refresh'); - - $('#selectView', this).val(view).selectmenu('refresh'); - - $('.alphabetPicker', this).alphaValue(query.NameStartsWithOrGreater); + updateFilterControls(this); }).on('pagehide', "#itemListPage", function () { diff --git a/dashboard-ui/scripts/librarybrowser.js b/dashboard-ui/scripts/librarybrowser.js index fcdab652a7..824f863b70 100644 --- a/dashboard-ui/scripts/librarybrowser.js +++ b/dashboard-ui/scripts/librarybrowser.js @@ -1096,13 +1096,13 @@ getViewSummaryHtml: function (query, checkedSortOption) { var html = ''; - + return html; if (query.SortBy) { var id = checkedSortOption[0].id; var sortBy = checkedSortOption.siblings('label[for=' + id + ']').text(); - html += 'Sorted by ' + sortBy.trim().toLowerCase() + ' in ' + (query.SortOrder || 'ascending').toLowerCase() + ' order'; + html += 'Sorted by ' + sortBy.trim().toLowerCase() + ', ' + (query.SortOrder || 'ascending').toLowerCase(); if (!checkedSortOption.hasClass('defaultSort')) { html += ''; diff --git a/dashboard-ui/scripts/moviegenres.js b/dashboard-ui/scripts/moviegenres.js index bc2fe973c5..ea81b0afa9 100644 --- a/dashboard-ui/scripts/moviegenres.js +++ b/dashboard-ui/scripts/moviegenres.js @@ -24,6 +24,8 @@ $('.listTopPaging', page).html(LibraryBrowser.getPagingHtml(query, result.TotalRecordCount, true)).trigger('create'); + updateFilterControls(page); + var checkSortOption = $('.radioSortBy:checked', page); $('.viewSummary', page).html(LibraryBrowser.getViewSummaryHtml(query, checkSortOption)).trigger('create'); @@ -37,7 +39,11 @@ $('#items', page).html(html).trigger('create'); $('.btnChangeToDefaultSort', page).on('click', function () { - $('.defaultSort', page)[0].click(); + query.StartIndex = 0; + query.SortOrder = 'Ascending'; + query.SortBy = $('.defaultSort', page).data('sortby'); + + reloadItems(page); }); $('.selectPage', page).on('change', function () { @@ -60,13 +66,29 @@ query.StartIndex = 0; reloadItems(page); }); - - LibraryBrowser.saveQueryValues('moviegenres', query); + + LibraryBrowser.saveQueryValues('moviegenres', query); Dashboard.hideLoadingMsg(); }); } + function updateFilterControls(page) { + + // Reset form values using the last used query + $('.radioSortBy', page).each(function () { + + this.checked = (query.SortBy || '').toLowerCase() == this.getAttribute('data-sortby').toLowerCase(); + + }).checkboxradio('refresh'); + + $('.radioSortOrder', page).each(function () { + + this.checked = (query.SortOrder || '').toLowerCase() == this.getAttribute('data-sortorder').toLowerCase(); + + }).checkboxradio('refresh'); + } + $(document).on('pageinit', "#movieGenresPage", function () { var page = this; @@ -116,18 +138,7 @@ }).on('pageshow', "#movieGenresPage", function () { - // Reset form values using the last used query - $('.radioSortBy', this).each(function () { - - this.checked = (query.SortBy || '').toLowerCase() == this.getAttribute('data-sortby').toLowerCase(); - - }).checkboxradio('refresh'); - - $('.radioSortOrder', this).each(function () { - - this.checked = (query.SortOrder || '').toLowerCase() == this.getAttribute('data-sortorder').toLowerCase(); - - }).checkboxradio('refresh'); + updateFilterControls(this); }); })(jQuery, document); \ No newline at end of file diff --git a/dashboard-ui/scripts/moviepeople.js b/dashboard-ui/scripts/moviepeople.js index 16396ddd7d..3e6ecc123b 100644 --- a/dashboard-ui/scripts/moviepeople.js +++ b/dashboard-ui/scripts/moviepeople.js @@ -25,6 +25,8 @@ $('.listTopPaging', page).html(LibraryBrowser.getPagingHtml(query, result.TotalRecordCount, true)).trigger('create'); + updateFilterControls(page); + var checkSortOption = $('.radioSortBy:checked', page); $('.viewSummary', page).html(LibraryBrowser.getViewSummaryHtml(query, checkSortOption)).trigger('create'); @@ -38,7 +40,11 @@ $('#items', page).html(html).trigger('create'); $('.btnChangeToDefaultSort', page).on('click', function () { - $('.defaultSort', page)[0].click(); + query.StartIndex = 0; + query.SortOrder = 'Ascending'; + query.SortBy = $('.defaultSort', page).data('sortby'); + + reloadItems(page); }); $('.selectPage', page).on('change', function () { @@ -62,12 +68,39 @@ reloadItems(page); }); - LibraryBrowser.saveQueryValues('moviepeople', query); - + LibraryBrowser.saveQueryValues('moviepeople', query); + Dashboard.hideLoadingMsg(); }); } + function updateFilterControls(page) { + + // Reset form values using the last used query + $('.radioSortBy', page).each(function () { + + this.checked = (query.SortBy || '').toLowerCase() == this.getAttribute('data-sortby').toLowerCase(); + + }).checkboxradio('refresh'); + + $('.radioSortOrder', page).each(function () { + + this.checked = (query.SortOrder || '').toLowerCase() == this.getAttribute('data-sortorder').toLowerCase(); + + }).checkboxradio('refresh'); + + $('.chkPersonTypeFilter', page).each(function () { + + var filters = "," + (query.PersonTypes || ""); + var filterName = this.getAttribute('data-filter'); + + this.checked = filters.indexOf(',' + filterName) != -1; + + }).checkboxradio('refresh'); + + $('.alphabetPicker', page).alphaValue(query.NameStartsWithOrGreater); + } + $(document).on('pageinit', "#moviePeoplePage", function () { var page = this; @@ -148,29 +181,7 @@ }).on('pageshow', "#moviePeoplePage", function () { - // Reset form values using the last used query - $('.radioSortBy', this).each(function () { - - this.checked = (query.SortBy || '').toLowerCase() == this.getAttribute('data-sortby').toLowerCase(); - - }).checkboxradio('refresh'); - - $('.radioSortOrder', this).each(function () { - - this.checked = (query.SortOrder || '').toLowerCase() == this.getAttribute('data-sortorder').toLowerCase(); - - }).checkboxradio('refresh'); - - $('.chkPersonTypeFilter', this).each(function () { - - var filters = "," + (query.PersonTypes || ""); - var filterName = this.getAttribute('data-filter'); - - this.checked = filters.indexOf(',' + filterName) != -1; - - }).checkboxradio('refresh'); - - $('.alphabetPicker', this).alphaValue(query.NameStartsWithOrGreater); + updateFilterControls(this); }); })(jQuery, document); \ No newline at end of file diff --git a/dashboard-ui/scripts/movies.js b/dashboard-ui/scripts/movies.js index 175233db66..2e64dd363e 100644 --- a/dashboard-ui/scripts/movies.js +++ b/dashboard-ui/scripts/movies.js @@ -26,6 +26,8 @@ $('.listTopPaging', page).html(LibraryBrowser.getPagingHtml(query, result.TotalRecordCount, true)).trigger('create'); + updateFilterControls(page); + var checkSortOption = $('.radioSortBy:checked', page); $('.viewSummary', page).html(LibraryBrowser.getViewSummaryHtml(query, checkSortOption)).trigger('create'); @@ -61,7 +63,11 @@ $('#items', page).html(html).trigger('create'); $('.btnChangeToDefaultSort', page).on('click', function () { - $('.defaultSort', page)[0].click(); + query.StartIndex = 0; + query.SortOrder = 'Ascending'; + query.SortBy = $('.defaultSort', page).data('sortby'); + + reloadItems(page); }); $('.selectPage', page).on('change', function () { @@ -86,11 +92,57 @@ }); LibraryBrowser.saveQueryValues('movies', query); - + Dashboard.hideLoadingMsg(); }); } + function updateFilterControls(page) { + + // Reset form values using the last used query + $('.radioSortBy', page).each(function () { + + this.checked = (query.SortBy || '').toLowerCase() == this.getAttribute('data-sortby').toLowerCase(); + + }).checkboxradio('refresh'); + + $('.radioSortOrder', page).each(function () { + + this.checked = (query.SortOrder || '').toLowerCase() == this.getAttribute('data-sortorder').toLowerCase(); + + }).checkboxradio('refresh'); + + $('.chkStandardFilter', page).each(function () { + + var filters = "," + (query.Filters || ""); + var filterName = this.getAttribute('data-filter'); + + this.checked = filters.indexOf(',' + filterName) != -1; + + }).checkboxradio('refresh'); + + $('.chkVideoTypeFilter', page).each(function () { + + var filters = "," + (query.VideoTypes || ""); + var filterName = this.getAttribute('data-filter'); + + this.checked = filters.indexOf(',' + filterName) != -1; + + }).checkboxradio('refresh'); + + $('#selectView', page).val(view).selectmenu('refresh'); + + $('#chk3D', page).checked(query.Is3D == true).checkboxradio('refresh'); + + $('#chkSubtitle', page).checked(query.HasSubtitles == true).checkboxradio('refresh'); + $('#chkTrailer', page).checked(query.HasTrailer == true).checkboxradio('refresh'); + $('#chkSpecialFeature', page).checked(query.HasSpecialFeature == true).checkboxradio('refresh'); + $('#chkThemeSong', page).checked(query.HasThemeSong == true).checkboxradio('refresh'); + $('#chkThemeVideo', page).checked(query.HasThemeVideo == true).checkboxradio('refresh'); + + $('.alphabetPicker', page).alphaValue(query.NameStartsWithOrGreater); + } + $(document).on('pageinit', "#moviesPage", function () { var page = this; @@ -212,7 +264,7 @@ query.StartIndex = 0; reloadItems(page); - + }).on('alphaclear', function (e) { query.NameStartsWithOrGreater = ''; @@ -236,49 +288,7 @@ }).on('pageshow', "#moviesPage", function () { - // Reset form values using the last used query - $('.radioSortBy', this).each(function () { - - this.checked = (query.SortBy || '').toLowerCase() == this.getAttribute('data-sortby').toLowerCase(); - - }).checkboxradio('refresh'); - - $('.radioSortOrder', this).each(function () { - - this.checked = (query.SortOrder || '').toLowerCase() == this.getAttribute('data-sortorder').toLowerCase(); - - }).checkboxradio('refresh'); - - $('.chkStandardFilter', this).each(function () { - - var filters = "," + (query.Filters || ""); - var filterName = this.getAttribute('data-filter'); - - this.checked = filters.indexOf(',' + filterName) != -1; - - }).checkboxradio('refresh'); - - $('.chkVideoTypeFilter', this).each(function () { - - var filters = "," + (query.VideoTypes || ""); - var filterName = this.getAttribute('data-filter'); - - this.checked = filters.indexOf(',' + filterName) != -1; - - }).checkboxradio('refresh'); - - $('#selectView', this).val(view).selectmenu('refresh'); - - $('#chk3D', this).checked(query.Is3D == true).checkboxradio('refresh'); - - $('#chkSubtitle', this).checked(query.HasSubtitles == true).checkboxradio('refresh'); - $('#chkTrailer', this).checked(query.HasTrailer == true).checkboxradio('refresh'); - $('#chkSpecialFeature', this).checked(query.HasSpecialFeature == true).checkboxradio('refresh'); - $('#chkThemeSong', this).checked(query.HasThemeSong == true).checkboxradio('refresh'); - $('#chkThemeVideo', this).checked(query.HasThemeVideo == true).checkboxradio('refresh'); - - $('.alphabetPicker', this).alphaValue(query.NameStartsWithOrGreater); - + updateFilterControls(this); }); })(jQuery, document); \ No newline at end of file diff --git a/dashboard-ui/scripts/moviestudios.js b/dashboard-ui/scripts/moviestudios.js index fc85e18539..8977b0d3e7 100644 --- a/dashboard-ui/scripts/moviestudios.js +++ b/dashboard-ui/scripts/moviestudios.js @@ -24,6 +24,8 @@ $('.listTopPaging', page).html(LibraryBrowser.getPagingHtml(query, result.TotalRecordCount, true)).trigger('create'); + updateFilterControls(page); + var checkSortOption = $('.radioSortBy:checked', page); $('.viewSummary', page).html(LibraryBrowser.getViewSummaryHtml(query, checkSortOption)).trigger('create'); @@ -37,7 +39,11 @@ $('#items', page).html(html).trigger('create'); $('.btnChangeToDefaultSort', page).on('click', function () { - $('.defaultSort', page)[0].click(); + query.StartIndex = 0; + query.SortOrder = 'Ascending'; + query.SortBy = $('.defaultSort', page).data('sortby'); + + reloadItems(page); }); $('.selectPage', page).on('change', function () { @@ -61,12 +67,28 @@ reloadItems(page); }); - LibraryBrowser.saveQueryValues('moviestudios', query); - + LibraryBrowser.saveQueryValues('moviestudios', query); + Dashboard.hideLoadingMsg(); }); } + function updateFilterControls(page) { + + // Reset form values using the last used query + $('.radioSortBy', page).each(function () { + + this.checked = (query.SortBy || '').toLowerCase() == this.getAttribute('data-sortby').toLowerCase(); + + }).checkboxradio('refresh'); + + $('.radioSortOrder', page).each(function () { + + this.checked = (query.SortOrder || '').toLowerCase() == this.getAttribute('data-sortorder').toLowerCase(); + + }).checkboxradio('refresh'); + } + $(document).on('pageinit', "#movieStudiosPage", function () { var page = this; @@ -116,19 +138,7 @@ }).on('pageshow', "#movieStudiosPage", function () { - // Reset form values using the last used query - $('.radioSortBy', this).each(function () { - - this.checked = (query.SortBy || '').toLowerCase() == this.getAttribute('data-sortby').toLowerCase(); - - }).checkboxradio('refresh'); - - $('.radioSortOrder', this).each(function () { - - this.checked = (query.SortOrder || '').toLowerCase() == this.getAttribute('data-sortorder').toLowerCase(); - - }).checkboxradio('refresh'); - + updateFilterControls(this); }); })(jQuery, document); \ No newline at end of file diff --git a/dashboard-ui/scripts/movietrailers.js b/dashboard-ui/scripts/movietrailers.js index 0ce488c40a..a4d15b8efb 100644 --- a/dashboard-ui/scripts/movietrailers.js +++ b/dashboard-ui/scripts/movietrailers.js @@ -26,6 +26,8 @@ $('.listTopPaging', page).html(LibraryBrowser.getPagingHtml(query, result.TotalRecordCount, true)).trigger('create'); + updateFilterControls(page); + var checkSortOption = $('.radioSortBy:checked', page); $('.viewSummary', page).html(LibraryBrowser.getViewSummaryHtml(query, checkSortOption)).trigger('create'); @@ -44,11 +46,15 @@ } html += LibraryBrowser.getPagingHtml(query, result.TotalRecordCount); - + $('#items', page).html(html).trigger('create'); $('.btnChangeToDefaultSort', page).on('click', function () { - $('.defaultSort', page)[0].click(); + query.StartIndex = 0; + query.SortOrder = 'Ascending'; + query.SortBy = $('.defaultSort', page).data('sortby'); + + reloadItems(page); }); $('.selectPage', page).on('change', function () { @@ -71,13 +77,42 @@ query.StartIndex = 0; reloadItems(page); }); - - LibraryBrowser.saveQueryValues('movietrailers', query); + + LibraryBrowser.saveQueryValues('movietrailers', query); Dashboard.hideLoadingMsg(); }); } + function updateFilterControls(page) { + + // Reset form values using the last used query + $('.radioSortBy', page).each(function () { + + this.checked = (query.SortBy || '').toLowerCase() == this.getAttribute('data-sortby').toLowerCase(); + + }).checkboxradio('refresh'); + + $('.radioSortOrder', page).each(function () { + + this.checked = (query.SortOrder || '').toLowerCase() == this.getAttribute('data-sortorder').toLowerCase(); + + }).checkboxradio('refresh'); + + $('.chkStandardFilter', page).each(function () { + + var filters = "," + (query.Filters || ""); + var filterName = this.getAttribute('data-filter'); + + this.checked = filters.indexOf(',' + filterName) != -1; + + }).checkboxradio('refresh'); + + $('#selectView', page).val(view).selectmenu('refresh'); + + $('.alphabetPicker', page).alphaValue(query.NameStartsWith); + } + $(document).on('pageinit', "#movieTrailersPage", function () { var page = this; @@ -148,32 +183,7 @@ }).on('pageshow', "#movieTrailersPage", function () { - - // Reset form values using the last used query - $('.radioSortBy', this).each(function () { - - this.checked = (query.SortBy || '').toLowerCase() == this.getAttribute('data-sortby').toLowerCase(); - - }).checkboxradio('refresh'); - - $('.radioSortOrder', this).each(function () { - - this.checked = (query.SortOrder || '').toLowerCase() == this.getAttribute('data-sortorder').toLowerCase(); - - }).checkboxradio('refresh'); - - $('.chkStandardFilter', this).each(function () { - - var filters = "," + (query.Filters || ""); - var filterName = this.getAttribute('data-filter'); - - this.checked = filters.indexOf(',' + filterName) != -1; - - }).checkboxradio('refresh'); - - $('#selectView', this).val(view).selectmenu('refresh'); - - $('.alphabetPicker', this).alphaValue(query.NameStartsWith); + updateFilterControls(this); }); })(jQuery, document); \ No newline at end of file diff --git a/dashboard-ui/scripts/musicalbums.js b/dashboard-ui/scripts/musicalbums.js index 31bbf3dbea..8813269626 100644 --- a/dashboard-ui/scripts/musicalbums.js +++ b/dashboard-ui/scripts/musicalbums.js @@ -1,7 +1,7 @@ (function ($, document) { var view = "Poster"; - + // The base query options var query = { @@ -26,6 +26,8 @@ $('.listTopPaging', page).html(LibraryBrowser.getPagingHtml(query, result.TotalRecordCount, true)).trigger('create'); + updateFilterControls(page); + var checkSortOption = $('.radioSortBy:checked', page); $('.viewSummary', page).html(LibraryBrowser.getViewSummaryHtml(query, checkSortOption)).trigger('create'); @@ -52,7 +54,11 @@ $('#items', page).html(html).trigger('create'); $('.btnChangeToDefaultSort', page).on('click', function () { - $('.defaultSort', page)[0].click(); + query.StartIndex = 0; + query.SortOrder = 'Ascending'; + query.SortBy = $('.defaultSort', page).data('sortby'); + + reloadItems(page); }); $('.selectPage', page).on('change', function () { @@ -76,12 +82,32 @@ reloadItems(page); }); - LibraryBrowser.saveQueryValues('musicalbums', query); - + LibraryBrowser.saveQueryValues('musicalbums', query); + Dashboard.hideLoadingMsg(); }); } + function updateFilterControls(page) { + + $('#selectView', page).val(view).selectmenu('refresh'); + + // Reset form values using the last used query + $('.radioSortBy', page).each(function () { + + this.checked = (query.SortBy || '').toLowerCase() == this.getAttribute('data-sortby').toLowerCase(); + + }).checkboxradio('refresh'); + + $('.radioSortOrder', page).each(function () { + + this.checked = (query.SortOrder || '').toLowerCase() == this.getAttribute('data-sortorder').toLowerCase(); + + }).checkboxradio('refresh'); + + $('.alphabetPicker', page).alphaValue(query.NameStartsWith); + } + $(document).on('pageinit', "#musicAlbumsPage", function () { var page = this; @@ -89,7 +115,7 @@ $('.radioSortBy', page).on('click', function () { query.SortBy = this.getAttribute('data-sortby'); query.StartIndex = 0; - + // Clear this $('.alphabetPicker', page).alphaClear(); query.NameStartsWithOrGreater = ''; @@ -151,7 +177,7 @@ query.AlbumArtistStartsWithOrGreater = character; query.NameStartsWithOrGreater = ''; } - + query.StartIndex = 0; reloadItems(page); @@ -180,22 +206,7 @@ }).on('pageshow', "#musicAlbumsPage", function () { - $('#selectView', this).val(view).selectmenu('refresh'); - - // Reset form values using the last used query - $('.radioSortBy', this).each(function () { - - this.checked = (query.SortBy || '').toLowerCase() == this.getAttribute('data-sortby').toLowerCase(); - - }).checkboxradio('refresh'); - - $('.radioSortOrder', this).each(function () { - - this.checked = (query.SortOrder || '').toLowerCase() == this.getAttribute('data-sortorder').toLowerCase(); - - }).checkboxradio('refresh'); - - $('.alphabetPicker', this).alphaValue(query.NameStartsWith); + updateFilterControls(this); }); })(jQuery, document); \ No newline at end of file diff --git a/dashboard-ui/scripts/musicartists.js b/dashboard-ui/scripts/musicartists.js index ee80c9b531..575369e499 100644 --- a/dashboard-ui/scripts/musicartists.js +++ b/dashboard-ui/scripts/musicartists.js @@ -23,6 +23,8 @@ $('.listTopPaging', page).html(LibraryBrowser.getPagingHtml(query, result.TotalRecordCount, true)).trigger('create'); + updateFilterControls(page); + var checkSortOption = $('.radioSortBy:checked', page); $('.viewSummary', page).html(LibraryBrowser.getViewSummaryHtml(query, checkSortOption)).trigger('create'); @@ -38,7 +40,11 @@ $('#items', page).html(html).trigger('create'); $('.btnChangeToDefaultSort', page).on('click', function () { - $('.defaultSort', page)[0].click(); + query.StartIndex = 0; + query.SortOrder = 'Ascending'; + query.SortBy = $('.defaultSort', page).data('sortby'); + + reloadItems(page); }); $('.selectPage', page).on('change', function () { @@ -61,13 +67,31 @@ query.StartIndex = 0; reloadItems(page); }); - - LibraryBrowser.saveQueryValues('musicartists', query); + + LibraryBrowser.saveQueryValues('musicartists', query); Dashboard.hideLoadingMsg(); }); } + function updateFilterControls(page) { + + // Reset form values using the last used query + $('.radioSortBy', page).each(function () { + + this.checked = (query.SortBy || '').toLowerCase() == this.getAttribute('data-sortby').toLowerCase(); + + }).checkboxradio('refresh'); + + $('.radioSortOrder', page).each(function () { + + this.checked = (query.SortOrder || '').toLowerCase() == this.getAttribute('data-sortorder').toLowerCase(); + + }).checkboxradio('refresh'); + + $('.alphabetPicker', page).alphaValue(query.NameStartsWithOrGreater); + } + $(document).on('pageinit', "#musicArtistsPage", function () { var page = this; @@ -131,20 +155,7 @@ }).on('pageshow', "#musicArtistsPage", function () { - // Reset form values using the last used query - $('.radioSortBy', this).each(function () { - - this.checked = (query.SortBy || '').toLowerCase() == this.getAttribute('data-sortby').toLowerCase(); - - }).checkboxradio('refresh'); - - $('.radioSortOrder', this).each(function () { - - this.checked = (query.SortOrder || '').toLowerCase() == this.getAttribute('data-sortorder').toLowerCase(); - - }).checkboxradio('refresh'); - - $('.alphabetPicker', this).alphaValue(query.NameStartsWithOrGreater); + updateFilterControls(this); }); })(jQuery, document); \ No newline at end of file diff --git a/dashboard-ui/scripts/musicgenres.js b/dashboard-ui/scripts/musicgenres.js index 3985244dfd..9b28d50d1f 100644 --- a/dashboard-ui/scripts/musicgenres.js +++ b/dashboard-ui/scripts/musicgenres.js @@ -24,6 +24,8 @@ $('.listTopPaging', page).html(LibraryBrowser.getPagingHtml(query, result.TotalRecordCount, true)).trigger('create'); + updateFilterControls(page); + var checkSortOption = $('.radioSortBy:checked', page); $('.viewSummary', page).html(LibraryBrowser.getViewSummaryHtml(query, checkSortOption)).trigger('create'); @@ -37,7 +39,11 @@ $('#items', page).html(html).trigger('create'); $('.btnChangeToDefaultSort', page).on('click', function () { - $('.defaultSort', page)[0].click(); + query.StartIndex = 0; + query.SortOrder = 'Ascending'; + query.SortBy = $('.defaultSort', page).data('sortby'); + + reloadItems(page); }); $('.selectPage', page).on('change', function () { @@ -67,6 +73,22 @@ }); } + function updateFilterControls(page) { + + // Reset form values using the last used query + $('.radioSortBy', page).each(function () { + + this.checked = (query.SortBy || '').toLowerCase() == this.getAttribute('data-sortby').toLowerCase(); + + }).checkboxradio('refresh'); + + $('.radioSortOrder', page).each(function () { + + this.checked = (query.SortOrder || '').toLowerCase() == this.getAttribute('data-sortorder').toLowerCase(); + + }).checkboxradio('refresh'); + } + $(document).on('pageinit', "#musicGenresPage", function () { var page = this; @@ -116,18 +138,7 @@ }).on('pageshow', "#musicGenresPage", function () { - // Reset form values using the last used query - $('.radioSortBy', this).each(function () { - - this.checked = (query.SortBy || '').toLowerCase() == this.getAttribute('data-sortby').toLowerCase(); - - }).checkboxradio('refresh'); - - $('.radioSortOrder', this).each(function () { - - this.checked = (query.SortOrder || '').toLowerCase() == this.getAttribute('data-sortorder').toLowerCase(); - - }).checkboxradio('refresh'); + updateFilterControls(this); }); })(jQuery, document); \ No newline at end of file diff --git a/dashboard-ui/scripts/musicvideos.js b/dashboard-ui/scripts/musicvideos.js index cfe24bd664..46023a4392 100644 --- a/dashboard-ui/scripts/musicvideos.js +++ b/dashboard-ui/scripts/musicvideos.js @@ -26,6 +26,8 @@ $('.listTopPaging', page).html(LibraryBrowser.getPagingHtml(query, result.TotalRecordCount, true)).trigger('create'); + updateFilterControls(page); + var checkSortOption = $('.radioSortBy:checked', page); $('.viewSummary', page).html(LibraryBrowser.getViewSummaryHtml(query, checkSortOption)).trigger('create'); @@ -61,7 +63,11 @@ $('#items', page).html(html).trigger('create'); $('.btnChangeToDefaultSort', page).on('click', function () { - $('.defaultSort', page)[0].click(); + query.StartIndex = 0; + query.SortOrder = 'Ascending'; + query.SortBy = $('.defaultSort', page).data('sortby'); + + reloadItems(page); }); $('.selectPage', page).on('change', function () { @@ -91,6 +97,51 @@ }); } + function updateFilterControls(page) { + + // Reset form values using the last used query + $('.radioSortBy', page).each(function () { + + this.checked = (query.SortBy || '').toLowerCase() == this.getAttribute('data-sortby').toLowerCase(); + + }).checkboxradio('refresh'); + + $('.radioSortOrder', page).each(function () { + + this.checked = (query.SortOrder || '').toLowerCase() == this.getAttribute('data-sortorder').toLowerCase(); + + }).checkboxradio('refresh'); + + $('.chkStandardFilter', page).each(function () { + + var filters = "," + (query.Filters || ""); + var filterName = this.getAttribute('data-filter'); + + this.checked = filters.indexOf(',' + filterName) != -1; + + }).checkboxradio('refresh'); + + $('.chkVideoTypeFilter', page).each(function () { + + var filters = "," + (query.VideoTypes || ""); + var filterName = this.getAttribute('data-filter'); + + this.checked = filters.indexOf(',' + filterName) != -1; + + }).checkboxradio('refresh'); + + $('#selectView', page).val(view).selectmenu('refresh'); + + $('#chk3D', page).checked(query.Is3D == true).checkboxradio('refresh'); + + $('#chkSubtitle', page).checked(query.HasSubtitles == true).checkboxradio('refresh'); + $('#chkTrailer', page).checked(query.HasTrailer == true).checkboxradio('refresh'); + $('#chkThemeSong', page).checked(query.HasThemeSong == true).checkboxradio('refresh'); + $('#chkThemeVideo', page).checked(query.HasThemeVideo == true).checkboxradio('refresh'); + + $('.alphabetPicker', page).alphaValue(query.NameStartsWithOrGreater); + } + $(document).on('pageinit', "#musicVideosPage", function () { var page = this; @@ -228,48 +279,7 @@ }).on('pageshow', "#musicVideosPage", function () { - // Reset form values using the last used query - $('.radioSortBy', this).each(function () { - - this.checked = (query.SortBy || '').toLowerCase() == this.getAttribute('data-sortby').toLowerCase(); - - }).checkboxradio('refresh'); - - $('.radioSortOrder', this).each(function () { - - this.checked = (query.SortOrder || '').toLowerCase() == this.getAttribute('data-sortorder').toLowerCase(); - - }).checkboxradio('refresh'); - - $('.chkStandardFilter', this).each(function () { - - var filters = "," + (query.Filters || ""); - var filterName = this.getAttribute('data-filter'); - - this.checked = filters.indexOf(',' + filterName) != -1; - - }).checkboxradio('refresh'); - - $('.chkVideoTypeFilter', this).each(function () { - - var filters = "," + (query.VideoTypes || ""); - var filterName = this.getAttribute('data-filter'); - - this.checked = filters.indexOf(',' + filterName) != -1; - - }).checkboxradio('refresh'); - - $('#selectView', this).val(view).selectmenu('refresh'); - - $('#chk3D', this).checked(query.Is3D == true).checkboxradio('refresh'); - - $('#chkSubtitle', this).checked(query.HasSubtitles == true).checkboxradio('refresh'); - $('#chkTrailer', this).checked(query.HasTrailer == true).checkboxradio('refresh'); - $('#chkThemeSong', this).checked(query.HasThemeSong == true).checkboxradio('refresh'); - $('#chkThemeVideo', this).checked(query.HasThemeVideo == true).checkboxradio('refresh'); - - $('.alphabetPicker', this).alphaValue(query.NameStartsWithOrGreater); - + updateFilterControls(this); }); })(jQuery, document); \ No newline at end of file diff --git a/dashboard-ui/scripts/songs.js b/dashboard-ui/scripts/songs.js index b363d5e10f..bab01b3a27 100644 --- a/dashboard-ui/scripts/songs.js +++ b/dashboard-ui/scripts/songs.js @@ -45,6 +45,8 @@ $('.listTopPaging', page).html(LibraryBrowser.getPagingHtml(query, result.TotalRecordCount, true)).trigger('create'); + updateFilterControls(page); + var checkSortOption = $('.radioSortBy:checked', page); $('.viewSummary', page).html(LibraryBrowser.getViewSummaryHtml(query, checkSortOption)).trigger('create'); @@ -61,7 +63,11 @@ $('#items', page).html(html).trigger('create'); $('.btnChangeToDefaultSort', page).on('click', function () { - $('.defaultSort', page)[0].click(); + query.StartIndex = 0; + query.SortOrder = 'Ascending'; + query.SortBy = $('.defaultSort', page).data('sortby'); + + reloadItems(page); }); $('.selectPage', page).on('change', function () { @@ -116,8 +122,6 @@ LibraryBrowser.saveQueryValues('songs', query); Dashboard.hideLoadingMsg(); - - $(page).trigger('itemsreloaded'); }); } @@ -162,9 +166,6 @@ updateFilterControls(this); - }).on('itemsreloaded', "#songsPage", function () { - - updateFilterControls(this); }); })(jQuery, document); \ No newline at end of file diff --git a/dashboard-ui/scripts/tvgenres.js b/dashboard-ui/scripts/tvgenres.js index 39f94e9c05..b9a174930f 100644 --- a/dashboard-ui/scripts/tvgenres.js +++ b/dashboard-ui/scripts/tvgenres.js @@ -14,7 +14,7 @@ function reloadItems(page) { Dashboard.showLoadingMsg(); - + ApiClient.getGenres(Dashboard.getCurrentUserId(), query).done(function (result) { // Scroll back up so they can see the results from the beginning @@ -24,6 +24,8 @@ $('.listTopPaging', page).html(LibraryBrowser.getPagingHtml(query, result.TotalRecordCount, true)).trigger('create'); + updateFilterControls(page); + var checkSortOption = $('.radioSortBy:checked', page); $('.viewSummary', page).html(LibraryBrowser.getViewSummaryHtml(query, checkSortOption)).trigger('create'); @@ -37,7 +39,11 @@ $('#items', page).html(html).trigger('create'); $('.btnChangeToDefaultSort', page).on('click', function () { - $('.defaultSort', page)[0].click(); + query.StartIndex = 0; + query.SortOrder = 'Ascending'; + query.SortBy = $('.defaultSort', page).data('sortby'); + + reloadItems(page); }); $('.selectPage', page).on('change', function () { @@ -61,12 +67,37 @@ reloadItems(page); }); - LibraryBrowser.saveQueryValues('tvgenres', query); - + LibraryBrowser.saveQueryValues('tvgenres', query); + Dashboard.hideLoadingMsg(); }); } + function updateFilterControls(page) { + + // Reset form values using the last used query + $('.radioSortBy', page).each(function () { + + this.checked = (query.SortBy || '').toLowerCase() == this.getAttribute('data-sortby').toLowerCase(); + + }).checkboxradio('refresh'); + + $('.radioSortOrder', page).each(function () { + + this.checked = (query.SortOrder || '').toLowerCase() == this.getAttribute('data-sortorder').toLowerCase(); + + }).checkboxradio('refresh'); + + $('.chkStandardFilter', page).each(function () { + + var filters = "," + (query.Filters || ""); + var filterName = this.getAttribute('data-filter'); + + this.checked = filters.indexOf(',' + filterName) != -1; + + }).checkboxradio('refresh'); + } + $(document).on('pageinit', "#tvGenresPage", function () { var page = this; @@ -116,27 +147,7 @@ }).on('pageshow', "#tvGenresPage", function () { - // Reset form values using the last used query - $('.radioSortBy', this).each(function () { - - this.checked = (query.SortBy || '').toLowerCase() == this.getAttribute('data-sortby').toLowerCase(); - - }).checkboxradio('refresh'); - - $('.radioSortOrder', this).each(function () { - - this.checked = (query.SortOrder || '').toLowerCase() == this.getAttribute('data-sortorder').toLowerCase(); - - }).checkboxradio('refresh'); - - $('.chkStandardFilter', this).each(function () { - - var filters = "," + (query.Filters || ""); - var filterName = this.getAttribute('data-filter'); - - this.checked = filters.indexOf(',' + filterName) != -1; - - }).checkboxradio('refresh'); + updateFilterControls(this); }); })(jQuery, document); \ No newline at end of file diff --git a/dashboard-ui/scripts/tvpeople.js b/dashboard-ui/scripts/tvpeople.js index 72b0235226..90f65147ae 100644 --- a/dashboard-ui/scripts/tvpeople.js +++ b/dashboard-ui/scripts/tvpeople.js @@ -25,6 +25,8 @@ $('.listTopPaging', page).html(LibraryBrowser.getPagingHtml(query, result.TotalRecordCount, true)).trigger('create'); + updateFilterControls(page); + var checkSortOption = $('.radioSortBy:checked', page); $('.viewSummary', page).html(LibraryBrowser.getViewSummaryHtml(query, checkSortOption)).trigger('create'); @@ -38,7 +40,11 @@ $('#items', page).html(html).trigger('create'); $('.btnChangeToDefaultSort', page).on('click', function () { - $('.defaultSort', page)[0].click(); + query.StartIndex = 0; + query.SortOrder = 'Ascending'; + query.SortBy = $('.defaultSort', page).data('sortby'); + + reloadItems(page); }); $('.selectPage', page).on('change', function () { @@ -61,13 +67,49 @@ query.StartIndex = 0; reloadItems(page); }); - - LibraryBrowser.saveQueryValues('tvpeople', query); + + LibraryBrowser.saveQueryValues('tvpeople', query); Dashboard.hideLoadingMsg(); }); } + function updateFilterControls(page) { + + // Reset form values using the last used query + $('.radioSortBy', page).each(function () { + + this.checked = (query.SortBy || '').toLowerCase() == this.getAttribute('data-sortby').toLowerCase(); + + }).checkboxradio('refresh'); + + $('.radioSortOrder', page).each(function () { + + this.checked = (query.SortOrder || '').toLowerCase() == this.getAttribute('data-sortorder').toLowerCase(); + + }).checkboxradio('refresh'); + + $('.chkStandardFilter', page).each(function () { + + var filters = "," + (query.Filters || ""); + var filterName = this.getAttribute('data-filter'); + + this.checked = filters.indexOf(',' + filterName) != -1; + + }).checkboxradio('refresh'); + + $('.chkPersonTypeFilter', page).each(function () { + + var filters = "," + (query.PersonTypes || ""); + var filterName = this.getAttribute('data-filter'); + + this.checked = filters.indexOf(',' + filterName) != -1; + + }).checkboxradio('refresh'); + + $('.alphabetPicker', page).alphaValue(query.NameStartsWithOrGreater); + } + $(document).on('pageinit', "#tvPeoplePage", function () { var page = this; @@ -148,38 +190,7 @@ }).on('pageshow', "#tvPeoplePage", function () { - // Reset form values using the last used query - $('.radioSortBy', this).each(function () { - - this.checked = (query.SortBy || '').toLowerCase() == this.getAttribute('data-sortby').toLowerCase(); - - }).checkboxradio('refresh'); - - $('.radioSortOrder', this).each(function () { - - this.checked = (query.SortOrder || '').toLowerCase() == this.getAttribute('data-sortorder').toLowerCase(); - - }).checkboxradio('refresh'); - - $('.chkStandardFilter', this).each(function () { - - var filters = "," + (query.Filters || ""); - var filterName = this.getAttribute('data-filter'); - - this.checked = filters.indexOf(',' + filterName) != -1; - - }).checkboxradio('refresh'); - - $('.chkPersonTypeFilter', this).each(function () { - - var filters = "," + (query.PersonTypes || ""); - var filterName = this.getAttribute('data-filter'); - - this.checked = filters.indexOf(',' + filterName) != -1; - - }).checkboxradio('refresh'); - - $('.alphabetPicker', this).alphaValue(query.NameStartsWithOrGreater); + updateFilterControls(this); }); })(jQuery, document); \ No newline at end of file diff --git a/dashboard-ui/scripts/tvshows.js b/dashboard-ui/scripts/tvshows.js index ac43039f60..e83be1eea8 100644 --- a/dashboard-ui/scripts/tvshows.js +++ b/dashboard-ui/scripts/tvshows.js @@ -26,6 +26,8 @@ $('.listTopPaging', page).html(LibraryBrowser.getPagingHtml(query, result.TotalRecordCount, true)).trigger('create'); + updateFilterControls(page); + var checkSortOption = $('.radioSortBy:checked', page); $('.viewSummary', page).html(LibraryBrowser.getViewSummaryHtml(query, checkSortOption)).trigger('create'); @@ -58,7 +60,11 @@ $('#items', page).html(html).trigger('create'); $('.btnChangeToDefaultSort', page).on('click', function () { - $('.defaultSort', page)[0].click(); + query.StartIndex = 0; + query.SortOrder = 'Ascending'; + query.SortBy = $('.defaultSort', page).data('sortby'); + + reloadItems(page); }); $('.selectPage', page).on('change', function () { @@ -82,12 +88,64 @@ reloadItems(page); }); - LibraryBrowser.saveQueryValues('tvshows', query); - + LibraryBrowser.saveQueryValues('tvshows', query); + Dashboard.hideLoadingMsg(); }); } + function updateFilterControls(page) { + + // Reset form values using the last used query + $('.radioSortBy', page).each(function () { + + this.checked = (query.SortBy || '').toLowerCase() == this.getAttribute('data-sortby').toLowerCase(); + + }).checkboxradio('refresh'); + + $('.radioSortOrder', page).each(function () { + + this.checked = (query.SortOrder || '').toLowerCase() == this.getAttribute('data-sortorder').toLowerCase(); + + }).checkboxradio('refresh'); + + $('.chkStatus', page).each(function () { + + var filters = "," + (query.SeriesStatus || ""); + var filterName = this.getAttribute('data-filter'); + + this.checked = filters.indexOf(',' + filterName) != -1; + + }).checkboxradio('refresh'); + + $('.chkStandardFilter', page).each(function () { + + var filters = "," + (query.Filters || ""); + var filterName = this.getAttribute('data-filter'); + + this.checked = filters.indexOf(',' + filterName) != -1; + + }).checkboxradio('refresh'); + + $('.chkAirDays', page).each(function () { + + var filters = "," + (query.AirDays || ""); + var filterName = this.getAttribute('data-filter'); + + this.checked = filters.indexOf(',' + filterName) != -1; + + }).checkboxradio('refresh'); + + $('#selectView', page).val(view).selectmenu('refresh'); + + $('#chkTrailer', page).checked(query.HasTrailer == true).checkboxradio('refresh'); + $('#chkThemeSong', page).checked(query.HasThemeSong == true).checkboxradio('refresh'); + $('#chkThemeVideo', page).checked(query.HasThemeVideo == true).checkboxradio('refresh'); + $('#chkSpecialFeature', page).checked(query.HasSpecialFeature == true).checkboxradio('refresh'); + + $('.alphabetPicker', page).alphaValue(query.NameStartsWith); + } + $(document).on('pageinit', "#tvShowsPage", function () { var page = this; @@ -229,54 +287,7 @@ }).on('pageshow', "#tvShowsPage", function () { - // Reset form values using the last used query - $('.radioSortBy', this).each(function () { - - this.checked = (query.SortBy || '').toLowerCase() == this.getAttribute('data-sortby').toLowerCase(); - - }).checkboxradio('refresh'); - - $('.radioSortOrder', this).each(function () { - - this.checked = (query.SortOrder || '').toLowerCase() == this.getAttribute('data-sortorder').toLowerCase(); - - }).checkboxradio('refresh'); - - $('.chkStatus', this).each(function () { - - var filters = "," + (query.SeriesStatus || ""); - var filterName = this.getAttribute('data-filter'); - - this.checked = filters.indexOf(',' + filterName) != -1; - - }).checkboxradio('refresh'); - - $('.chkStandardFilter', this).each(function () { - - var filters = "," + (query.Filters || ""); - var filterName = this.getAttribute('data-filter'); - - this.checked = filters.indexOf(',' + filterName) != -1; - - }).checkboxradio('refresh'); - - $('.chkAirDays', this).each(function () { - - var filters = "," + (query.AirDays || ""); - var filterName = this.getAttribute('data-filter'); - - this.checked = filters.indexOf(',' + filterName) != -1; - - }).checkboxradio('refresh'); - - $('#selectView', this).val(view).selectmenu('refresh'); - - $('#chkTrailer', this).checked(query.HasTrailer == true).checkboxradio('refresh'); - $('#chkThemeSong', this).checked(query.HasThemeSong == true).checkboxradio('refresh'); - $('#chkThemeVideo', this).checked(query.HasThemeVideo == true).checkboxradio('refresh'); - $('#chkSpecialFeature', this).checked(query.HasSpecialFeature == true).checkboxradio('refresh'); - - $('.alphabetPicker', this).alphaValue(query.NameStartsWith); + updateFilterControls(this); }); })(jQuery, document); \ No newline at end of file diff --git a/dashboard-ui/scripts/tvstudios.js b/dashboard-ui/scripts/tvstudios.js index bb5f9e5806..56a456ed8e 100644 --- a/dashboard-ui/scripts/tvstudios.js +++ b/dashboard-ui/scripts/tvstudios.js @@ -24,6 +24,8 @@ $('.listTopPaging', page).html(LibraryBrowser.getPagingHtml(query, result.TotalRecordCount, true)).trigger('create'); + updateFilterControls(page); + var checkSortOption = $('.radioSortBy:checked', page); $('.viewSummary', page).html(LibraryBrowser.getViewSummaryHtml(query, checkSortOption)).trigger('create'); @@ -37,7 +39,11 @@ $('#items', page).html(html).trigger('create'); $('.btnChangeToDefaultSort', page).on('click', function () { - $('.defaultSort', page)[0].click(); + query.StartIndex = 0; + query.SortOrder = 'Ascending'; + query.SortBy = $('.defaultSort', page).data('sortby'); + + reloadItems(page); }); $('.selectPage', page).on('change', function () { @@ -61,12 +67,37 @@ reloadItems(page); }); - LibraryBrowser.saveQueryValues('tvstudios', query); - + LibraryBrowser.saveQueryValues('tvstudios', query); + Dashboard.hideLoadingMsg(); }); } + function updateFilterControls(page) { + + // Reset form values using the last used query + $('.radioSortBy', page).each(function () { + + this.checked = (query.SortBy || '').toLowerCase() == this.getAttribute('data-sortby').toLowerCase(); + + }).checkboxradio('refresh'); + + $('.radioSortOrder', page).each(function () { + + this.checked = (query.SortOrder || '').toLowerCase() == this.getAttribute('data-sortorder').toLowerCase(); + + }).checkboxradio('refresh'); + + $('.chkStandardFilter', page).each(function () { + + var filters = "," + (query.Filters || ""); + var filterName = this.getAttribute('data-filter'); + + this.checked = filters.indexOf(',' + filterName) != -1; + + }).checkboxradio('refresh'); + } + $(document).on('pageinit', "#tvStudiosPage", function () { var page = this; @@ -116,27 +147,7 @@ }).on('pageshow', "#tvStudiosPage", function () { - // Reset form values using the last used query - $('.radioSortBy', this).each(function () { - - this.checked = (query.SortBy || '').toLowerCase() == this.getAttribute('data-sortby').toLowerCase(); - - }).checkboxradio('refresh'); - - $('.radioSortOrder', this).each(function () { - - this.checked = (query.SortOrder || '').toLowerCase() == this.getAttribute('data-sortorder').toLowerCase(); - - }).checkboxradio('refresh'); - - $('.chkStandardFilter', this).each(function () { - - var filters = "," + (query.Filters || ""); - var filterName = this.getAttribute('data-filter'); - - this.checked = filters.indexOf(',' + filterName) != -1; - - }).checkboxradio('refresh'); + updateFilterControls(this); }); })(jQuery, document); \ No newline at end of file diff --git a/dashboard-ui/tvrecommended.html b/dashboard-ui/tvrecommended.html index 5cf7c7ba36..fb6feee06e 100644 --- a/dashboard-ui/tvrecommended.html +++ b/dashboard-ui/tvrecommended.html @@ -18,13 +18,13 @@
- Latest Unwatched Episodes+Latest Unwatched Episodes |