1(function(){ 2 function articleUrl(a){ 3 if(!a)return null; 4 if(a.sourcePath)return a.sourcePath; 5 if(a.slug&&a.category)return'/'+a.category+'/'+a.slug; 6 var id=a.id!=null?String(a.id):''; 7 return'/portal/article.html?id='+encodeURIComponent(id); 8 } 9 function safeUrl(u){ 10 if(typeof u!=='string'||!u)return null; 11 if(u.startsWith('//'))return null; 12 if(/^[a-z][a-z0-9+.-]*:/i.test(u))return null; 13 if(/[\x00-\x1F"'<>`\\]/.test(u))return null; 14 return u; 15 } 16 function makeItem(a){ 17 var url=safeUrl(articleUrl(a)); 18 if(!url)return null; 19 var link=document.createElement('a'); 20 link.className='ticker-item'; 21 link.href=url; 22 var title=document.createElement('span'); 23 title.textContent=a.title||''; 24 var sep=document.createElement('span'); 25 sep.className='ticker-sep'; 26 sep.textContent='\u00a0\u2022\u00a0'; 27 link.appendChild(title); 28 link.appendChild(sep); 29 return link; 30 } 31 function load(){ 32 var bar=document.getElementById('breaking-bar'); 33 var el=document.getElementById('ticker'); 34 if(!bar||!el)return; 35 fetch('/api/site-settings/news-ticker').then(function(r){ 36 if(!r.ok)return; 37 r.json().then(function(data){ 38 var items=Array.isArray(data&&data.items)?data.items:[]; 39 if(!items.length)return; 40 var nodes=items.map(makeItem).filter(Boolean); 41 if(!nodes.length)return; 42 var frag=document.createDocumentFragment(); 43 nodes.forEach(function(n){frag.appendChild(n);}); 44 nodes.forEach(function(n){frag.appendChild(n.cloneNode(true));}); 45 el.replaceChildren(frag); 46 bar.hidden=false; 47 }); 48 }).catch(function(){}); 49 } 50 if(document.readyState==='loading'){ 51 document.addEventListener('DOMContentLoaded',load); 52 } else { 53 load(); 54 } 55})();
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.