1document.addEventListener("DOMContentLoaded", function () { 2 document 3 .querySelectorAll("#navbar-collapse .nav-item.dropdown > a.dropdown-toggle") 4 .forEach(function (link) { 5 // Skip if already wrapped 6 if (link.querySelector(".dropdown-arrow")) return; 7 8 // Create a span to wrap the arrow icon 9 const arrow = document.createElement("span"); 10 arrow.className = "dropdown-arrow"; 11 arrow.setAttribute("aria-hidden", "true"); 12 arrow.innerHTML = "▼"; // â¼ icon 13 arrow.style.cursor = "pointer"; 14 arrow.style.fontSize = "1.1rem"; 15 // arrow.style.marginLeft = "0.3rem"; 16 17 // Insert the arrow inside the <a> 18 link.appendChild(arrow); 19 20 // Attach click event to the arrow only 21 arrow.addEventListener("click", function (e) { 22 e.preventDefault(); 23 e.stopPropagation(); 24 25 // Stop Bootstrap from triggering its default toggle behavior 26 link.removeAttribute("data-bs-toggle"); 27 28 const parent = link.closest(".nav-item.dropdown"); 29 const menu = parent.querySelector(".dropdown-menu"); 30 31 // Close all other dropdowns 32 document 33 .querySelectorAll(".dropdown-menu.show") 34 .forEach(function (openMenu) { 35 if (openMenu !== menu) { 36 openMenu.classList.remove("show"); 37 } 38 }); 39 40 // Toggle this dropdown only 41 menu.classList.toggle("show"); 42 43 // Manually update aria-expanded 44 const expanded = link.getAttribute("aria-expanded") === "true"; 45 link.setAttribute("aria-expanded", !expanded); 46 }); 47 }); 48 49 // Close dropdowns if clicked outside 50 document.addEventListener("click", function (e) { 51 if (!e.target.closest(".nav-item.dropdown")) { 52 document.querySelectorAll(".dropdown-menu.show").forEach(function (menu) { 53 menu.classList.remove("show"); 54 }); 55 } 56 }); 57});
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.