1function updateClipboard(newClip) { 2 navigator.clipboard.writeText(newClip); 3} 4 5(function () { 6 var shareBtn = document.getElementById('shareButton'); 7 var sharePopup = document.getElementById('sharePopup'); 8 9 if (!shareBtn || !sharePopup) return; 10 11 function openPopup() { 12 sharePopup.removeAttribute('hidden'); 13 shareBtn.setAttribute('aria-expanded', 'true'); 14 } 15 16 function closePopup() { 17 sharePopup.setAttribute('hidden', ''); 18 shareBtn.setAttribute('aria-expanded', 'false'); 19 } 20 21 shareBtn.addEventListener('click', function (e) { 22 e.stopPropagation(); 23 if (sharePopup.hasAttribute('hidden')) { 24 openPopup(); 25 } else { 26 closePopup(); 27 } 28 }); 29 30 var shareLinks = sharePopup.querySelectorAll('.ct-news-detail__share-item:not(.ct-news-detail__copy-btn)'); 31 shareLinks.forEach(function (link) { 32 link.addEventListener('click', function () { 33 closePopup(); 34 }); 35 }); 36 37 var copyLinkBtn = sharePopup.querySelector('.ct-news-detail__copy-btn'); 38 if (copyLinkBtn) { 39 copyLinkBtn.addEventListener('click', function () { 40 var label = this.querySelector('.ct-news-detail__copy-label'); 41 updateClipboard(this.dataset.url); 42 label.textContent = 'Copied!'; 43 var btn = this; 44 setTimeout(function () { 45 label.textContent = 'Copy Link'; 46 closePopup(); 47 shareBtn.focus(); 48 }, 2000); 49 }); 50 } 51 52 document.addEventListener('click', function () { 53 if (!sharePopup.hasAttribute('hidden')) { 54 closePopup(); 55 } 56 }); 57 58 sharePopup.addEventListener('click', function (e) { 59 e.stopPropagation(); 60 }); 61 62 document.addEventListener('keydown', function (e) { 63 if (e.key === 'Escape' && !sharePopup.hasAttribute('hidden')) { 64 closePopup(); 65 shareBtn.focus(); 66 } 67 }); 68}());
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.