mirror of
https://github.com/manilarome/the-glorious-startpage.git
synced 2024-11-24 08:33:21 +01:00
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');
|
|
} |