(function ($, document) { // The base query options var query = { SortBy: "SortName", SortOrder: "Ascending", IncludeItemTypes: "Series", Recursive: true, Fields: "PrimaryImageAspectRatio,SeriesInfo" }; function getTableHtml(items) { var html = '
'; html += ''; html += ''; html += ''; html += ''; html += ''; html += ''; html += ''; html += ''; html += ''; html += ''; html += ''; for (var i = 0, length = items.length; i < length; i++) { html += getRowHtml(items[i]); } html += ''; html += '
 NameYearOfficial RatingRuntimeCommunity Rating
'; return html; } function getRowHtml(item) { var html = ''; html += ''; var url = "itemdetails.html?id=" + item.Id; var imageTags = item.ImageTags; html += ''; if (imageTags.Primary) { html += ''; } else { html += ''; } html += ''; html += '' + item.Name + ''; html += '' + (item.ProductionYear || "") + ''; html += '' + (item.OfficialRating || "") + ''; html += '' + (item.RunTimeTicks || "") + ''; html += '' + (item.CommunityRating || "") + ''; html += ''; return html; } function reloadItems(page) { Dashboard.showLoadingMsg(); ApiClient.getItems(Dashboard.getCurrentUserId(), query).done(function (result) { $('#items', page).html(LibraryBrowser.getPosterViewHtml({ items: result.Items, useAverageAspectRatio: true }))/*.html(getTableHtml(result.Items)).trigger('create')*/; Dashboard.hideLoadingMsg(); }); } $(document).on('pageinit', "#tvShowsPage", function () { var page = this; $('.radioSortBy', this).on('click', function () { query.SortBy = this.getAttribute('data-sortby'); reloadItems(page); }); $('.radioSortOrder', this).on('click', function () { query.SortOrder = this.getAttribute('data-sortorder'); reloadItems(page); }); $('.chkStandardFilter', this).on('change', function () { var filterName = this.getAttribute('data-filter'); var filters = query.Filters || ""; filters = (',' + filters).replace(',' + filterName, '').substring(1); if (this.checked) { filters = filters ? (filters + ',' + filterName) : filterName; } query.Filters = filters; reloadItems(page); }); }).on('pagebeforeshow', "#tvShowsPage", function () { reloadItems(this); }).on('pageshow', "#tvShowsPage", function () { // Reset form values using the last used query $('.radioSortBy', this).each(function () { this.checked = query.SortBy == this.getAttribute('data-sortby'); }).checkboxradio('refresh'); $('.radioSortOrder', this).each(function () { this.checked = query.SortOrder == this.getAttribute('data-sortorder'); }).checkboxradio('refresh'); $('.chkStandardFilter', this).each(function () { var filters = "," + (query.Filters || ""); var filterName = this.getAttribute('data-filter'); this.checked = filters.indexOf(',' + filterName) != -1; }).checkboxradio('refresh'); }); })(jQuery, document);