forked from extern/the-glorious-startpage
43 lines
872 B
JavaScript
43 lines
872 B
JavaScript
var searchBox = document.getElementById('searchBox');
|
|
var centeredBoxOverlay = document.getElementById('centeredBoxOverlay');
|
|
|
|
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();
|
|
}
|
|
|
|
// Show overlay
|
|
centeredBoxOverlay.classList.toggle('showOverlay');
|
|
|
|
console.log('toggle searchbox');
|
|
} |