1// News "More / Less" toggle. 2// Extra items carry the `.news-hidden` class (hidden by default via CSS). 3// Clicking "More" reveals them; "Less" hides them again. We track state in a 4// variable and reveal with `display: grid` to match the .news li layout. 5(function () { 6 function init() { 7 var toggle = document.getElementById('news-toggle'); 8 var hidden = document.querySelectorAll('.news-hidden'); 9 10 if (!toggle || hidden.length === 0) { 11 if (toggle) { 12 toggle.style.display = 'none'; 13 } 14 return; 15 } 16 17 var label = toggle.querySelector('.news-toggle-label') || toggle; 18 var open = false; 19 toggle.addEventListener('click', function (e) { 20 e.preventDefault(); 21 open = !open; 22 for (var i = 0; i < hidden.length; i++) { 23 hidden[i].style.display = open ? 'grid' : 'none'; 24 } 25 label.textContent = open ? 'Less' : 'More'; 26 toggle.setAttribute('aria-expanded', open ? 'true' : 'false'); 27 }); 28 } 29 30 if (document.readyState === 'loading') { 31 document.addEventListener('DOMContentLoaded', init); 32 } else { 33 init(); 34 } 35})();
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.