Fancier homepage and a bit of performance improvement through aggressive caching.

This commit is contained in:
2025-10-27 13:33:44 -07:00
parent 0106f0b9ac
commit 17a7be36bd
4 changed files with 251 additions and 174 deletions
+25 -3
View File
@@ -3,12 +3,34 @@ var i;
for (i = 0; i < coll.length; i++) {
coll[i].addEventListener("click", function() {
this.classList.toggle("active");
var content = this.nextElementSibling;
if (content.style.display === "block") {
var isCurrentlyOpen = content.style.display === "block" || content.style.display === "grid";
// If this collapsible has a parent with book-grid class, close all siblings in that grid
var parentGrid = this.closest('.book-grid');
if (parentGrid) {
var siblings = parentGrid.querySelectorAll('.collapsible');
for (var j = 0; j < siblings.length; j++) {
if (siblings[j] !== this) {
siblings[j].classList.remove("active");
var siblingContent = siblings[j].nextElementSibling;
if (siblingContent) {
siblingContent.style.display = "none";
}
}
}
}
// Toggle current element
this.classList.toggle("active");
if (isCurrentlyOpen) {
content.style.display = "none";
} else {
content.style.display = "block";
if (content.classList.contains('chapter-grid')) {
content.style.display = "grid";
} else {
content.style.display = "block";
}
}
});
}