-import {htmlToDom} from "../services/dom";
-import {debounce} from "../services/util";
-import {KeyboardNavigationHandler} from "../services/keyboard-navigation";
-import {Component} from "./component";
+import {htmlToDom} from '../services/dom.ts';
+import {debounce} from '../services/util.ts';
+import {KeyboardNavigationHandler} from '../services/keyboard-navigation.ts';
+import {Component} from './component';
/**
* Global (header) search box handling.
// Handle search input changes
this.input.addEventListener('input', () => {
- const value = this.input.value;
+ const {value} = this.input;
if (value.length > 0) {
this.loadingWrap.style.display = 'block';
this.suggestionResultsWrap.style.opacity = '0.5';
updateSuggestionsDebounced(value);
- } else {
+ } else {
this.hideSuggestions();
}
});
if (!this.input.value) {
return;
}
-
+
const resultDom = htmlToDom(results);
this.suggestionResultsWrap.innerHTML = '';
this.container.classList.add('search-active');
window.requestAnimationFrame(() => {
this.suggestions.classList.add('search-suggestions-animation');
- })
+ });
}
hideSuggestions() {
this.suggestions.classList.remove('search-suggestions-animation');
this.suggestionResultsWrap.innerHTML = '';
}
-}
\ No newline at end of file
+
+}