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() { function addListenersSearch() {
if (searchMobile !== null) { if (searchMobile !== null) {
searchMobile.addEventListener('click', onFakeSearchClick); const searchIcon = searchMobile.querySelector('div.search-icon')
fakeSearchInput.addEventListener('focus', (e) => { searchIcon.addEventListener('click', onFakeSearchClick);
onFakeSearchClick(e)
});
fakeSearchInput.addEventListener('change', (e) => { fakeSearchInput.addEventListener('change', (e) => {
if (fakeSearchInput.value !== "") {
const searchOverlay = document.querySelector('div.search-overlay'); const searchOverlay = document.querySelector('div.search-overlay');
const searchInput = searchOverlay.querySelector('div.search input'); const searchInput = searchOverlay.querySelector('div.search input');
searchInput.value = fakeSearchInput.value; searchInput.value = fakeSearchInput.value;
onSearchChange(e) onSearchChange(e)
}
onFakeSearchClick(e) onFakeSearchClick(e)
}); });
} }
const exitSearch = document.querySelector('a.exit-search') const exitSearch = document.querySelector('a.exit-search')
if (exitSearch !== null) { const searchOverlay = document.querySelector('div.search-overlay');
const searchInput = searchOverlay.querySelector('div.search input');
fakeSearchInput.value = searchInput.value;
exitSearch.addEventListener('click', onExitSearch) exitSearch.addEventListener('click', onExitSearch)
}
const search = document.querySelector('div.search-overlay div.search input'); const search = document.querySelector('div.search-overlay div.search input');
if (search !== null) { if (search !== null) {
search.addEventListener('change', onSearchChange); search.addEventListener('change', onSearchChange);

File diff suppressed because one or more lines are too long