1const toggles = document.querySelectorAll('.toggle1'); 2 3// Accessibility: give each FAQ toggle button a discernible name from its question text 4document.querySelectorAll('button.faq-toggle').forEach(btn => { 5 const title = btn.parentNode.querySelector('.faq-title'); 6 if (title && !btn.hasAttribute('aria-label')) { 7 btn.setAttribute('aria-label', 'Toggle answer: ' + title.textContent.trim()); 8 } 9}); 10 11toggles.forEach(toggle => { 12 toggle.addEventListener('click', () => { 13 const parent = toggle.parentNode; 14 15 // If already active, just close it 16 if (parent.classList.contains('active')) { 17 parent.classList.remove('active'); 18 } else { 19 // Close all others 20 document.querySelectorAll('.toggle1').forEach(otherToggle => { 21 otherToggle.parentNode.classList.remove('active'); 22 }); 23 // Open the clicked one 24 parent.classList.add('active'); 25 } 26 }); 27});
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.