2020-06-06 01:14:21 +02:00
|
|
|
var searchBoxContainer = document.getElementById('searchBoxContainer');
|
|
|
|
|
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 = () => {
|
2020-06-06 01:14:21 +02:00
|
|
|
searchBoxContainer.classList.add('showSearchBox');
|
2020-06-04 03:54:39 +02:00
|
|
|
|
|
|
|
// Focus
|
|
|
|
searchBox.focus();
|
|
|
|
|
|
|
|
searchBoxVisility = !searchBoxVisility;
|
|
|
|
}
|
|
|
|
|
|
|
|
const hideSearchBox = () => {
|
2020-06-06 01:14:21 +02:00
|
|
|
searchBoxContainer.classList.remove('showSearchBox');
|
2020-06-04 03:54:39 +02:00
|
|
|
|
|
|
|
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');
|
|
|
|
}
|