mirror of
https://github.com/jellyfin/jellyfin-web
synced 2025-03-30 19:56:21 +00:00
Fix indentation of searchresults
This commit is contained in:
parent
436a59b56b
commit
9a520b6c29
1 changed files with 523 additions and 527 deletions
|
@ -8,9 +8,7 @@ import '../../elements/emby-button/emby-button';
|
|||
import ServerConnections from '../ServerConnections';
|
||||
import template from './searchresults.template.html';
|
||||
|
||||
/* eslint-disable indent */
|
||||
|
||||
function loadSuggestions(instance, context, apiClient) {
|
||||
function loadSuggestions(instance, context, apiClient) {
|
||||
const options = {
|
||||
|
||||
SortBy: 'IsFavoriteOrLiked,Random',
|
||||
|
@ -44,9 +42,9 @@ import template from './searchresults.template.html';
|
|||
searchSuggestions.classList.remove('hide');
|
||||
}
|
||||
});
|
||||
}
|
||||
}
|
||||
|
||||
function getSearchHints(instance, apiClient, query) {
|
||||
function getSearchHints(instance, apiClient, query) {
|
||||
if (!query.searchTerm) {
|
||||
return Promise.resolve({
|
||||
SearchHints: []
|
||||
|
@ -146,9 +144,9 @@ import template from './searchresults.template.html';
|
|||
query.UserId = apiClient.getCurrentUserId();
|
||||
|
||||
return apiClient.getSearchHints(query);
|
||||
}
|
||||
}
|
||||
|
||||
function search(instance, apiClient, context, value) {
|
||||
function search(instance, apiClient, context, value) {
|
||||
if (value || layoutManager.tv) {
|
||||
instance.mode = 'search';
|
||||
context.querySelector('.searchSuggestions').classList.add('hide');
|
||||
|
@ -545,18 +543,18 @@ import template from './searchresults.template.html';
|
|||
overlayText: false,
|
||||
centerText: true
|
||||
});
|
||||
}
|
||||
}
|
||||
|
||||
function searchType(instance, apiClient, query, context, section, cardOptions) {
|
||||
function searchType(instance, apiClient, query, context, section, cardOptions) {
|
||||
query.Limit = enableScrollX() ? 24 : 16;
|
||||
query.ParentId = instance.options.parentId;
|
||||
|
||||
getSearchHints(instance, apiClient, query).then(function (result) {
|
||||
populateResults(result, context, section, cardOptions);
|
||||
});
|
||||
}
|
||||
}
|
||||
|
||||
function populateResults(result, context, section, cardOptions) {
|
||||
function populateResults(result, context, section, cardOptions) {
|
||||
section = context.querySelector(section);
|
||||
|
||||
const items = result.Items || result.SearchHints;
|
||||
|
@ -574,18 +572,18 @@ import template from './searchresults.template.html';
|
|||
allowBottomPadding: !enableScrollX()
|
||||
|
||||
}, cardOptions || {}));
|
||||
}
|
||||
}
|
||||
|
||||
function enableScrollX() {
|
||||
function enableScrollX() {
|
||||
return true;
|
||||
}
|
||||
}
|
||||
|
||||
function replaceAll(originalString, strReplace, strWith) {
|
||||
function replaceAll(originalString, strReplace, strWith) {
|
||||
const reg = new RegExp(strReplace, 'ig');
|
||||
return originalString.replace(reg, strWith);
|
||||
}
|
||||
}
|
||||
|
||||
function embed(elem, instance) {
|
||||
function embed(elem, instance) {
|
||||
let workingTemplate = template;
|
||||
if (!enableScrollX()) {
|
||||
workingTemplate = replaceAll(workingTemplate, 'data-horizontal="true"', 'data-horizontal="false"');
|
||||
|
@ -598,7 +596,7 @@ import template from './searchresults.template.html';
|
|||
|
||||
elem.classList.add('searchResults');
|
||||
instance.search('');
|
||||
}
|
||||
}
|
||||
|
||||
class SearchResults {
|
||||
constructor(options) {
|
||||
|
@ -620,5 +618,3 @@ class SearchResults {
|
|||
}
|
||||
|
||||
export default SearchResults;
|
||||
|
||||
/* eslint-enable indent */
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue