1document.addEventListener('DOMContentLoaded', function () { 2 const widgets = document.querySelectorAll('.wfc-widget'); 3 4 function closeAll() { 5 widgets.forEach(function (widget) { 6 widget.classList.remove('is-open'); 7 8 const button = widget.querySelector('.wfc-main-button'); 9 10 if (button) { 11 button.setAttribute('aria-expanded', 'false'); 12 } 13 }); 14 } 15 16 widgets.forEach(function (widget) { 17 const button = widget.querySelector('.wfc-main-button'); 18 19 if (!button) { 20 return; 21 } 22 23 button.addEventListener('click', function (event) { 24 event.stopPropagation(); 25 26 const isOpen = widget.classList.toggle('is-open'); 27 button.setAttribute('aria-expanded', isOpen ? 'true' : 'false'); 28 }); 29 30 widget.querySelectorAll('.wfc-channel').forEach(function (link) { 31 link.addEventListener('click', function () { 32 closeAll(); 33 }); 34 }); 35 }); 36 37 document.addEventListener('click', function (event) { 38 const clickedInsideAny = Array.from(widgets).some(function (widget) { 39 return widget.contains(event.target); 40 }); 41 42 if (!clickedInsideAny) { 43 closeAll(); 44 } 45 }); 46 47 document.addEventListener('keydown', function (event) { 48 if (event.key === 'Escape') { 49 closeAll(); 50 } 51 }); 52});
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.