mirror of
https://github.com/jellyfin/jellyfin-web
synced 2025-03-30 19:56:21 +00:00
update channel filters
This commit is contained in:
parent
413a255477
commit
d4504e80a2
12 changed files with 248 additions and 326 deletions
|
@ -103,11 +103,10 @@
|
|||
startIndex: query.StartIndex,
|
||||
limit: query.Limit,
|
||||
totalRecordCount: result.TotalRecordCount,
|
||||
viewButton: true,
|
||||
showLimit: false,
|
||||
updatePageSizeSetting: false,
|
||||
viewIcon: 'filter-list',
|
||||
sortButton: true
|
||||
sortButton: true,
|
||||
filterButton: true
|
||||
});
|
||||
|
||||
page.querySelector('.listTopPaging').innerHTML = pagingHtml;
|
||||
|
@ -140,6 +139,10 @@
|
|||
reloadItems(page);
|
||||
});
|
||||
|
||||
$('.btnFilter', page).on('click', function () {
|
||||
showFilterMenu(page);
|
||||
});
|
||||
|
||||
// On callback make sure to set StartIndex = 0
|
||||
$('.btnSort', page).on('click', function () {
|
||||
showSortMenu(page);
|
||||
|
@ -153,6 +156,22 @@
|
|||
});
|
||||
}
|
||||
|
||||
function showFilterMenu(page) {
|
||||
|
||||
require(['components/filterdialog/filterdialog'], function (filterDialogFactory) {
|
||||
|
||||
var filterDialog = new filterDialogFactory({
|
||||
query: getQuery()
|
||||
});
|
||||
|
||||
Events.on(filterDialog, 'filterchange', function () {
|
||||
reloadItems(page);
|
||||
});
|
||||
|
||||
filterDialog.show();
|
||||
});
|
||||
}
|
||||
|
||||
function showSortMenu(page) {
|
||||
|
||||
var sortFields = getPageData().sortFields;
|
||||
|
@ -213,15 +232,6 @@
|
|||
function updateFilterControls(page) {
|
||||
|
||||
var query = getQuery();
|
||||
$('.chkStandardFilter', page).each(function () {
|
||||
|
||||
var filters = "," + (query.Filters || "");
|
||||
var filterName = this.getAttribute('data-filter');
|
||||
|
||||
this.checked = filters.indexOf(',' + filterName) != -1;
|
||||
|
||||
});
|
||||
|
||||
$('.alphabetPicker', page).alphaValue(query.NameStartsWith);
|
||||
}
|
||||
|
||||
|
@ -229,24 +239,6 @@
|
|||
|
||||
var page = this;
|
||||
|
||||
$('.chkStandardFilter', this).on('change', function () {
|
||||
|
||||
var query = getQuery();
|
||||
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);
|
||||
});
|
||||
|
||||
$('.alphabetPicker', this).on('alphaselect', function (e, character) {
|
||||
|
||||
var query = getQuery();
|
||||
|
|
|
@ -30,12 +30,9 @@
|
|||
startIndex: query.StartIndex,
|
||||
limit: query.Limit,
|
||||
totalRecordCount: result.TotalRecordCount,
|
||||
viewButton: true,
|
||||
showLimit: false
|
||||
}));
|
||||
|
||||
updateFilterControls(page);
|
||||
|
||||
html = LibraryBrowser.getPosterViewHtml({
|
||||
items: result.Items,
|
||||
shape: "backdrop",
|
||||
|
@ -66,39 +63,7 @@
|
|||
});
|
||||
}
|
||||
|
||||
function updateFilterControls(page) {
|
||||
|
||||
$('#selectPageSize', page).val(query.Limit);
|
||||
}
|
||||
|
||||
$(document).on('pageinit', "#gameGenresPage", function () {
|
||||
|
||||
var page = this;
|
||||
|
||||
$('.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);
|
||||
});
|
||||
|
||||
$('#selectPageSize', page).on('change', function () {
|
||||
query.Limit = parseInt(this.value);
|
||||
query.StartIndex = 0;
|
||||
reloadItems(page);
|
||||
});
|
||||
|
||||
}).on('pagebeforeshow', "#gameGenresPage", function () {
|
||||
$(document).on('pagebeforeshow', "#gameGenresPage", function () {
|
||||
|
||||
query.ParentId = LibraryMenu.getTopParentId();
|
||||
|
||||
|
@ -113,8 +78,6 @@
|
|||
LibraryBrowser.loadSavedQueryValues(getSavedQueryKey(), query);
|
||||
|
||||
reloadItems(this);
|
||||
|
||||
updateFilterControls(this);
|
||||
});
|
||||
|
||||
})(jQuery, document);
|
|
@ -31,12 +31,9 @@
|
|||
startIndex: query.StartIndex,
|
||||
limit: query.Limit,
|
||||
totalRecordCount: result.TotalRecordCount,
|
||||
viewButton: true,
|
||||
showLimit: false
|
||||
}));
|
||||
|
||||
updateFilterControls(page);
|
||||
|
||||
html = LibraryBrowser.getPosterViewHtml({
|
||||
items: result.Items,
|
||||
shape: "backdrop",
|
||||
|
@ -45,7 +42,6 @@
|
|||
showItemCounts: true,
|
||||
centerText: true,
|
||||
lazy: true
|
||||
|
||||
});
|
||||
|
||||
var elem = page.querySelector('#items');
|
||||
|
@ -68,39 +64,7 @@
|
|||
});
|
||||
}
|
||||
|
||||
function updateFilterControls(page) {
|
||||
|
||||
$('#selectPageSize', page).val(query.Limit);
|
||||
}
|
||||
|
||||
$(document).on('pageinit', "#gameStudiosPage", function () {
|
||||
|
||||
var page = this;
|
||||
|
||||
$('.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);
|
||||
});
|
||||
|
||||
$('#selectPageSize', page).on('change', function () {
|
||||
query.Limit = parseInt(this.value);
|
||||
query.StartIndex = 0;
|
||||
reloadItems(page);
|
||||
});
|
||||
|
||||
}).on('pagebeforeshow', "#gameStudiosPage", function () {
|
||||
$(document).on('pagebeforeshow', "#gameStudiosPage", function () {
|
||||
|
||||
query.ParentId = LibraryMenu.getTopParentId();
|
||||
|
||||
|
@ -115,8 +79,6 @@
|
|||
LibraryBrowser.loadSavedQueryValues(getSavedQueryKey(), query);
|
||||
|
||||
reloadItems(this);
|
||||
|
||||
updateFilterControls(this);
|
||||
});
|
||||
|
||||
})(jQuery, document);
|
|
@ -2821,7 +2821,7 @@
|
|||
html += '</span>';
|
||||
}
|
||||
|
||||
if (showControls || options.viewButton || options.sortButton || options.addLayoutButton) {
|
||||
if (showControls || options.viewButton || options.filterButton || options.sortButton || options.addLayoutButton) {
|
||||
|
||||
html += '<div style="display:inline-block;margin-left:10px;">';
|
||||
|
||||
|
@ -2849,6 +2849,11 @@
|
|||
html += '<paper-icon-button title="' + title + '" icon="' + (options.viewIcon || AppInfo.moreIcon) + '" onclick="LibraryBrowser.openViewPanel(this, \'' + viewPanelClass + '\');"></paper-icon-button>';
|
||||
}
|
||||
|
||||
if (options.filterButton) {
|
||||
|
||||
html += '<paper-icon-button class="btnFilter" title="' + Globalize.translate('ButtonFilter') + '" icon="filter-list"></paper-icon-button>';
|
||||
}
|
||||
|
||||
html += '</div>';
|
||||
|
||||
if (showControls && options.showLimit) {
|
||||
|
|
|
@ -652,143 +652,142 @@
|
|||
|
||||
self.createStreamInfo = function (type, item, mediaSource, startPosition) {
|
||||
|
||||
var deferred = $.Deferred();
|
||||
return new Promise(function (resolve, reject) {
|
||||
|
||||
var mediaUrl;
|
||||
var contentType;
|
||||
var startTimeTicksOffset = 0;
|
||||
var mediaUrl;
|
||||
var contentType;
|
||||
var startTimeTicksOffset = 0;
|
||||
|
||||
var startPositionInSeekParam = startPosition ? (startPosition / 10000000) : 0;
|
||||
var seekParam = startPositionInSeekParam ? '#t=' + startPositionInSeekParam : '';
|
||||
var playMethod = 'Transcode';
|
||||
var startPositionInSeekParam = startPosition ? (startPosition / 10000000) : 0;
|
||||
var seekParam = startPositionInSeekParam ? '#t=' + startPositionInSeekParam : '';
|
||||
var playMethod = 'Transcode';
|
||||
|
||||
if (type == 'Video') {
|
||||
if (type == 'Video') {
|
||||
|
||||
contentType = 'video/' + mediaSource.Container;
|
||||
contentType = 'video/' + mediaSource.Container;
|
||||
|
||||
if (mediaSource.enableDirectPlay) {
|
||||
mediaUrl = mediaSource.Path;
|
||||
if (mediaSource.enableDirectPlay) {
|
||||
mediaUrl = mediaSource.Path;
|
||||
|
||||
playMethod = 'DirectPlay';
|
||||
playMethod = 'DirectPlay';
|
||||
|
||||
} else {
|
||||
} else {
|
||||
|
||||
if (mediaSource.SupportsDirectStream) {
|
||||
if (mediaSource.SupportsDirectStream) {
|
||||
|
||||
var directOptions = {
|
||||
Static: true,
|
||||
mediaSourceId: mediaSource.Id,
|
||||
deviceId: ApiClient.deviceId(),
|
||||
api_key: ApiClient.accessToken()
|
||||
};
|
||||
var directOptions = {
|
||||
Static: true,
|
||||
mediaSourceId: mediaSource.Id,
|
||||
deviceId: ApiClient.deviceId(),
|
||||
api_key: ApiClient.accessToken()
|
||||
};
|
||||
|
||||
if (mediaSource.LiveStreamId) {
|
||||
directOptions.LiveStreamId = mediaSource.LiveStreamId;
|
||||
}
|
||||
|
||||
mediaUrl = ApiClient.getUrl('Videos/' + item.Id + '/stream.' + mediaSource.Container, directOptions);
|
||||
mediaUrl += seekParam;
|
||||
|
||||
playMethod = 'DirectStream';
|
||||
} else if (mediaSource.SupportsTranscoding) {
|
||||
|
||||
mediaUrl = ApiClient.getUrl(mediaSource.TranscodingUrl);
|
||||
|
||||
if (mediaSource.TranscodingSubProtocol == 'hls') {
|
||||
|
||||
mediaUrl += seekParam;
|
||||
contentType = 'application/x-mpegURL';
|
||||
|
||||
} else {
|
||||
|
||||
// Reports of stuttering with h264 stream copy in IE
|
||||
if (mediaUrl.indexOf('.mkv') == -1) {
|
||||
mediaUrl += '&EnableAutoStreamCopy=false';
|
||||
if (mediaSource.LiveStreamId) {
|
||||
directOptions.LiveStreamId = mediaSource.LiveStreamId;
|
||||
}
|
||||
startTimeTicksOffset = startPosition || 0;
|
||||
|
||||
contentType = 'video/' + mediaSource.TranscodingContainer;
|
||||
mediaUrl = ApiClient.getUrl('Videos/' + item.Id + '/stream.' + mediaSource.Container, directOptions);
|
||||
mediaUrl += seekParam;
|
||||
|
||||
playMethod = 'DirectStream';
|
||||
} else if (mediaSource.SupportsTranscoding) {
|
||||
|
||||
mediaUrl = ApiClient.getUrl(mediaSource.TranscodingUrl);
|
||||
|
||||
if (mediaSource.TranscodingSubProtocol == 'hls') {
|
||||
|
||||
mediaUrl += seekParam;
|
||||
contentType = 'application/x-mpegURL';
|
||||
|
||||
} else {
|
||||
|
||||
// Reports of stuttering with h264 stream copy in IE
|
||||
if (mediaUrl.indexOf('.mkv') == -1) {
|
||||
mediaUrl += '&EnableAutoStreamCopy=false';
|
||||
}
|
||||
startTimeTicksOffset = startPosition || 0;
|
||||
|
||||
contentType = 'video/' + mediaSource.TranscodingContainer;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
} else {
|
||||
|
||||
contentType = 'audio/' + mediaSource.Container;
|
||||
|
||||
if (mediaSource.enableDirectPlay) {
|
||||
|
||||
mediaUrl = mediaSource.Path;
|
||||
|
||||
playMethod = 'DirectPlay';
|
||||
|
||||
} else {
|
||||
|
||||
var isDirectStream = mediaSource.SupportsDirectStream;
|
||||
contentType = 'audio/' + mediaSource.Container;
|
||||
|
||||
if (isDirectStream) {
|
||||
if (mediaSource.enableDirectPlay) {
|
||||
|
||||
var outputContainer = (mediaSource.Container || '').toLowerCase();
|
||||
mediaUrl = mediaSource.Path;
|
||||
|
||||
var directOptions = {
|
||||
Static: true,
|
||||
mediaSourceId: mediaSource.Id,
|
||||
deviceId: ApiClient.deviceId(),
|
||||
api_key: ApiClient.accessToken()
|
||||
};
|
||||
playMethod = 'DirectPlay';
|
||||
|
||||
if (mediaSource.LiveStreamId) {
|
||||
directOptions.LiveStreamId = mediaSource.LiveStreamId;
|
||||
}
|
||||
} else {
|
||||
|
||||
mediaUrl = ApiClient.getUrl('Audio/' + item.Id + '/stream.' + outputContainer, directOptions);
|
||||
mediaUrl += seekParam;
|
||||
var isDirectStream = mediaSource.SupportsDirectStream;
|
||||
|
||||
playMethod = 'DirectStream';
|
||||
if (isDirectStream) {
|
||||
|
||||
} else if (mediaSource.SupportsTranscoding) {
|
||||
var outputContainer = (mediaSource.Container || '').toLowerCase();
|
||||
|
||||
mediaUrl = ApiClient.getUrl(mediaSource.TranscodingUrl);
|
||||
var directOptions = {
|
||||
Static: true,
|
||||
mediaSourceId: mediaSource.Id,
|
||||
deviceId: ApiClient.deviceId(),
|
||||
api_key: ApiClient.accessToken()
|
||||
};
|
||||
|
||||
if (mediaSource.TranscodingSubProtocol == 'hls') {
|
||||
if (mediaSource.LiveStreamId) {
|
||||
directOptions.LiveStreamId = mediaSource.LiveStreamId;
|
||||
}
|
||||
|
||||
mediaUrl = ApiClient.getUrl('Audio/' + item.Id + '/stream.' + outputContainer, directOptions);
|
||||
mediaUrl += seekParam;
|
||||
contentType = 'application/x-mpegURL';
|
||||
} else {
|
||||
|
||||
startTimeTicksOffset = startPosition || 0;
|
||||
contentType = 'audio/' + mediaSource.TranscodingContainer;
|
||||
playMethod = 'DirectStream';
|
||||
|
||||
} else if (mediaSource.SupportsTranscoding) {
|
||||
|
||||
mediaUrl = ApiClient.getUrl(mediaSource.TranscodingUrl);
|
||||
|
||||
if (mediaSource.TranscodingSubProtocol == 'hls') {
|
||||
|
||||
mediaUrl += seekParam;
|
||||
contentType = 'application/x-mpegURL';
|
||||
} else {
|
||||
|
||||
startTimeTicksOffset = startPosition || 0;
|
||||
contentType = 'audio/' + mediaSource.TranscodingContainer;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
var resultInfo = {
|
||||
url: mediaUrl,
|
||||
mimeType: contentType,
|
||||
startTimeTicksOffset: startTimeTicksOffset,
|
||||
startPositionInSeekParam: startPositionInSeekParam,
|
||||
playMethod: playMethod
|
||||
};
|
||||
var resultInfo = {
|
||||
url: mediaUrl,
|
||||
mimeType: contentType,
|
||||
startTimeTicksOffset: startTimeTicksOffset,
|
||||
startPositionInSeekParam: startPositionInSeekParam,
|
||||
playMethod: playMethod
|
||||
};
|
||||
|
||||
if (playMethod == 'DirectPlay' && mediaSource.Protocol == 'File') {
|
||||
if (playMethod == 'DirectPlay' && mediaSource.Protocol == 'File') {
|
||||
|
||||
require(['localassetmanager'], function () {
|
||||
require(['localassetmanager'], function () {
|
||||
|
||||
LocalAssetManager.translateFilePath(resultInfo.url).then(function (path) {
|
||||
LocalAssetManager.translateFilePath(resultInfo.url).then(function (path) {
|
||||
|
||||
resultInfo.url = path;
|
||||
console.log('LocalAssetManager.translateFilePath: path: ' + resultInfo.url + ' result: ' + path);
|
||||
deferred.resolveWith(null, [resultInfo]);
|
||||
resultInfo.url = path;
|
||||
console.log('LocalAssetManager.translateFilePath: path: ' + resultInfo.url + ' result: ' + path);
|
||||
resolve(resultInfo);
|
||||
});
|
||||
});
|
||||
});
|
||||
|
||||
}
|
||||
else {
|
||||
deferred.resolveWith(null, [resultInfo]);
|
||||
}
|
||||
|
||||
return deferred.promise();
|
||||
}
|
||||
else {
|
||||
resolve(resultInfo);
|
||||
}
|
||||
});
|
||||
};
|
||||
|
||||
self.lastBitrateDetections = {};
|
||||
|
|
|
@ -2142,8 +2142,6 @@ var AppInfo = {};
|
|||
deps.push('scripts/mediacontroller');
|
||||
deps.push('scripts/globalize');
|
||||
|
||||
deps.push('jQuery');
|
||||
|
||||
deps.push('paper-drawer-panel');
|
||||
|
||||
require(deps, function (events) {
|
||||
|
@ -2197,26 +2195,14 @@ var AppInfo = {};
|
|||
MediaBrowser[i] = connectionManagerExports[i];
|
||||
}
|
||||
|
||||
// TODO: This needs to be deprecated, but it's used heavily
|
||||
$.fn.checked = function (value) {
|
||||
if (value === true || value === false) {
|
||||
// Set the value of the checkbox
|
||||
return $(this).each(function () {
|
||||
this.checked = value;
|
||||
});
|
||||
} else {
|
||||
// Return check state
|
||||
return this.length && this[0].checked;
|
||||
}
|
||||
};
|
||||
|
||||
var promises = [];
|
||||
deps = [];
|
||||
deps.push('scripts/mediaplayer');
|
||||
deps.push('emby-icons');
|
||||
deps.push('paper-icon-button');
|
||||
deps.push('paper-button');
|
||||
deps.push('jqm');
|
||||
deps.push('jQuery');
|
||||
|
||||
promises.push(getRequirePromise(deps));
|
||||
|
||||
promises.push(Globalize.ensure());
|
||||
|
@ -2256,6 +2242,19 @@ var AppInfo = {};
|
|||
|
||||
require(depends, function () {
|
||||
|
||||
// TODO: This needs to be deprecated, but it's used heavily
|
||||
$.fn.checked = function (value) {
|
||||
if (value === true || value === false) {
|
||||
// Set the value of the checkbox
|
||||
return $(this).each(function () {
|
||||
this.checked = value;
|
||||
});
|
||||
} else {
|
||||
// Return check state
|
||||
return this.length && this[0].checked;
|
||||
}
|
||||
};
|
||||
|
||||
// Don't like having to use jQuery here, but it takes care of making sure that embedded script executes
|
||||
$(mainDrawerPanelContent).html(Globalize.translateDocument(newHtml, 'html'));
|
||||
onAppReady();
|
||||
|
@ -2317,6 +2316,7 @@ var AppInfo = {};
|
|||
deps.push('scripts/backdrops');
|
||||
deps.push('scripts/librarymenu');
|
||||
deps.push('scripts/librarybrowser');
|
||||
deps.push('jqm');
|
||||
|
||||
deps.push('css!css/card.css');
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue