1/* Sidebar Menu - Initialize accordion functionality and identify empty content containers */ 2 3document.addEventListener("DOMContentLoaded", function () { 4 if (document.body.classList.contains("archive")) { 5 var accordions = document.querySelectorAll( 6 ".accordion-categories .container" 7 ); 8 var containers = document.querySelectorAll(".container"); 9 10 accordions.forEach(function (accordion) { 11 var links = accordion.querySelectorAll("a"); 12 links.forEach(function (link) { 13 if (link.classList.contains("activebold")) { 14 if (!accordion.classList.contains("active")) { 15 accordion.classList.add("active"); 16 } 17 return; 18 } 19 }); 20 }); 21 22 containers.forEach(function (container) { 23 var label = container.querySelector(".label"); 24 25 // Only add click handler if container is not empty 26 if (label && !container.classList.contains("empty")) { 27 label.addEventListener("click", function (e) { 28 // Don't toggle if clicking on a link 29 if (e.target.tagName === "A") { 30 return; 31 } 32 33 // Get the label's bounding box 34 var labelRect = label.getBoundingClientRect(); 35 var clickX = e.clientX; 36 37 // Check if click is in the right area where the pseudo-element is (right side, about 30px from right edge) 38 // The pseudo-element is at right: -10px, so we check if click is in the right 30px area 39 var rightEdge = labelRect.right; 40 var clickAreaStart = rightEdge - 30; 41 42 // Only toggle if click is in the right area (where the + / - icon is) 43 if (clickX >= clickAreaStart) { 44 container.classList.toggle("active"); 45 } 46 }); 47 } 48 49 var content = container.querySelector(".content"); 50 if (content && content.innerHTML.trim() === "") { 51 container.classList.add("empty"); 52 } 53 }); 54 } 55});
Line numbers count LF bytes from the start of the resource, as the search results do. Vendor segments are library code the classifier recognised; they are stored but not indexed. Bytes are shown as Latin1 characters, one per byte.