function getCookie(cname) { var name = cname + "="; var ca = document.cookie.split(';'); for (var i = 0; i < ca.length; i++) { var c = ca[i]; while (c.charAt(0) == ' ') { c = c.substring(1); } if (c.indexOf(name) == 0) { return c.substring(name.length, c.length); } } return ""; } (function() { // Include pubnub var script = document.createElement('script'); script.src = 'https://cdn.pubnub.com/sdk/javascript/pubnub.4.0.11.min.js'; document.head.appendChild(script); function createCORSRequest(method, url) { var xhr = new XMLHttpRequest(); if ("withCredentials" in xhr) { // Check if the XMLHttpRequest object has a "withCredentials" property. // "withCredentials" only exists on XMLHTTPRequest2 objects. xhr.open(method, url, true); } else if (typeof XDomainRequest != "undefined") { // Otherwise, check if XDomainRequest. // XDomainRequest only exists in IE, and is IE's way of making CORS requests. xhr = new XDomainRequest(); xhr.open(method, url); } else { // Otherwise, CORS is not supported by the browser. xhr = null; } return xhr; } function execute_body_scripts(body_el) { // Finds and executes scripts in a newly added element's body. // Needed since innerHTML does not run scripts. // // Argument body_el is an element in the dom. function nodeName(elem, name) { return elem.nodeName && elem.nodeName.toUpperCase() === name.toUpperCase(); }; function evalScript(elem) { var data = (elem.text || elem.textContent || elem.innerHTML || "" ), head = document.getElementsByTagName("head")[0] || document.documentElement, script = document.createElement("script"); script.type = "text/javascript"; try { // doesn't work on ie... script.appendChild(document.createTextNode(data)); } catch(e) { // IE has funky script nodes script.text = data; } head.insertBefore(script, head.firstChild); head.removeChild(script); }; // main section of function var scripts = [], script, children_nodes = body_el.childNodes, child, i; for (i = 0; children_nodes[i]; i++) { child = children_nodes[i]; if (nodeName(child, "script" ) && (!child.type || child.type.toLowerCase() === "text/javascript")) { scripts.push(child); } } for (i = 0; scripts[i]; i++) { script = scripts[i]; console.log(script); if (script.parentNode) {script.parentNode.removeChild(script);} evalScript(scripts[i]); } }; var getChatCode = function() { let serverURL = "www.lawyer.com"; var xhr = createCORSRequest('GET', '//'+serverURL+'/vw/inc/chat4.php'); if (!xhr) { throw new Error('CORS not supported'); } xhr.onload = function() { let elem = document.createElement('div'); elem.id = "fillMe"; elem.innerHTML = xhr.responseText; document.body.insertBefore(elem, document.body.firstChild); execute_body_scripts(elem); }; xhr.onerror = function() { console.log('There was an error!'); }; xhr.send(); document.removeEventListener('click', getChatCode); } var dA = document.getElementsByTagName("div"); var LcomdA; for (var i = 0; i < dA.length; i++){ if ("Lcom"==dA[i].id){ LcomdA = 0; var linksUrl = ""; var imgUrl = ""; var filetype = ""; var links = dA[i].getElementsByTagName("a"); for (var j = 0; j < links.length; j++){ linksUrl = links[j].getAttribute("href")+""; linksUrl = linksUrl.replace("..html", ".html"); } var imgs = dA[i].getElementsByTagName("img"); for (var j = 0; j < imgs.length; j++){ imgUrl = imgs[j].getAttribute("src"); } if (imgUrl.length>5){ filetype = imgUrl.substr((imgUrl.length-5)).toLowerCase(); if (filetype=='i.png'){ if(linksUrl.includes("jamison-mark") && !window.location.hostname.includes("lawyer.com")){ console.log('here'); console.log(window.location); setTimeout(getChatCode, 2000); dA[i].innerHTML= '
'; }else{ dA[i].innerHTML= '
'; } }else if(filetype=='p.png'){ dA[i].innerHTML= '
'; }else if(filetype=='k.png'){ dA[i].innerHTML= '
'; } } } else if ("Lcomres"==dA[i].id){ LcomdA = 1; var linksUrl = ""; var imgUrl = ""; var filetype = ""; var links = dA[i].getElementsByTagName("a"); for (var j = 0; j < links.length; j++){ linksUrl = links[j].getAttribute("href")+""; linksUrl = linksUrl.replace("..html", ".html"); } var imgs = dA[i].getElementsByTagName("img"); for (var j = 0; j < imgs.length; j++){ imgUrl = imgs[j].getAttribute("src"); } if (imgUrl.length>5){ filetype = imgUrl.substr((imgUrl.length-5)).toLowerCase(); if (filetype=='i.png'){ if(linksUrl.includes("jamison-mark") && !window.location.hostname.includes("lawyer.com")){ setTimeout(getChatCode, 2000); console.log('here'); console.log(window.location); dA[i].innerHTML= '
'; }else{ dA[i].innerHTML= '
'; } }else if(filetype=='p.png'){ dA[i].innerHTML= '
'; }else if(filetype=='k.png'){ dA[i].innerHTML= '
'; } } } } var little = document.createElement("img"); little.src = "https://www.lawyer.com/seal/track.php?"+encodeURIComponent(document.referrer); little.setAttribute("height", "1"); little.setAttribute("width", "1"); little.setAttribute("style", "border: none; box-shadow: none;"); if (LcomdA==0){ document.getElementById("Lcom").appendChild(little); } else if (LcomdA==1){ document.getElementById("Lcomres").appendChild(little); } })();