2020-06-04 03:54:39 +02:00
|
|
|
var searchBox = document.getElementById('searchBox');
|
2020-06-04 04:06:27 +02:00
|
|
|
var centeredBoxOverlay = document.getElementById('centeredBoxOverlay');
|
2020-06-04 03:54:39 +02:00
|
|
|
|
|
|
|
let searchBoxVisility = false;
|
|
|
|
|
|
|
|
const showSearchBox = () => {
|
|
|
|
searchBox.classList.add('showSearchBox');
|
|
|
|
|
|
|
|
// Focus
|
|
|
|
searchBox.focus();
|
|
|
|
|
|
|
|
searchBoxVisility = !searchBoxVisility;
|
|
|
|
}
|
|
|
|
|
|
|
|
const hideSearchBox = () => {
|
|
|
|
searchBox.classList.remove('showSearchBox');
|
|
|
|
|
|
|
|
searchBoxVisility = !searchBoxVisility;
|
|
|
|
}
|
|
|
|
|
|
|
|
const toggleSearchBox = () => {
|
|
|
|
|
|
|
|
// If profile anim is still running,
|
|
|
|
// Return to avoid spam
|
|
|
|
if (profileAnimRunning) return;
|
|
|
|
|
|
|
|
// Rotate profile
|
|
|
|
rotateProfile();
|
|
|
|
|
|
|
|
if (searchBoxVisility) {
|
|
|
|
// Hide search box
|
|
|
|
hideSearchBox();
|
|
|
|
|
|
|
|
} else {
|
|
|
|
// Show search box
|
|
|
|
showSearchBox();
|
|
|
|
}
|
|
|
|
|
2020-06-04 04:06:27 +02:00
|
|
|
// Show overlay
|
|
|
|
centeredBoxOverlay.classList.toggle('showOverlay');
|
|
|
|
|
2020-06-04 03:54:39 +02:00
|
|
|
console.log('toggle searchbox');
|
|
|
|
}
|