Pinned 2026 toolchains (Go 1.26, Rust 1.98/edition 2024, Python 3.14 + uv, Node 24, Zig 0.16, NixOS 26.05), postgres 18 / mongo 8, lockfiles built from, non-root runtimes, .dockerignore, per-project LICENSE, READMEs with the git.devai.io clone line, checkout@v7 CI. Security fixes in the legacy Rust APIs (any-password login, self-assigned admin, hard-coded JWT secret), JWT alg/exp/sub enforcement across the blog series, safe markdown links in the frontends, and many smaller bugs — every project was built, run and exercised end to end. Adds scripts/publish.sh + a CI publish job that splits every folder into its own repo at git.devai.io/templates/<folder>. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01128fhuZbgivaSJvtMf4s1G
24 lines
873 B
JavaScript
24 lines
873 B
JavaScript
const questions = document.querySelectorAll(".question");
|
|
|
|
// aria-expanded on the <button> is the single source of truth: screen readers
|
|
// announce it ("collapsed" / "expanded"), and the .open class lets the CSS
|
|
// slide the answer open to match.
|
|
function open(button) {
|
|
button.setAttribute("aria-expanded", "true");
|
|
button.parentElement.classList.add("open");
|
|
}
|
|
|
|
function close(button) {
|
|
button.setAttribute("aria-expanded", "false");
|
|
button.parentElement.classList.remove("open");
|
|
}
|
|
|
|
// Closing every item before opening the clicked one is what makes this an
|
|
// accordion: only one answer is ever open. Clicking an open question just closes it.
|
|
for (const button of questions) {
|
|
button.addEventListener("click", () => {
|
|
const wasOpen = button.getAttribute("aria-expanded") === "true";
|
|
questions.forEach(close);
|
|
if (!wasOpen) open(button);
|
|
});
|
|
}
|