mirror of
https://github.com/jellyfin/jellyfin-web
synced 2025-03-30 19:56:21 +00:00
add filters to folder browsing
This commit is contained in:
parent
8d53d9508c
commit
6ac9b1bd2a
9 changed files with 192 additions and 17 deletions
|
@ -1,5 +1,7 @@
|
|||
(function ($, document) {
|
||||
|
||||
var view = "Poster";
|
||||
|
||||
// The base query options
|
||||
var query = {
|
||||
|
||||
|
@ -26,10 +28,19 @@
|
|||
html += LibraryBrowser.getPagingHtml(query, result.TotalRecordCount, true);
|
||||
}
|
||||
|
||||
html += LibraryBrowser.getPosterDetailViewHtml({
|
||||
items: result.Items,
|
||||
useAverageAspectRatio: true
|
||||
});
|
||||
if (view == "Backdrop") {
|
||||
html += LibraryBrowser.getPosterDetailViewHtml({
|
||||
items: result.Items,
|
||||
useAverageAspectRatio: true,
|
||||
preferBackdrop: true
|
||||
});
|
||||
}
|
||||
else if (view == "Poster") {
|
||||
html += LibraryBrowser.getPosterDetailViewHtml({
|
||||
items: result.Items,
|
||||
useAverageAspectRatio: true
|
||||
});
|
||||
}
|
||||
|
||||
if (showPaging) {
|
||||
html += LibraryBrowser.getPagingHtml(query, result.TotalRecordCount);
|
||||
|
@ -64,12 +75,76 @@
|
|||
|
||||
$(document).on('pageinit', "#itemListPage", function () {
|
||||
|
||||
var page = this;
|
||||
|
||||
$('.radioSortBy', this).on('click', function () {
|
||||
query.StartIndex = 0;
|
||||
query.SortBy = this.getAttribute('data-sortby');
|
||||
reloadItems(page);
|
||||
});
|
||||
|
||||
$('.radioSortOrder', this).on('click', function () {
|
||||
query.StartIndex = 0;
|
||||
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.StartIndex = 0;
|
||||
query.Filters = filters;
|
||||
|
||||
reloadItems(page);
|
||||
});
|
||||
|
||||
$('#selectView', this).on('change', function () {
|
||||
|
||||
view = this.value;
|
||||
|
||||
reloadItems(page);
|
||||
});
|
||||
|
||||
}).on('pageshow', "#itemListPage", function () {
|
||||
|
||||
query.ParentId = getParameterByName('parentId');
|
||||
query.Filters = "";
|
||||
query.SortBy = "SortName";
|
||||
query.SortOrder = "Ascending";
|
||||
|
||||
reloadItems(this);
|
||||
|
||||
// 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');
|
||||
|
||||
$('#selectView', this).val(view).selectmenu('refresh');
|
||||
});
|
||||
|
||||
})(jQuery, document);
|
|
@ -125,7 +125,7 @@
|
|||
html += '<p class="itemMiscInfo">' + childText + '</p>';
|
||||
}
|
||||
else {
|
||||
html += '<p class="itemMiscInfo">' + LibraryBrowser.getMiscInfoHtml(item, false) + '</p>';
|
||||
html += '<p class="itemMiscInfo">' + LibraryBrowser.getMiscInfoHtml(item) + '</p>';
|
||||
}
|
||||
|
||||
html += '<p class="userDataIcons">' + LibraryBrowser.getUserDataIconsHtml(item) + '</p>';
|
||||
|
@ -836,12 +836,17 @@
|
|||
return html;
|
||||
},
|
||||
|
||||
getMiscInfoHtml: function (item, includeMediaInfo) {
|
||||
getMiscInfoHtml: function (item) {
|
||||
|
||||
var miscInfo = [];
|
||||
|
||||
if (item.ProductionYear) {
|
||||
miscInfo.push(item.ProductionYear);
|
||||
|
||||
if (item.Status == "Continuing") {
|
||||
miscInfo.push(item.ProductionYear + "-Present");
|
||||
} else {
|
||||
miscInfo.push(item.ProductionYear);
|
||||
}
|
||||
}
|
||||
|
||||
if (item.OfficialRating) {
|
||||
|
@ -857,16 +862,13 @@
|
|||
miscInfo.push(parseInt(minutes) + "min");
|
||||
}
|
||||
|
||||
if (includeMediaInfo !== false) {
|
||||
if (item.DisplayMediaType) {
|
||||
miscInfo.push(item.DisplayMediaType);
|
||||
}
|
||||
|
||||
if (item.VideoFormat && item.VideoFormat !== 'Standard') {
|
||||
miscInfo.push(item.VideoFormat);
|
||||
}
|
||||
if (item.MediaType && item.DisplayMediaType) {
|
||||
miscInfo.push(item.DisplayMediaType);
|
||||
}
|
||||
|
||||
if (item.VideoFormat && item.VideoFormat !== 'Standard') {
|
||||
miscInfo.push(item.VideoFormat);
|
||||
}
|
||||
|
||||
return miscInfo.join(' ');
|
||||
},
|
||||
|
|
|
@ -127,6 +127,15 @@
|
|||
this.checked = query.SortOrder == this.getAttribute('data-sortorder');
|
||||
|
||||
}).checkboxradio('refresh');
|
||||
|
||||
$('.chkPersonTypeFilter', this).each(function () {
|
||||
|
||||
var filters = "," + (query.PersonTypes || "");
|
||||
var filterName = this.getAttribute('data-filter');
|
||||
|
||||
this.checked = filters.indexOf(',' + filterName) != -1;
|
||||
|
||||
}).checkboxradio('refresh');
|
||||
});
|
||||
|
||||
})(jQuery, document);
|
|
@ -139,7 +139,6 @@
|
|||
|
||||
}).on('pageshow', "#moviesPage", function () {
|
||||
|
||||
|
||||
// Reset form values using the last used query
|
||||
$('.radioSortBy', this).each(function () {
|
||||
|
||||
|
|
|
@ -136,6 +136,15 @@
|
|||
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');
|
||||
});
|
||||
|
||||
})(jQuery, document);
|
|
@ -69,6 +69,7 @@
|
|||
|
||||
$('#itemMiscInfo', page).html(LibraryBrowser.getMiscInfoHtml(item));
|
||||
|
||||
LibraryBrowser.renderPremiereDate($('#itemPremiereDate', page), item);
|
||||
LibraryBrowser.renderGenres($('#itemGenres', page), item);
|
||||
LibraryBrowser.renderStudios($('#itemStudios', page), item);
|
||||
renderUserDataIcons(page, item);
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue