1(function ($, window, document) { 2 $(document).ready(function () { 3 const currentHost = window.location.host; 4 5 $('a[href]').each(function () { 6 const href = $(this).attr('href'); 7 8 // Ignore empty hrefs or anchors 9 if (!href || href.startsWith('#')) { 10 return; 11 } 12 13 // Check if link is external 14 let isExternal = false; 15 try { 16 const linkHost = new URL(href, window.location.origin).host; 17 isExternal = linkHost !== currentHost; 18 } catch (e) { 19 // URL() may throw for invalid URLs or relative anchors 20 } 21 22 // Check if itâs a PDF 23 const isPDF = href.toLowerCase().endsWith('.pdf'); 24 25 if (isExternal || isPDF) { 26 $(this).attr('target', '_blank'); 27 $(this).attr('rel', 'noopener noreferrer'); 28 } 29 }); 30 }); 31})(jQuery, window, document); 32
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.