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 ServerConnections from '../ServerConnections';
|
||||||
import template from './searchresults.template.html';
|
import template from './searchresults.template.html';
|
||||||
|
|
||||||
/* eslint-disable indent */
|
function loadSuggestions(instance, context, apiClient) {
|
||||||
|
|
||||||
function loadSuggestions(instance, context, apiClient) {
|
|
||||||
const options = {
|
const options = {
|
||||||
|
|
||||||
SortBy: 'IsFavoriteOrLiked,Random',
|
SortBy: 'IsFavoriteOrLiked,Random',
|
||||||
|
@ -44,9 +42,9 @@ import template from './searchresults.template.html';
|
||||||
searchSuggestions.classList.remove('hide');
|
searchSuggestions.classList.remove('hide');
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
function getSearchHints(instance, apiClient, query) {
|
function getSearchHints(instance, apiClient, query) {
|
||||||
if (!query.searchTerm) {
|
if (!query.searchTerm) {
|
||||||
return Promise.resolve({
|
return Promise.resolve({
|
||||||
SearchHints: []
|
SearchHints: []
|
||||||
|
@ -146,9 +144,9 @@ import template from './searchresults.template.html';
|
||||||
query.UserId = apiClient.getCurrentUserId();
|
query.UserId = apiClient.getCurrentUserId();
|
||||||
|
|
||||||
return apiClient.getSearchHints(query);
|
return apiClient.getSearchHints(query);
|
||||||
}
|
}
|
||||||
|
|
||||||
function search(instance, apiClient, context, value) {
|
function search(instance, apiClient, context, value) {
|
||||||
if (value || layoutManager.tv) {
|
if (value || layoutManager.tv) {
|
||||||
instance.mode = 'search';
|
instance.mode = 'search';
|
||||||
context.querySelector('.searchSuggestions').classList.add('hide');
|
context.querySelector('.searchSuggestions').classList.add('hide');
|
||||||
|
@ -545,18 +543,18 @@ import template from './searchresults.template.html';
|
||||||
overlayText: false,
|
overlayText: false,
|
||||||
centerText: true
|
centerText: true
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
function searchType(instance, apiClient, query, context, section, cardOptions) {
|
function searchType(instance, apiClient, query, context, section, cardOptions) {
|
||||||
query.Limit = enableScrollX() ? 24 : 16;
|
query.Limit = enableScrollX() ? 24 : 16;
|
||||||
query.ParentId = instance.options.parentId;
|
query.ParentId = instance.options.parentId;
|
||||||
|
|
||||||
getSearchHints(instance, apiClient, query).then(function (result) {
|
getSearchHints(instance, apiClient, query).then(function (result) {
|
||||||
populateResults(result, context, section, cardOptions);
|
populateResults(result, context, section, cardOptions);
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
function populateResults(result, context, section, cardOptions) {
|
function populateResults(result, context, section, cardOptions) {
|
||||||
section = context.querySelector(section);
|
section = context.querySelector(section);
|
||||||
|
|
||||||
const items = result.Items || result.SearchHints;
|
const items = result.Items || result.SearchHints;
|
||||||
|
@ -574,18 +572,18 @@ import template from './searchresults.template.html';
|
||||||
allowBottomPadding: !enableScrollX()
|
allowBottomPadding: !enableScrollX()
|
||||||
|
|
||||||
}, cardOptions || {}));
|
}, cardOptions || {}));
|
||||||
}
|
}
|
||||||
|
|
||||||
function enableScrollX() {
|
function enableScrollX() {
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
function replaceAll(originalString, strReplace, strWith) {
|
function replaceAll(originalString, strReplace, strWith) {
|
||||||
const reg = new RegExp(strReplace, 'ig');
|
const reg = new RegExp(strReplace, 'ig');
|
||||||
return originalString.replace(reg, strWith);
|
return originalString.replace(reg, strWith);
|
||||||
}
|
}
|
||||||
|
|
||||||
function embed(elem, instance) {
|
function embed(elem, instance) {
|
||||||
let workingTemplate = template;
|
let workingTemplate = template;
|
||||||
if (!enableScrollX()) {
|
if (!enableScrollX()) {
|
||||||
workingTemplate = replaceAll(workingTemplate, 'data-horizontal="true"', 'data-horizontal="false"');
|
workingTemplate = replaceAll(workingTemplate, 'data-horizontal="true"', 'data-horizontal="false"');
|
||||||
|
@ -598,7 +596,7 @@ import template from './searchresults.template.html';
|
||||||
|
|
||||||
elem.classList.add('searchResults');
|
elem.classList.add('searchResults');
|
||||||
instance.search('');
|
instance.search('');
|
||||||
}
|
}
|
||||||
|
|
||||||
class SearchResults {
|
class SearchResults {
|
||||||
constructor(options) {
|
constructor(options) {
|
||||||
|
@ -620,5 +618,3 @@ class SearchResults {
|
||||||
}
|
}
|
||||||
|
|
||||||
export default SearchResults;
|
export default SearchResults;
|
||||||
|
|
||||||
/* eslint-enable indent */
|
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue