kopia lustrzana https://github.com/simonw/datasette
17 wiersze
589 B
HTML
17 wiersze
589 B
HTML
<script>
|
|
document.body.addEventListener('click', (ev) => {
|
|
/* Close any open details elements that this click is outside of */
|
|
var target = ev.target;
|
|
var detailsClickedWithin = null;
|
|
while (target && target.tagName != 'DETAILS') {
|
|
target = target.parentNode;
|
|
}
|
|
if (target && target.tagName == 'DETAILS') {
|
|
detailsClickedWithin = target;
|
|
}
|
|
Array.from(document.querySelectorAll('details.details-menu')).filter(
|
|
(details) => details.open && details != detailsClickedWithin
|
|
).forEach(details => details.open = false);
|
|
});
|
|
</script>
|