1document.addEventListener("DOMContentLoaded", () => { 2 let copyStringToClipboard = (str) => { 3 // Create new element 4 let el = document.createElement('textarea'); 5 // Set value (string to be copied) 6 el.value = str; 7 // Set non-editable to avoid focus and move outside of view 8 el.setAttribute('readonly', ''); 9 el.style = {position: 'absolute', left: '-9999px'}; 10 document.body.appendChild(el); 11 // Select text inside element 12 el.select(); 13 // Copy text to clipboard 14 document.execCommand('copy'); 15 // Remove temporary element 16 document.body.removeChild(el); 17 } 18 19 let emailLinks = document.querySelectorAll("[href*='mailto:']"); 20 try { 21 for (let link of emailLinks) { 22 // let copy = link.getAttribute("href") 23 link.removeAttribute("href") 24 link.addEventListener("click", ()=>{ 25 copyStringToClipboard(link.innerHTML) 26 link.parentNode.classList.add("copied") 27 setTimeout(()=>{link.parentNode.classList.remove("copied")}, 800) 28 }) 29 } 30 } 31 catch(err) { 32 console.log("There's no emaillinks to copy in this page") 33 } 34})
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.