More consistent search.

This commit is contained in:
sergiotarxz 2023-09-05 19:36:17 +02:00
parent 9f309be709
commit c0e3d3bf27
2 changed files with 11 additions and 14 deletions

View File

@ -41,24 +41,21 @@ window.onload = () => {
function addListenersSearch() {
if (searchMobile !== null) {
searchMobile.addEventListener('click', onFakeSearchClick);
fakeSearchInput.addEventListener('focus', (e) => {
onFakeSearchClick(e)
});
const searchIcon = searchMobile.querySelector('div.search-icon')
searchIcon.addEventListener('click', onFakeSearchClick);
fakeSearchInput.addEventListener('change', (e) => {
if (fakeSearchInput.value !== "") {
const searchOverlay = document.querySelector('div.search-overlay');
const searchInput = searchOverlay.querySelector('div.search input');
searchInput.value = fakeSearchInput.value;
onSearchChange(e)
}
const searchOverlay = document.querySelector('div.search-overlay');
const searchInput = searchOverlay.querySelector('div.search input');
searchInput.value = fakeSearchInput.value;
onSearchChange(e)
onFakeSearchClick(e)
});
}
const exitSearch = document.querySelector('a.exit-search')
if (exitSearch !== null) {
exitSearch.addEventListener('click', onExitSearch)
}
const searchOverlay = document.querySelector('div.search-overlay');
const searchInput = searchOverlay.querySelector('div.search input');
fakeSearchInput.value = searchInput.value;
exitSearch.addEventListener('click', onExitSearch)
const search = document.querySelector('div.search-overlay div.search input');
if (search !== null) {
search.addEventListener('change', onSearchChange);

File diff suppressed because one or more lines are too long