1$('sidemenu ul li.menu-item-has-children').append($('<div class="menu-toggle"><i class="fa-sharp fa-solid fa-chevron-down" aria-hidden="true"></i></div>')); 2 3var menuRight = document.getElementById('ace-spmenu-s2'), 4 showRightPush = document.getElementById('showRightPush'), 5 menuClose = document.getElementById('menuClose'), 6 body = document.body; 7 8// Set initial state â sidebar is closed on page load 9menuRight.setAttribute('aria-hidden', 'true'); 10menuRight.setAttribute('inert', ''); 11showRightPush.setAttribute('aria-expanded', 'false'); 12 13function openSidebar() { 14 var fixedHeader = document.querySelector('header'); 15 classie.add(showRightPush, 'active'); 16 classie.add(body, 'ace-spmenu-push-toleft'); 17 classie.add(menuRight, 'ace-spmenu-open'); 18 if (fixedHeader) { 19 classie.add(fixedHeader, 'header-push-toleft'); 20 } 21 menuRight.removeAttribute('aria-hidden'); 22 menuRight.removeAttribute('inert'); 23 showRightPush.setAttribute('aria-expanded', 'true'); 24 // Move focus into the sidebar for keyboard users 25 menuClose.focus(); 26} 27 28function closeSidebar() { 29 var fixedHeader = document.querySelector('header'); 30 classie.remove(showRightPush, 'active'); 31 classie.remove(body, 'ace-spmenu-push-toleft'); 32 classie.remove(menuRight, 'ace-spmenu-open'); 33 if (fixedHeader) { 34 classie.remove(fixedHeader, 'header-push-toleft'); 35 } 36 menuRight.setAttribute('aria-hidden', 'true'); 37 menuRight.setAttribute('inert', ''); 38 showRightPush.setAttribute('aria-expanded', 'false'); 39 // Return focus to the trigger button 40 showRightPush.focus(); 41} 42 43showRightPush.onclick = function() { 44 if (classie.has(menuRight, 'ace-spmenu-open')) { 45 closeSidebar(); 46 } else { 47 openSidebar(); 48 } 49}; 50 51menuClose.onclick = function() { 52 closeSidebar(); 53}; 54 55// Close sidebar when an internal link is clicked 56document.addEventListener('click', function(e) { 57 const a = e.target.closest('#ace-spmenu-s2 a:not([target="_blank"])'); 58 if (!a) return; 59 closeSidebar(); 60}); 61 62// Close sidebar on Escape key 63document.addEventListener('keydown', function(e) { 64 if (e.key === 'Escape' && classie.has(menuRight, 'ace-spmenu-open')) { 65 closeSidebar(); 66 } 67}); 68 69$('sidemenu .menu-toggle').on('click', function() { 70 var $this = $(this); 71 var $current = $this.siblings('ul'); 72 var $allMenus = $('sidemenu .menu-toggle').siblings('ul'); 73 var $allToggles = $('sidemenu .menu-toggle'); 74 75 if ($current.is(':visible')) { 76 // Clicked the one that's already open â just close it 77 $current.slideUp(); 78 $this.removeClass('fa-rotate-180'); 79 $this.attr('aria-expanded', 'false'); 80 } else { 81 // Close all others first 82 $allMenus.not($current).slideUp(); 83 $allToggles.not(this).removeClass('fa-rotate-180'); 84 $allToggles.not(this).attr('aria-expanded', 'false'); 85 86 // Then open the clicked one 87 $current.slideDown(); 88 $this.addClass('fa-rotate-180'); 89 $this.attr('aria-expanded', 'true'); 90 } 91});
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.