mirror of
https://github.com/lvgl/lvgl.git
synced 2024-11-27 03:33:48 +08:00
19 lines
756 B
JavaScript
19 lines
756 B
JavaScript
/* API collapsing */
|
|
document.addEventListener('DOMContentLoaded', (event) => {
|
|
document.querySelectorAll("dl.cpp").forEach(cppListing => {
|
|
const dt = cppListing.querySelector("dt");
|
|
let shouldBeExpanded = false;
|
|
if(dt.id == document.location.hash.substring(1))
|
|
shouldBeExpanded = true;
|
|
cppListing.classList.add(shouldBeExpanded ? "expanded" : "unexpanded");
|
|
const button = document.createElement("span");
|
|
button.classList.add("lv-api-expansion-button");
|
|
button.addEventListener("click", () => {
|
|
cppListing.classList.toggle("unexpanded");
|
|
cppListing.classList.toggle("expanded");
|
|
});
|
|
|
|
dt.insertBefore(button, dt.firstChild);
|
|
});
|
|
})
|