mirror of
https://github.com/manilarome/the-glorious-startpage.git
synced 2025-01-08 06:18:54 +01:00
45 lines
963 B
JavaScript
45 lines
963 B
JavaScript
var searchBoxContainer = document.getElementById('searchBoxContainer');
|
|
|
|
var searchBox = document.getElementById('searchBox');
|
|
var centeredBoxOverlay = document.getElementById('centeredBoxOverlay');
|
|
|
|
let searchBoxVisility = false;
|
|
|
|
const showSearchBox = () => {
|
|
searchBoxContainer.classList.add('showSearchBox');
|
|
|
|
// Focus
|
|
searchBox.focus();
|
|
|
|
searchBoxVisility = !searchBoxVisility;
|
|
}
|
|
|
|
const hideSearchBox = () => {
|
|
searchBoxContainer.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');
|
|
} |