Add web/core/static/core/search-help.js
This commit is contained in:
parent
62bd82b87e
commit
287b4353c2
17
web/core/static/core/search-help.js
Normal file
17
web/core/static/core/search-help.js
Normal file
@ -0,0 +1,17 @@
|
|||||||
|
<script>
|
||||||
|
document.addEventListener('click', (e) => {
|
||||||
|
const btn = e.target.closest('.help-toggle');
|
||||||
|
const panel = document.querySelector((btn && btn.dataset.target) || '#search-help-panel');
|
||||||
|
|
||||||
|
// Toggle when clicking the help button
|
||||||
|
if (btn && panel) {
|
||||||
|
panel.classList.toggle('open');
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
// Click outside closes it
|
||||||
|
if (panel && panel.classList.contains('open') && !panel.contains(e.target)) {
|
||||||
|
const clickedHelpButton = e.target.closest('.help-toggle');
|
||||||
|
if (!clickedHelpButton) panel.classList.remove('open');
|
||||||
|
}
|
||||||
|
});
|
||||||
|
</script>
|
||||||
Loading…
Reference in New Issue
Block a user