|
|
|
@ -449,8 +449,10 @@ function addServerIconInteractions() {
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
function addSearchInteractions() {
|
|
|
|
|
dom.toggle_search_checkbox()?.addEventListener('click', function (ev) {
|
|
|
|
|
if (this.checked) {
|
|
|
|
|
dom.btn_toggle_search()?.addEventListener('click', function (ev) {
|
|
|
|
|
const container = dom.search_container();
|
|
|
|
|
container?.classList.toggle(CLASSES.COMPONENTS.COLLAPSED);
|
|
|
|
|
if (!container?.classList.contains(CLASSES.COMPONENTS.COLLAPSED)) {
|
|
|
|
|
const searchBar = dom.search_bar();
|
|
|
|
|
searchBar?.focus();
|
|
|
|
|
// Inconsistent; attempt to align search bar to top to make more space for results.
|
|
|
|
@ -464,13 +466,18 @@ function addSearchInteractions() {
|
|
|
|
|
setTimeout(() => useSearchTerm(this.value), 0);
|
|
|
|
|
})
|
|
|
|
|
|
|
|
|
|
dom.search_bar()?.addEventListener('keyup', function () {
|
|
|
|
|
dom.search_bar()?.addEventListener('keyup', function (ev) {
|
|
|
|
|
if (ev.key === "Enter") {
|
|
|
|
|
this.blur();
|
|
|
|
|
}
|
|
|
|
|
useSearchTerm(this.value);
|
|
|
|
|
})
|
|
|
|
|
|
|
|
|
|
dom.btn_clear_search()?.addEventListener('click', function () {
|
|
|
|
|
useSearchTerm("");
|
|
|
|
|
dom.search_bar().value = "";
|
|
|
|
|
const searchBar = dom.search_bar();
|
|
|
|
|
searchBar?.focus();
|
|
|
|
|
searchBar.value = "";
|
|
|
|
|
})
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
@ -614,6 +621,7 @@ function initializeSearch() {
|
|
|
|
|
function useSearchTerm(rawTerm) {
|
|
|
|
|
if (!rawTerm) {
|
|
|
|
|
replaceRowsWith(communityFullRowCache);
|
|
|
|
|
dom.search_bar()?.classList.remove(CLASSES.SEARCH.NO_RESULTS);
|
|
|
|
|
} else {
|
|
|
|
|
const term = rawTerm.toLowerCase();
|
|
|
|
|
const termTags = Array.from(rawTerm.matchAll(/#[^#\s]+/g)).map(match => match[0].slice(1).toLowerCase());
|
|
|
|
|