Add web/core/search-help.js
This commit is contained in:
parent
c92ad253b6
commit
62bd82b87e
15
web/core/search-help.js
Normal file
15
web/core/search-help.js
Normal file
@ -0,0 +1,15 @@
|
||||
<script>
|
||||
document.addEventListener('click', (e) => {
|
||||
const btn = e.target.closest('.help-toggle');
|
||||
const panel = document.querySelector((btn && btn.dataset.target) || '#search-help-panel');
|
||||
|
||||
if (btn && panel) {
|
||||
panel.classList.toggle('open');
|
||||
return;
|
||||
}
|
||||
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