2026-09-21 11:16:52 +02:00
|
|
|
// CCN — shared script. Every screen works without it; it only removes a click here and there.
|
|
|
|
|
|
|
|
|
|
document.documentElement.classList.add("js");
|
|
|
|
|
|
|
|
|
|
// Selects marked `data-autosubmit` submit their form on change.
|
|
|
|
|
for (const select of document.querySelectorAll("select[data-autosubmit]")) {
|
|
|
|
|
select.addEventListener("change", () => select.form?.requestSubmit());
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
// The filter rail is a disclosure, open on desktop. Browsers without `::details-content` need it opened here.
|
|
|
|
|
const filters = document.querySelector("details.filters");
|
|
|
|
|
const desktop = window.matchMedia("(min-width: 1024px)");
|
|
|
|
|
|
|
|
|
|
if (filters) {
|
|
|
|
|
const sync = () => {
|
|
|
|
|
if (desktop.matches) {
|
|
|
|
|
filters.open = true;
|
|
|
|
|
}
|
|
|
|
|
};
|
|
|
|
|
|
|
|
|
|
sync();
|
|
|
|
|
desktop.addEventListener("change", sync);
|
|
|
|
|
}
|