mirror of
https://github.com/GraphiteEditor/Graphite.git
synced 2026-12-01 15:53:26 -10:00
* Lint the website with the frontend's ESLint config instead of a diverging copy, selecting elements by data attributes * Give the crate graph's marker attribute a value, cache npm in the website workflow, and mention installing the website's packages
19 lines
710 B
JavaScript
19 lines
710 B
JavaScript
document.addEventListener("DOMContentLoaded", () => {
|
|
document.querySelectorAll("[data-tree-node]").forEach((toggle) => {
|
|
toggle.addEventListener("click", (event) => {
|
|
// Prevent link click from also toggling parent
|
|
if (event.target instanceof HTMLElement && event.target.tagName.toLowerCase() === "a") return;
|
|
|
|
const nestedList = toggle.parentElement?.querySelector("[data-nested]");
|
|
if (nestedList) {
|
|
toggle.classList.toggle("expanded");
|
|
nestedList.classList.toggle("active");
|
|
}
|
|
});
|
|
});
|
|
|
|
// Expand the first level by default
|
|
const firstLevel = document.querySelector("[data-structure-outline] [data-tree-node]");
|
|
if (firstLevel instanceof HTMLElement) firstLevel.click();
|
|
});
|