jellyfin-web/dashboard-ui/scripts/libraryreport.js

853 lines
30 KiB
JavaScript
Raw Normal View History

2014-03-02 13:44:48 -07:00
(function ($, document, window) {
2014-03-08 11:17:05 -07:00
var defaultSortBy = "SortName";
2014-03-02 13:44:48 -07:00
// The base query options
var query = {
2014-03-08 11:17:05 -07:00
SortBy: defaultSortBy,
2014-03-02 13:44:48 -07:00
SortOrder: "Ascending",
Recursive: true,
2014-03-03 21:53:48 -07:00
Fields: "MediaStreams,DateCreated,Settings,Studios",
2014-03-02 19:17:12 -07:00
StartIndex: 0,
2014-03-03 21:53:48 -07:00
IncludeItemTypes: "Movie",
IsMissing: false,
2014-03-17 07:48:16 -07:00
IsVirtualUnaired: false,
2014-03-18 10:05:57 -07:00
Limit: 300,
CollapseBoxSetItems: false
2014-03-02 13:44:48 -07:00
};
2014-03-03 21:53:48 -07:00
function getHeaderCells(reportType) {
2014-03-02 19:17:12 -07:00
2014-03-03 21:53:48 -07:00
switch (reportType) {
2014-03-03 21:53:48 -07:00
case 'Season':
{
return [
{},
2014-03-08 11:17:05 -07:00
{ name: 'Series', sortField: 'SeriesSortName,SortName' },
{ name: 'Season', sortField: 'SortName' },
{ name: 'Date Added', sortField: 'DateCreated,SortName' }
2014-03-03 21:53:48 -07:00
];
}
case 'Series':
{
return [
{},
2014-03-08 11:17:05 -07:00
{ name: 'Name', sortField: 'SortName' },
{ name: 'Network', sortField: 'Studio,SortName' },
{ name: 'Date Added', sortField: 'DateCreated,SortName' },
{ name: 'Year', sortField: 'ProductionYear,PremiereDate,SortName' },
{ name: 'Parental Rating', sortField: 'OfficialRating,SortName' },
{ name: 'Community Rating', sortField: 'CommunityRating,SortName' },
{ name: 'Runtime', sortField: 'Runtime,SortName' },
2014-03-03 21:53:48 -07:00
{ name: 'Trailers' },
{ name: 'Specials' }
];
}
case 'Game':
{
return [
{},
2014-03-08 11:17:05 -07:00
{ name: 'Name', sortField: 'SortName' },
{ name: 'Game System', sortField: 'GameSystem,SortName' },
{ name: 'Date Added', sortField: 'DateCreated,GameSystem,SortName' },
{ name: 'Release Date', sortField: 'ProductionYear,PremiereDate,GameSystem,SortName' },
{ name: 'Parental Rating', sortField: 'OfficialRating,GameSystem,SortName' },
{ name: 'Community Rating', sortField: 'CommunityRating,GameSystem,SortName' },
{ name: 'Players', sortField: 'Players,GameSystem,SortName' },
2014-03-03 21:53:48 -07:00
{ name: 'Trailers' }
];
}
case 'Audio':
{
return [
{},
{ name: 'Album Artist', sortField: 'AlbumArtist,Album,SortName' },
2014-03-08 11:17:05 -07:00
{ name: 'Album', sortField: 'Album,SortName' },
{ name: 'Disc' },
{ name: 'Track' },
2014-03-08 11:17:05 -07:00
{ name: 'Name', sortField: 'Name' },
{ name: 'Date Added', sortField: 'DateCreated,SortName' },
{ name: 'Release Date', sortField: 'ProductionYear,PremiereDate,SortName' },
{ name: 'Runtime', sortField: 'Runtime,SortName' },
2014-03-03 21:53:48 -07:00
{ name: 'Audio' },
{ name: 'Embedded Image' }
];
}
case 'Episode':
{
return [
{},
2014-03-08 11:17:05 -07:00
{ name: 'Series', sortField: 'SeriesSortName,SortName' },
2014-03-03 21:53:48 -07:00
{ name: 'Season' },
2014-03-08 11:17:05 -07:00
{ name: 'Name', sortField: 'SortName' },
{ name: 'Date Added', sortField: 'DateCreated,SortName' },
{ name: 'Release Date', sortField: 'ProductionYear,PremiereDate,SortName' },
{ name: 'Community Rating', sortField: 'CommunityRating,SortName' },
{ name: 'Runtime', sortField: 'Runtime,SortName' },
2014-03-03 21:53:48 -07:00
{ name: 'Video' },
{ name: 'Resolution' },
2014-03-03 21:53:48 -07:00
{ name: 'Audio' },
{ name: 'Subtitles' }
];
}
case 'BoxSet':
{
return [
{},
2014-03-08 11:17:05 -07:00
{ name: 'Name', sortField: 'SortName' },
{ name: 'Date Added', sortField: 'DateCreated,SortName' },
{ name: 'Release Date', sortField: 'ProductionYear,PremiereDate,SortName' },
{ name: 'Parental Rating', sortField: 'OfficialRating,SortName' },
{ name: 'Community Rating', sortField: 'CommunityRating,SortName' },
2014-03-03 21:53:48 -07:00
{ name: 'Trailers' }
];
}
case 'Book':
{
return [
{},
{ name: 'Series' },
2014-03-08 11:17:05 -07:00
{ name: 'Name', sortField: 'SortName' },
{ name: 'Date Added', sortField: 'DateCreated,SortName' },
{ name: 'Release Date', sortField: 'ProductionYear,PremiereDate,SortName' },
{ name: 'Parental Rating', sortField: 'OfficialRating,SortName' },
{ name: 'Community Rating', sortField: 'CommunityRating,SortName' }
2014-03-03 21:53:48 -07:00
];
}
case 'MusicArtist':
{
return [
{},
2014-03-08 11:17:05 -07:00
{ name: 'Name', sortField: 'SortName' },
{ name: 'Date Added', sortField: 'DateCreated,SortName' }
2014-03-03 21:53:48 -07:00
];
}
case 'MusicAlbum':
{
return [
{},
2014-03-08 11:17:05 -07:00
{ name: 'Album Artist', sortField: 'AlbumArtist,SortName' },
{ name: 'Name', sortField: 'SortName' },
{ name: 'Date Added', sortField: 'DateCreated,SortName' },
{ name: 'Release Date', sortField: 'ProductionYear,PremiereDate,SortName' },
{ name: 'Parental Rating', sortField: 'OfficialRating,SortName' },
{ name: 'Community Rating', sortField: 'CommunityRating,SortName' },
{ name: 'Runtime', sortField: 'Runtime,SortName' }
2014-03-03 21:53:48 -07:00
];
}
default:
{
return [
{},
2014-03-08 11:17:05 -07:00
{ name: 'Name', sortField: 'SortName' },
{ name: 'Date Added', sortField: 'DateCreated,SortName' },
{ name: 'Release Date', sortField: 'ProductionYear,PremiereDate,SortName' },
{ name: 'Parental Rating', sortField: 'OfficialRating,SortName' },
{ name: 'Community Rating', sortField: 'CommunityRating,SortName' },
{ name: 'Runtime', sortField: 'Runtime,SortName' },
2014-03-03 21:53:48 -07:00
{ name: 'Video' },
{ name: 'Resolution' },
2014-03-03 21:53:48 -07:00
{ name: 'Audio' },
{ name: 'Subtitles' },
{ name: 'Trailers' },
{ name: 'Specials' }
];
}
2014-03-02 13:44:48 -07:00
}
}
function getDefaultSortOrder(reportType) {
switch (reportType) {
case 'Season':
{
return "SeriesSortName,SortName";
}
case 'Series':
{
return "SortName";
}
case 'Game':
{
return "GameSystem,SortName";
}
case 'Audio':
{
return "AlbumArtist,Album,SortName";
}
case 'Episode':
{
return "SeriesSortName,SortName";
}
case 'BoxSet':
{
return "SortName";
}
case 'Book':
{
return "SortName";
}
case 'MusicArtist':
{
return "SortName";
}
case 'MusicAlbum':
{
return "AlbumArtist,SortName";
}
default:
{
return "SortName";
}
}
}
2014-03-03 21:53:48 -07:00
function getItemCellsHtml(item, headercells) {
2014-03-02 13:44:48 -07:00
2014-03-03 21:53:48 -07:00
return headercells.map(function (cell) {
2014-03-02 13:44:48 -07:00
2014-03-03 21:53:48 -07:00
var html = '';
html += '<td>';
2014-03-02 13:44:48 -07:00
var stream;
2014-03-03 21:53:48 -07:00
switch (cell.type || cell.name) {
2014-03-02 13:44:48 -07:00
2014-03-03 21:53:48 -07:00
case 'Album Artist':
{
html += item.AlbumArtist || '&nbsp;';
break;
}
case 'Album':
{
html += item.Album || '&nbsp;';
break;
}
case 'Series':
{
html += item.SeriesName || '&nbsp;';
break;
}
case 'Game System':
{
html += item.GameSystem || '&nbsp;';
break;
}
case 'Network':
{
html += item.Studios.length ? item.Studios[0].Name : '&nbsp;';
break;
}
2014-03-08 11:17:05 -07:00
case 'Disc':
{
html += item.ParentIndexNumber == null ? '' : item.ParentIndexNumber;
break;
}
2014-03-03 21:53:48 -07:00
case 'Track':
{
html += item.IndexNumber == null ? '' : item.IndexNumber;
break;
}
case 'Players':
{
html += item.Players || '&nbsp;';
break;
}
case 'Audio':
{
stream = (item.MediaStreams || []).filter(function (s) {
2014-03-02 13:44:48 -07:00
2014-03-03 21:53:48 -07:00
return s.Type == 'Audio';
2014-03-03 21:53:48 -07:00
})[0];
2014-03-02 13:44:48 -07:00
2014-03-03 21:53:48 -07:00
if (stream) {
2014-03-02 13:44:48 -07:00
2014-03-03 21:53:48 -07:00
var name = (stream.Codec || '').toUpperCase();
html += name == 'DCA' ? (stream.Profile || '').toUpperCase() : name;
}
break;
}
case 'Video':
{
stream = (item.MediaStreams || []).filter(function (s) {
2014-03-02 13:44:48 -07:00
2014-03-03 21:53:48 -07:00
return s.Type == 'Video';
2014-03-02 13:44:48 -07:00
2014-03-03 21:53:48 -07:00
})[0];
2014-03-02 13:44:48 -07:00
2014-03-03 21:53:48 -07:00
if (stream) {
html += (stream.Codec || '').toUpperCase();
}
break;
}
case 'Resolution':
{
stream = (item.MediaStreams || []).filter(function (s) {
return s.Type == 'Video';
})[0];
if (stream && stream.Width) {
html += stream.Width + "*" + (stream.Height || "-");
}
break;
}
2014-03-03 21:53:48 -07:00
case 'Embedded Image':
{
if ((item.MediaStreams || []).filter(function (s) {
2014-03-02 13:44:48 -07:00
2014-03-03 21:53:48 -07:00
return s.Type == 'Video';
}).length) {
html += '<div class="libraryReportIndicator clearLibraryReportIndicator"><div class="ui-icon-check ui-btn-icon-notext"></div></div>';
}
break;
}
case 'Subtitles':
{
var hasSubtitles = (item.MediaStreams || []).filter(function (s) {
2014-03-02 13:44:48 -07:00
2014-03-03 21:53:48 -07:00
return s.Type == 'Subtitle';
2014-03-02 13:44:48 -07:00
2014-03-03 21:53:48 -07:00
}).length;
2014-03-02 13:44:48 -07:00
2014-03-03 21:53:48 -07:00
if (hasSubtitles) {
html += '<div class="libraryReportIndicator clearLibraryReportIndicator"><div class="ui-icon-check ui-btn-icon-notext"></div></div>';
2014-03-02 13:44:48 -07:00
}
2014-03-03 21:53:48 -07:00
break;
}
case 'Runtime':
{
if (item.RunTimeTicks) {
html += Dashboard.getDisplayTime(item.RunTimeTicks);
} else {
html += '&nbsp;';
}
break;
}
case 'Trailers':
{
if (item.LocalTrailerCount) {
2014-03-02 13:44:48 -07:00
2014-03-03 21:53:48 -07:00
html += '<div class="libraryReportIndicator clearLibraryReportIndicator"><div class="ui-icon-check ui-btn-icon-notext"></div></div>';
}
break;
2014-03-02 13:44:48 -07:00
}
2014-03-03 21:53:48 -07:00
case 'Specials':
{
if (item.SpecialFeatureCount) {
html += '<div class="libraryReportIndicator clearLibraryReportIndicator"><div class="ui-icon-check ui-btn-icon-notext"></div></div>';
}
break;
}
2014-03-08 11:17:05 -07:00
2014-03-03 21:53:48 -07:00
case 'Season':
{
if (item.Type == "Episode") {
html += item.ParentIndexNumber == null ? '' : ('Season ' + item.ParentIndexNumber);
} else {
2014-03-04 19:59:59 -07:00
html += '<a href="edititemmetadata.html?id=' + item.Id + '">' + LibraryBrowser.getPosterViewDisplayName(item, false, false) + '</a>';
2014-03-03 21:53:48 -07:00
}
break;
2014-03-02 13:44:48 -07:00
}
2014-03-03 21:53:48 -07:00
case 'Name':
{
2014-03-04 19:59:59 -07:00
html += '<a href="edititemmetadata.html?id=' + item.Id + '">' + LibraryBrowser.getPosterViewDisplayName(item, false, false) + '</a>';
2014-03-03 21:53:48 -07:00
break;
}
2014-03-08 11:17:05 -07:00
case 'Community Rating':
{
html += item.CommunityRating || '&nbsp;';
break;
}
case 'Parental Rating':
2014-03-03 21:53:48 -07:00
{
html += item.OfficialRating || '&nbsp;';
break;
}
2014-03-08 11:17:05 -07:00
2014-03-03 21:53:48 -07:00
case 'Year':
case 'Release Date':
{
if (item.PremiereDate && item.Type != "Series") {
try {
var date = parseISO8601Date(item.PremiereDate, { toLocal: true });
html += date.toLocaleDateString();
}
catch (e) {
html += '&nbsp;';
}
}
else if (item.ProductionYear) {
html += item.ProductionYear;
2014-03-02 13:44:48 -07:00
2014-03-03 21:53:48 -07:00
if (item.Status == "Continuing") {
html += "-Present";
}
else if (item.EndDate) {
2014-03-02 13:44:48 -07:00
2014-03-03 21:53:48 -07:00
try {
2014-03-02 13:44:48 -07:00
2014-03-03 21:53:48 -07:00
var endYear = parseISO8601Date(item.EndDate, { toLocal: true }).getFullYear();
2014-03-02 13:44:48 -07:00
2014-03-03 21:53:48 -07:00
if (endYear != item.ProductionYear) {
html += "-" + parseISO8601Date(item.EndDate, { toLocal: true }).getFullYear();
}
2014-03-03 21:53:48 -07:00
}
catch (e) {
console.log("Error parsing date: " + item.EndDate);
}
}
} else {
html += '&nbsp;';
}
break;
}
case 'Date Added':
{
if (item.DateCreated) {
try {
html += parseISO8601Date(item.DateCreated, { toLocal: true }).toLocaleDateString();
}
catch (e) {
html += '&nbsp;';
}
}
break;
}
default:
{
if (item.LockData) {
html += '<img src="css/images/editor/lock.png" />';
}
if (item.IsUnidentified) {
html += '<div class="libraryReportIndicator"><div class="ui-icon-alert ui-btn-icon-notext"></div></div>';
}
if (!item.LocalTrailerCount && item.Type == "Movie") {
html += '<img src="css/images/editor/missingtrailer.png" title="Missing local trailer." />';
}
2014-03-02 19:17:12 -07:00
2014-03-03 21:53:48 -07:00
if (!item.ImageTags || !item.ImageTags.Primary) {
2014-03-04 19:59:59 -07:00
html += '<a href="edititemimages.html?id=' + item.Id + '"><img src="css/images/editor/missingprimaryimage.png" title="Missing primary image." /></a>';
2014-03-03 21:53:48 -07:00
}
if (!item.BackdropImageTags || !item.BackdropImageTags.length) {
2014-03-17 18:45:41 -07:00
if (item.Type !== "Episode" && item.Type !== "Season" && item.MediaType !== "Audio" && item.Type !== "TvChannel" && item.Type !== "MusicAlbum") {
2014-03-04 19:59:59 -07:00
html += '<a href="edititemimages.html?id=' + item.Id + '"><img src="css/images/editor/missingbackdrop.png" title="Missing backdrop image." /></a>';
2014-03-03 21:53:48 -07:00
}
}
if (!item.ImageTags || !item.ImageTags.Logo) {
if (item.Type == "Movie" || item.Type == "Trailer" || item.Type == "Series" || item.Type == "MusicArtist" || item.Type == "BoxSet") {
2014-03-04 19:59:59 -07:00
html += '<a href="edititemimages.html?id=' + item.Id + '"><img src="css/images/editor/missinglogo.png" title="Missing logo image." /></a>';
2014-03-03 21:53:48 -07:00
}
}
2014-03-02 19:17:12 -07:00
2014-03-03 21:53:48 -07:00
break;
}
}
2014-03-02 19:17:12 -07:00
html += '</td>';
2014-03-03 21:53:48 -07:00
return html;
2014-03-02 19:17:12 -07:00
2014-03-03 21:53:48 -07:00
}).join('');
}
2014-03-02 19:17:12 -07:00
2014-03-08 11:17:05 -07:00
function getReportHtml(items, reportType, currentSortField, currentSortDirection) {
2014-03-02 19:17:12 -07:00
2014-03-03 21:53:48 -07:00
var html = '';
2014-03-02 19:17:12 -07:00
2014-03-08 11:17:05 -07:00
html += '<table id="tblReport" data-role="table" data-mode="reflow" class="tblLibraryReport stripedTable ui-responsive table-stroke detailTable" style="display:table;">';
2014-03-02 19:17:12 -07:00
2014-03-03 21:53:48 -07:00
html += '<thead>';
html += '<tr>';
2014-03-02 19:17:12 -07:00
2014-03-03 21:53:48 -07:00
var cells = getHeaderCells(reportType);
2014-03-02 19:17:12 -07:00
2014-03-03 21:53:48 -07:00
html += cells.map(function (c) {
2014-03-02 13:44:48 -07:00
2014-03-08 11:17:05 -07:00
var cellHtml = '<th data-priority="' + (c.priority || 'persist') + '">';
if (c.sortField) {
cellHtml += '<a class="lnkColumnSort" href="#" data-sortfield="' + c.sortField + '" style="text-decoration:underline;">';
}
cellHtml += (c.name || '&nbsp;');
if (c.sortField) {
2014-03-08 11:17:05 -07:00
cellHtml += '</a>';
if (c.sortField == currentSortField) {
if (currentSortDirection == "Descending") {
cellHtml += '<span style="font-weight:bold;margin-left:5px;vertical-align:top;font-size:12px;">&darr;</span>';
} else {
cellHtml += '<span style="font-weight:bold;margin-left:5px;vertical-align:top;font-size:12px;">&uarr;</span>';
}
}
}
cellHtml += '</th>';
return cellHtml;
2014-03-02 13:44:48 -07:00
2014-03-03 21:53:48 -07:00
}).join('');
2014-03-02 13:44:48 -07:00
2014-03-03 21:53:48 -07:00
html += '</tr>';
html += '</thead>';
2014-03-02 13:44:48 -07:00
2014-03-03 21:53:48 -07:00
html += '<tbody>';
for (var i = 0, length = items.length; i < length; i++) {
var item = items[i];
2014-03-02 13:44:48 -07:00
2014-03-03 21:53:48 -07:00
html += '<tr>';
html += getItemCellsHtml(item, cells);
2014-03-02 13:44:48 -07:00
html += '</tr>';
}
2014-03-03 21:53:48 -07:00
html += '</tbody>';
html += '</table>';
2014-03-02 13:44:48 -07:00
return html;
}
2014-03-03 21:53:48 -07:00
function renderItems(page, result, reportType) {
2014-03-02 13:44:48 -07:00
// Scroll back up so they can see the results from the beginning
$(document).scrollTop(0);
2014-03-17 07:48:16 -07:00
$('.listTopPaging', page).html(LibraryBrowser.getPagingHtml(query, result.TotalRecordCount, false, [], false)).trigger('create');
2014-03-02 13:44:48 -07:00
updateFilterControls(page);
2014-03-17 07:48:16 -07:00
$('.listBottomPaging', page).html(LibraryBrowser.getPagingHtml(query, result.TotalRecordCount, false, [], false)).trigger('create');
2014-03-02 13:44:48 -07:00
2014-03-08 11:17:05 -07:00
$('.reportContainer', page).html(getReportHtml(result.Items, reportType, query.SortBy, query.SortOrder)).trigger('create');
2014-03-02 13:44:48 -07:00
$('.btnNextPage', page).on('click', function () {
query.StartIndex += query.Limit;
reloadItems(page);
});
$('.btnPreviousPage', page).on('click', function () {
query.StartIndex -= query.Limit;
reloadItems(page);
});
2014-03-08 11:17:05 -07:00
$('.lnkColumnSort', page).on('click', function () {
var order = this.getAttribute('data-sortfield');
if (query.SortBy == order) {
if (query.SortOrder == "Descending") {
query.SortOrder = "Ascending";
query.SortBy = defaultSortBy;
} else {
query.SortOrder = "Descending";
query.SortBy = order;
}
} else {
query.SortOrder = "Ascending";
query.SortBy = order;
}
query.StartIndex = 0;
reloadItems(page);
});
2014-03-02 13:44:48 -07:00
}
function reloadItems(page) {
var url = ApiClient.getUrl("Items", query);
2014-03-03 21:53:48 -07:00
var reportType = $('#selectView', page).val();
2014-03-02 13:44:48 -07:00
$.getJSON(url).done(function (result) {
2014-03-03 21:53:48 -07:00
renderItems(page, result, reportType);
2014-03-02 13:44:48 -07:00
});
}
function updateFilterControls(page) {
2014-03-02 19:17:12 -07:00
$('#selectView').val(query.IncludeItemTypes).selectmenu('refresh');
2014-03-02 13:44:48 -07:00
$('.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');
$('#chkHD', page).checked(query.IsHD == true).checkboxradio('refresh');
$('#chkSD', page).checked(query.IsHD == false).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');
2014-03-03 21:53:48 -07:00
$('#chkIsPlaceHolder', page).checked(query.IsPlaceHolder == true).checkboxradio('refresh');
2014-03-02 13:44:48 -07:00
2014-03-03 21:53:48 -07:00
$('#chkMissingRating', page).checked(query.HasOfficialRating == false).checkboxradio('refresh');
2014-03-02 13:44:48 -07:00
$('#chkMissingOverview', page).checked(query.HasOverview == false).checkboxradio('refresh');
$('#chkYearMismatch', page).checked(query.IsYearMismatched == true).checkboxradio('refresh');
$('#chkIsUnidentified', page).checked(query.IsUnidentified == true).checkboxradio('refresh');
$('#chkIsLocked', page).checked(query.IsLocked == true).checkboxradio('refresh');
2014-03-03 21:53:48 -07:00
$('#chkSpecialEpisode', page).checked(query.ParentIndexNumber == 0).checkboxradio('refresh');
$('#chkMissingEpisode', page).checked(query.IsMissing == true).checkboxradio('refresh');
$('#chkFutureEpisode', page).checked(query.IsUnaired == true).checkboxradio('refresh');
2014-03-02 13:44:48 -07:00
}
$(document).on('pageinit', "#libraryReportPage", function () {
var page = this;
$('.libraryTree', page).on('itemclicked', function (event, data) {
if (data.itemType == "libraryreport") {
return;
}
if (data.itemType == "livetvservice") {
return;
}
Dashboard.navigate('edititemmetadata.html?id=' + data.id);
});
$('#radioBasicFilters', page).on('change', function () {
if (this.checked) {
$('.basicFilters', page).show();
$('.advancedFilters', page).hide();
} else {
$('.basicFilters', page).hide();
}
});
$('#radioAdvancedFilters', page).on('change', function () {
if (this.checked) {
$('.advancedFilters', page).show();
$('.basicFilters', page).hide();
} else {
$('.advancedFilters', page).hide();
}
});
2014-03-02 19:17:12 -07:00
$('#selectView', page).on('change', function () {
2014-03-02 13:44:48 -07:00
query.StartIndex = 0;
2014-03-02 19:17:12 -07:00
query.IncludeItemTypes = this.value;
2014-03-02 13:44:48 -07:00
query.SortBy = getDefaultSortOrder(this.value);
query.SortOrder = "Ascending";
2014-03-02 13:44:48 -07:00
reloadItems(page);
});
$('.chkVideoTypeFilter', page).on('change', function () {
var filterName = this.getAttribute('data-filter');
var filters = query.VideoTypes || "";
filters = (',' + filters).replace(',' + filterName, '').substring(1);
if (this.checked) {
filters = filters ? (filters + ',' + filterName) : filterName;
}
query.StartIndex = 0;
query.VideoTypes = filters;
reloadItems(page);
});
$('#chk3D', page).on('change', function () {
query.StartIndex = 0;
query.Is3D = this.checked ? true : null;
reloadItems(page);
});
$('#chkHD', page).on('change', function () {
query.StartIndex = 0;
query.IsHD = this.checked ? true : null;
reloadItems(page);
});
$('#chkSD', page).on('change', function () {
query.StartIndex = 0;
query.IsHD = this.checked ? false : null;
reloadItems(page);
});
$('#chkSubtitle', page).on('change', function () {
query.StartIndex = 0;
query.HasSubtitles = this.checked ? true : null;
reloadItems(page);
});
$('#chkTrailer', page).on('change', function () {
query.StartIndex = 0;
query.HasTrailer = this.checked ? true : null;
reloadItems(page);
});
$('#chkSpecialFeature', page).on('change', function () {
query.StartIndex = 0;
query.HasSpecialFeature = this.checked ? true : null;
reloadItems(page);
});
2014-03-03 21:53:48 -07:00
$('#chkIsPlaceHolder', page).on('change', function () {
query.StartIndex = 0;
query.IsPlaceHolder = this.checked ? true : null;
reloadItems(page);
});
2014-03-02 13:44:48 -07:00
$('#chkThemeSong', page).on('change', function () {
query.StartIndex = 0;
query.HasThemeSong = this.checked ? true : null;
reloadItems(page);
});
$('#chkThemeVideo', page).on('change', function () {
query.StartIndex = 0;
query.HasThemeVideo = this.checked ? true : null;
reloadItems(page);
});
$('#chkMissingOverview', page).on('change', function () {
query.StartIndex = 0;
query.HasOverview = this.checked ? false : null;
reloadItems(page);
});
2014-03-03 21:53:48 -07:00
$('#chkMissingRating', page).on('change', function () {
query.StartIndex = 0;
query.HasOfficialRating = this.checked ? false : null;
reloadItems(page);
});
2014-03-02 13:44:48 -07:00
$('#chkYearMismatch', page).on('change', function () {
query.StartIndex = 0;
query.IsYearMismatched = this.checked ? true : null;
reloadItems(page);
});
$('#chkIsUnidentified', page).on('change', function () {
query.StartIndex = 0;
query.IsUnidentified = this.checked ? true : null;
reloadItems(page);
});
$('#chkIsLocked', page).on('change', function () {
query.StartIndex = 0;
query.IsLocked = this.checked ? true : null;
reloadItems(page);
});
2014-03-03 21:53:48 -07:00
$('#chkMissingEpisode', page).on('change', function () {
query.StartIndex = 0;
query.IsMissing = this.checked ? true : false;
reloadItems(page);
});
$('#chkFutureEpisode', page).on('change', function () {
query.StartIndex = 0;
if (this.checked) {
query.IsUnaired = true;
query.IsVirtualUnaired = null;
} else {
query.IsUnaired = null;
query.IsVirtualUnaired = false;
}
reloadItems(page);
});
$('#chkSpecialEpisode', page).on('change', function () {
query.ParentIndexNumber = this.checked ? 0 : null;
reloadItems(page);
});
2014-03-02 13:44:48 -07:00
}).on('pagebeforeshow', "#libraryReportPage", function () {
var page = this;
query.SortBy = getDefaultSortOrder($('#selectView', page).val());
query.SortOrder = "Ascending";
2014-03-02 13:44:48 -07:00
reloadItems(page);
}).on('pageshow', "#libraryReportPage", function () {
updateFilterControls(this);
});
})(jQuery, document, window);