mirror of
https://github.com/manilarome/the-glorious-startpage.git
synced 2025-02-21 11:50:53 +01:00
* fix paddings on screen * fix test Variable Assigned to Object Injection Sink * fix parse int missing base * fix security issues(regex not included) * fix missing base * fixes padding * minor fixes * regex * cleanup * minor cleanup in webmenu * cleanups * cleanups spaces to tab * cleanups * spacing tabs fixes test * cleanup * cleanup * multitransition new line * cleanup * cleanup * cleanup * cleanup * readme * comments * cleanup * Avoid assignments in operands * cleanup
70 lines
1.5 KiB
JavaScript
70 lines
1.5 KiB
JavaScript
class SearchBoxShow {
|
|
|
|
constructor() {
|
|
|
|
this._searchBox = document.querySelector('#searchBox');
|
|
this._searchBoxContainer = document.querySelector('#searchBoxContainer');
|
|
this._centeredBoxOverlay = document.querySelector('#centeredBoxOverlay');
|
|
|
|
this._searchBoxVisility = false;
|
|
|
|
this.showSearchBox = this.showSearchBox.bind(this);
|
|
this.hideSearchBox = this.hideSearchBox.bind(this);
|
|
this.toggleSearchBox = this.toggleSearchBox.bind(this);
|
|
}
|
|
|
|
getSearchBoxVisibility = () => {
|
|
return this._searchBoxVisility;
|
|
}
|
|
|
|
showSearchBox = () => {
|
|
this._searchBoxContainer.classList.add('showSearchBox');
|
|
|
|
// Focus
|
|
this._searchBox.focus();
|
|
|
|
this._searchBoxVisility = !this._searchBoxVisility;
|
|
|
|
// Toggle overlay
|
|
this._centeredBoxOverlay.classList.toggle('showOverlay');
|
|
}
|
|
|
|
hideSearchBox = () => {
|
|
this._searchBoxContainer.classList.remove('showSearchBox');
|
|
|
|
// Toggle overlay
|
|
this._centeredBoxOverlay.classList.toggle('showOverlay');
|
|
|
|
this._searchBox.value = '';
|
|
|
|
// Hide suggestions
|
|
autoSuggestion.hideSuggestions();
|
|
|
|
this._searchBoxVisility = !this._searchBoxVisility;
|
|
}
|
|
|
|
toggleSearchBox = () => {
|
|
|
|
// If profile anim is still running,
|
|
// Return to avoid spam
|
|
if (profileImage.getProfileAnimationStatus()) return;
|
|
|
|
// Rotate profile
|
|
profileImage.rotateProfile();
|
|
|
|
if (this._searchBoxVisility) {
|
|
// Hide search box
|
|
this.hideSearchBox();
|
|
|
|
} else {
|
|
// Show search box
|
|
this.showSearchBox();
|
|
}
|
|
|
|
// console.log('toggle searchbox');
|
|
}
|
|
|
|
|
|
}
|
|
|