1// Vanilla re-implementation of the small bit of behaviour the legacy BLI admin theme 2// got from jQuery + metisMenu + slimscroll. Uses event delegation on `document`, so it 3// works whether the admin shell is static-SSR or arrives via enhanced navigation, keeps 4// working across Blazor re-renders, and is safe if the script loads more than once. 5(function () { 6 if (window.__beeAdminThemeInit) return; 7 window.__beeAdminThemeInit = true; 8 9 document.addEventListener('click', function (e) { 10 // Sidebar collapse toggle (hamburger). 11 var navBtn = e.target.closest('.nav-btn'); 12 if (navBtn) { 13 var pc = document.querySelector('.page-container'); 14 if (pc) pc.classList.toggle('sbar_collapsed'); 15 return; 16 } 17 18 // metisMenu-style accordion: a top-level menu link that owns a submenu. 19 var link = e.target.closest('.metismenu a'); 20 if (link) { 21 var li = link.parentElement; 22 var submenu = li.querySelector(':scope > ul.collapse'); 23 if (submenu) { 24 e.preventDefault(); 25 var isOpen = li.classList.contains('active'); 26 // Accordion: close sibling groups. 27 li.parentElement.querySelectorAll(':scope > li.active').forEach(function (sib) { 28 if (sib !== li) { 29 sib.classList.remove('active'); 30 var s = sib.querySelector(':scope > ul.collapse'); 31 if (s) s.classList.remove('in'); 32 } 33 }); 34 li.classList.toggle('active', !isOpen); 35 submenu.classList.toggle('in', !isOpen); 36 } 37 // Real submenu links (with hrefs) fall through and navigate normally. 38 return; 39 } 40 41 // User-profile dropdown (Log Out). Triggered by the avatar (no username is shown). 42 var userToggle = e.target.closest('.user-profile .dropdown-toggle'); 43 if (userToggle) { 44 var menu = userToggle.parentElement.querySelector('.dropdown-menu'); 45 if (menu) menu.classList.toggle('show'); 46 return; 47 } 48 }); 49})();
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.