1 2let automaticLink = document.getElementsByClassName("spl-automatic-Link"); 3 4for (var i = 0 ; i < automaticLink.length; i++) { 5 automaticLink[i].addEventListener("click", getDataLink); 6} 7 8function getDataLink(e) { 9 e.preventDefault() 10 const idAutomaticLink = this.getAttribute('data-spl') 11 const href = this.getAttribute('href') 12 const target = this.getAttribute('target') 13 const keyword = this.innerHTML 14 15 updateMetrics(idAutomaticLink,keyword).then(snap => { 16 if(target) { 17 window.open(href, target); 18 }else{ 19 document.location = href 20 } 21 }) 22} 23 24function updateMetrics(idAutomaticLink,keyword){ 25 26 return new Promise((resolve, reject) => { 27 28 const http = new XMLHttpRequest() 29 const url = document.getElementById("splUrlAutomaticLinks").value 30 const idPost = document.getElementById("splPostIdAutomaticLinks").value 31 32 let params = "type=ajax&id="+idAutomaticLink+"&idPost="+idPost+"&keyword="+keyword 33 34 http.open('POST', url, true); 35 36 http.setRequestHeader('Content-type', 'application/x-www-form-urlencoded'); 37 38 http.onreadystatechange = function () { 39 if (http.readyState == 4 && http.status == 200) { 40 const response = JSON.parse(http.responseText) 41 resolve(response) 42 } 43 } 44 45 http.send(params); 46 }) 47} 48
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.