mirror of
https://github.com/jellyfin/jellyfin-web
synced 2025-03-30 19:56:21 +00:00
Fix indentation of searchfields
This commit is contained in:
parent
903b656f7f
commit
b9dacecf22
1 changed files with 55 additions and 59 deletions
|
@ -9,26 +9,24 @@ import 'material-design-icons-iconfont';
|
||||||
import './searchfields.scss';
|
import './searchfields.scss';
|
||||||
import template from './searchfields.template.html';
|
import template from './searchfields.template.html';
|
||||||
|
|
||||||
/* eslint-disable indent */
|
function onSearchTimeout() {
|
||||||
|
|
||||||
function onSearchTimeout() {
|
|
||||||
const instance = this;
|
const instance = this;
|
||||||
let value = instance.nextSearchValue;
|
let value = instance.nextSearchValue;
|
||||||
|
|
||||||
value = (value || '').trim();
|
value = (value || '').trim();
|
||||||
Events.trigger(instance, 'search', [value]);
|
Events.trigger(instance, 'search', [value]);
|
||||||
}
|
}
|
||||||
|
|
||||||
function triggerSearch(instance, value) {
|
function triggerSearch(instance, value) {
|
||||||
if (instance.searchTimeout) {
|
if (instance.searchTimeout) {
|
||||||
clearTimeout(instance.searchTimeout);
|
clearTimeout(instance.searchTimeout);
|
||||||
}
|
}
|
||||||
|
|
||||||
instance.nextSearchValue = value;
|
instance.nextSearchValue = value;
|
||||||
instance.searchTimeout = setTimeout(onSearchTimeout.bind(instance), 400);
|
instance.searchTimeout = setTimeout(onSearchTimeout.bind(instance), 400);
|
||||||
}
|
}
|
||||||
|
|
||||||
function onAlphaValueClicked(e) {
|
function onAlphaValueClicked(e) {
|
||||||
const value = e.detail.value;
|
const value = e.detail.value;
|
||||||
const searchFieldsInstance = this;
|
const searchFieldsInstance = this;
|
||||||
|
|
||||||
|
@ -44,24 +42,24 @@ import template from './searchfields.template.html';
|
||||||
txtSearch.dispatchEvent(new CustomEvent('input', {
|
txtSearch.dispatchEvent(new CustomEvent('input', {
|
||||||
bubbles: true
|
bubbles: true
|
||||||
}));
|
}));
|
||||||
}
|
}
|
||||||
|
|
||||||
function initAlphaPicker(alphaPickerElement, instance) {
|
function initAlphaPicker(alphaPickerElement, instance) {
|
||||||
instance.alphaPicker = new AlphaPicker({
|
instance.alphaPicker = new AlphaPicker({
|
||||||
element: alphaPickerElement,
|
element: alphaPickerElement,
|
||||||
mode: 'keyboard'
|
mode: 'keyboard'
|
||||||
});
|
});
|
||||||
|
|
||||||
alphaPickerElement.addEventListener('alphavalueclicked', onAlphaValueClicked.bind(instance));
|
alphaPickerElement.addEventListener('alphavalueclicked', onAlphaValueClicked.bind(instance));
|
||||||
}
|
}
|
||||||
|
|
||||||
function onSearchInput(e) {
|
function onSearchInput(e) {
|
||||||
const value = e.target.value;
|
const value = e.target.value;
|
||||||
const searchFieldsInstance = this;
|
const searchFieldsInstance = this;
|
||||||
triggerSearch(searchFieldsInstance, value);
|
triggerSearch(searchFieldsInstance, value);
|
||||||
}
|
}
|
||||||
|
|
||||||
function embed(elem, instance) {
|
function embed(elem, instance) {
|
||||||
elem.innerHTML = globalize.translateHtml(template, 'core');
|
elem.innerHTML = globalize.translateHtml(template, 'core');
|
||||||
|
|
||||||
elem.classList.add('searchFields');
|
elem.classList.add('searchFields');
|
||||||
|
@ -78,7 +76,7 @@ import template from './searchfields.template.html';
|
||||||
txtSearch.addEventListener('input', onSearchInput.bind(instance));
|
txtSearch.addEventListener('input', onSearchInput.bind(instance));
|
||||||
|
|
||||||
instance.focus();
|
instance.focus();
|
||||||
}
|
}
|
||||||
|
|
||||||
class SearchFields {
|
class SearchFields {
|
||||||
constructor(options) {
|
constructor(options) {
|
||||||
|
@ -111,5 +109,3 @@ class SearchFields {
|
||||||
}
|
}
|
||||||
|
|
||||||
export default SearchFields;
|
export default SearchFields;
|
||||||
|
|
||||||
/* eslint-enable indent */
|
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue