/* Content, menu visibility and notifications are rendered by ASP. * JavaScript only enhances native forms and details controls. */ (function () { "use strict"; const filters = document.getElementById("library-filters"); const dropdowns = Array.from(document.querySelectorAll(".library-dropdown")); if (filters) { const authorFilter = filters.querySelector('input[name="author"]'); if (authorFilter) { authorFilter.addEventListener("change", function () { filters.requestSubmit(); }); } } dropdowns.forEach(function (dropdown) { dropdown.addEventListener("toggle", function () { if (dropdown.open) { dropdowns.forEach(function (other) { if (other !== dropdown) { other.open = false; } }); } }); }); document.addEventListener("click", function (event) { dropdowns.forEach(function (dropdown) { if (!dropdown.contains(event.target)) { dropdown.open = false; } }); }); document.addEventListener("keydown", function (event) { if (event.key === "Escape") { dropdowns.forEach(function (dropdown) { if (dropdown.open) { dropdown.open = false; dropdown.querySelector("summary").focus(); } }); } }); })();