1// Collapsible CooPilot hero pull-tab. 2// Delegated document listeners so it keeps working after Blazor enhanced 3// navigation (no per-element wiring, no re-init needed). 4// 5// The tab is a role="link" element (not an <a>) so navigation is fully under 6// our control, no fighting an anchor's default action. A visually-hidden real 7// <a href> inside keeps the page crawlable. 8// 9// States (class on .coopilot-tab): 10// (none) expanded , full folder tab; tapping it opens /coopilot 11// is-collapsed retracted, only the vertical "CooPilot" spine shows 12// 13// Mobile only (<=767px): tapping outside retracts; tapping the spine slides it 14// back out. Desktop keeps it expanded and taps navigate. 15(function () { 16 function isMobile() { 17 return window.matchMedia('(max-width: 767px)').matches; 18 } 19 20 function open(tab) { 21 var href = tab.getAttribute('data-href'); 22 if (href) window.location.href = href; 23 } 24 25 function activate(tab) { 26 if (isMobile() && tab.classList.contains('is-collapsed')) { 27 tab.classList.remove('is-collapsed'); // slide back out, don't navigate 28 } else { 29 open(tab); 30 } 31 } 32 33 document.addEventListener('click', function (e) { 34 var tabs = document.querySelectorAll('.coopilot-tab'); 35 if (!tabs.length) return; 36 37 var clicked = e.target && e.target.closest ? e.target.closest('.coopilot-tab') : null; 38 if (clicked) { 39 // Let the embedded real <a> (crawlable fallback) behave normally. 40 if (e.target.closest('a')) return; 41 activate(clicked); 42 return; 43 } 44 45 // Tapped elsewhere: on mobile, retract every tab to its spine. 46 if (isMobile()) { 47 for (var i = 0; i < tabs.length; i++) tabs[i].classList.add('is-collapsed'); 48 } 49 }); 50 51 document.addEventListener('keydown', function (e) { 52 var t = e.target; 53 if (!t || !t.classList || !t.classList.contains('coopilot-tab')) return; 54 if (e.key === 'Enter' || e.key === ' ' || e.key === 'Spacebar') { 55 e.preventDefault(); 56 activate(t); 57 } 58 }); 59})();
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.