1 function generateTableOfContents() { 2 // Find the UL with the ID dynamicToc 3 const toc = document.getElementById('dynamicToc'); 4 if (!toc) { 5 console.error('UL with the ID dynamicToc not found!'); 6 return; 7 } 8 9 // Select all h2 and h3 elements 10 const headers = document.querySelectorAll('h2, h3'); 11 12 // Iterate through each header element 13 headers.forEach(header => { 14 // If the header doesn't have an ID, give it one based on its text content 15 if (!header.id) { 16 header.id = header.textContent.toLowerCase().replace(/[^a-z0-9]+/g, '-'); 17 } 18 19 // Create a list item for the header 20 const listItem = document.createElement('li'); 21 22 // Depending on whether it's an H2 or H3, adjust its styling or class 23 if (header.tagName === 'H3') { 24 listItem.className = 'toc-sub-item'; 25 } 26 27 // Create a link to the header 28 const link = document.createElement('a'); 29 link.href = '#' + header.id; 30 link.textContent = header.textContent; 31 listItem.appendChild(link); 32 33 // Append the list item to the dynamicToc list 34 toc.appendChild(listItem); 35 }); 36} 37 38// Call the function on DOMContentLoaded 39document.addEventListener('DOMContentLoaded', function() { 40 generateTableOfContents(); 41}); 42 43 jQuery(".toc-content > .toc-accordion-title").eq(0).addClass("active"); 44 jQuery(".toc-content > .toc-accordion-title").on("click", function (e) { 45 e.preventDefault(); 46 if (jQuery(this).hasClass("active")) { 47 jQuery(this).removeClass("active"); 48 jQuery(this).siblings(".toc-list-wrapper").slideUp(200); 49 } else { 50 jQuery(".toc-content > .toc-accordion-title").removeClass("active"); 51 jQuery(this).addClass("active"); 52 jQuery(".toc-list-wrapper").slideUp(200); 53 jQuery(this).siblings(".toc-list-wrapper").slideDown(200); 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.