1/* API collapsing */
2document.addEventListener('DOMContentLoaded', (event) => {
3    document.querySelectorAll("dl.cpp").forEach(cppListing => {
4        const dt = cppListing.querySelector("dt");
5        let shouldBeExpanded = false;
6        if(dt.id == document.location.hash.substring(1))
7            shouldBeExpanded = true;
8        cppListing.classList.add(shouldBeExpanded ? "expanded" : "unexpanded");
9        const button = document.createElement("span");
10        button.classList.add("lv-api-expansion-button");
11        button.addEventListener("click", () => {
12            cppListing.classList.toggle("unexpanded");
13            cppListing.classList.toggle("expanded");
14        });
15
16        dt.insertBefore(button, dt.firstChild);
17    });
18})