mirror of
https://github.com/manilarome/the-glorious-startpage.git
synced 2024-11-28 10:33:08 +01:00
52 lines
1.1 KiB
JavaScript
52 lines
1.1 KiB
JavaScript
var searchBox = document.getElementById('searchBox');
|
|
var searchBoxContainer = document.getElementById('searchBoxContainer');
|
|
var centeredBoxOverlay = document.getElementById('centeredBoxOverlay');
|
|
|
|
let searchBoxVisility = false;
|
|
|
|
const showSearchBox = () => {
|
|
searchBoxContainer.classList.add('showSearchBox');
|
|
|
|
// Focus
|
|
searchBox.focus();
|
|
|
|
searchBoxVisility = !searchBoxVisility;
|
|
|
|
// Toggle overlay
|
|
centeredBoxOverlay.classList.toggle('showOverlay');
|
|
}
|
|
|
|
const hideSearchBox = () => {
|
|
searchBoxContainer.classList.remove('showSearchBox');
|
|
|
|
// Toggle overlay
|
|
centeredBoxOverlay.classList.toggle('showOverlay');
|
|
|
|
searchBox.value = '';
|
|
|
|
// Hide suggestions
|
|
hideSuggestions();
|
|
|
|
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();
|
|
}
|
|
|
|
console.log('toggle searchbox');
|
|
} |