forked from LiveCarta/LiveCartaWP
5796
This commit is contained in:
@@ -137,7 +137,7 @@ height="0" width="0" style="display:none;visibility:hidden"></iframe></noscript>
|
|||||||
</div>
|
</div>
|
||||||
<div class="left">
|
<div class="left">
|
||||||
<span class="icon-search hide-sm"></span>
|
<span class="icon-search hide-sm"></span>
|
||||||
<button class="button clear link" title="Clear Search">
|
<button class="button clear link clear-search" id="clear-search" title="Clear Search" style="display: none;">
|
||||||
<span class="icon-close"></span>
|
<span class="icon-close"></span>
|
||||||
</button>
|
</button>
|
||||||
<input type="text" class="form-control" placeholder="Search books and study materials" id="header-search">
|
<input type="text" class="form-control" placeholder="Search books and study materials" id="header-search">
|
||||||
@@ -322,6 +322,17 @@ height="0" width="0" style="display:none;visibility:hidden"></iframe></noscript>
|
|||||||
headerSearchCont?.classList.remove('open');
|
headerSearchCont?.classList.remove('open');
|
||||||
});
|
});
|
||||||
|
|
||||||
|
headerSearch.addEventListener('keydown', () => {
|
||||||
|
setTimeout(() => {
|
||||||
|
if (document.getElementById('header-search').value.length > 0) {
|
||||||
|
document.getElementById('clear-search').style.display = 'block';
|
||||||
|
} else {
|
||||||
|
document.getElementById('clear-search').style.display = 'none';
|
||||||
|
}
|
||||||
|
}, 20);
|
||||||
|
|
||||||
|
});
|
||||||
|
|
||||||
const moveMenu = function(){
|
const moveMenu = function(){
|
||||||
let menuItems = document.querySelectorAll('.menu-link.movable');
|
let menuItems = document.querySelectorAll('.menu-link.movable');
|
||||||
|
|
||||||
@@ -348,8 +359,14 @@ height="0" width="0" style="display:none;visibility:hidden"></iframe></noscript>
|
|||||||
}, 1);
|
}, 1);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
if (event.target?.closest('.clear-search')) {
|
||||||
|
document.getElementById('header-search').value = "";
|
||||||
|
document.getElementById('clear-search').style.display = 'none';
|
||||||
|
}
|
||||||
|
|
||||||
if (event.target?.closest('#header-search-btn')) {
|
if (event.target?.closest('#header-search-btn')) {
|
||||||
let searchData = document.getElementById('header-search').value;
|
let searchData = document.getElementById('header-search').value.trim();
|
||||||
top.location = appUrl + '/catalog?tab=books-tab&search=' + searchData;
|
top.location = appUrl + '/catalog?tab=books-tab&search=' + searchData;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -360,7 +377,7 @@ height="0" width="0" style="display:none;visibility:hidden"></iframe></noscript>
|
|||||||
|
|
||||||
document.querySelector('#header-search').addEventListener('keyup', function(e){
|
document.querySelector('#header-search').addEventListener('keyup', function(e){
|
||||||
if (e.key === "Enter") {
|
if (e.key === "Enter") {
|
||||||
let searchData = e.target.value;
|
let searchData = e.target.value.trim();
|
||||||
top.location = appUrl + '/catalog?tab=books-tab&search=' + searchData;
|
top.location = appUrl + '/catalog?tab=books-tab&search=' + searchData;
|
||||||
}
|
}
|
||||||
})
|
})
|
||||||
|
|||||||
Reference in New Issue
Block a user