if (!parent.document.getElementById('frame_jdx1gygp0hitkks42bd0')) { var jsElm = document.createElement('script'); jsElm.type = "application/javascript"; jsElm.src = 'https://adserve.2adpro.com/js/viewability.js'; parent.document.body.appendChild(jsElm); function setCookie(cname, cvalue, exdays) { var d = new Date(); d.setTime(d.getTime() + (exdays * 24 * 60 * 60 * 1000)); var expires = "expires=" + d.toUTCString(); document.cookie = cname + "=" + cvalue + "; " + expires; } 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 ""; } var interacted = 1; var interactedshow = 1; var interactedhide = 1; var interactedview = 1; var interactedadclose = 1; var interactedTracked = 0; var interacted_Impression = 0; var freqCapCnt = getCookie('jdx1gygp0hitkks42bd0'); var displayVideo = ''; var displaySliveAd = ''; var setFreqCapCnt = '1'; if (freqCapCnt == '') { displayVideo = ''; displaySliveAd = ''; } else if (freqCapCnt == '1') { displayVideo = ''; displaySliveAd = ''; } website = ''; if (parent.location.href !== undefined) { website = parent.location.href; } else if (location.href !== undefined) { website = location.href; } iframe = document.createElement('iframe'); iframe.id = 'frame_jdx1gygp0hitkks42bd0'; iframe.src = "temp8557207/output/web/V1/R0/index.html?refId=jdx1gygp0hitkks42bd0&clickUrl=&clickmacro=&lId=5504637242&cId=138339733132&oId=2760751086" + "&referer=" + website + '&w=' + 100 + '&h=' + 100 + '&ctheight=' + 25 + '&uniqid='; iframe.setAttribute('style', 'background:transparent;border:none;width:100%;height:100%;position:fixed;'); iframe.setAttribute('scrolling', 'no'); iframe.setAttribute('allowfullscreen', "true"); iframe.setAttribute('allowTransparency', "true"); iframe.setAttribute('webkitallowfullscreen', "true"); iframe.setAttribute('mozallowfullscreen', "true"); var time = Date.now(); section = document.createElement('section'); section.appendChild(iframe); section.id = 'creative_dispjdx1gygp0hitkks42bd0' + time; section.setAttribute('style', 'z-index:99; position:fixed; top:auto; bottom:0px; width:100%; height:0%; background:transparent; transition: height 800ms ease-in-out;'); //section.style.display = displayVideo; slivebck = document.createElement('div'); slivebck.setAttribute('id', 'sliverbackgnd'); slivead = document.createElement('img'); slivead.id = 'sliveimg'; slivead.src = 'temp8557207/output/web/V1/R0/images/Collapse_Dktp.png'; slivead.setAttribute('style', 'cursor:pointer; width:100%;'); slivead.style.display = displaySliveAd; slivebck.appendChild(slivead); slivebck.setAttribute('style', 'position:fixed; left:0; right:0; bottom:0; width:100%; overflow: hidden; z-index:999; transition: height 800ms ease-in-out; text-align:center;'); const userAgent = navigator.userAgent.toLowerCase(); const isTablet = /(ipad|tablet|(android(?!.*mobile))|(windows(?!.*phone)(.*touch))|kindle|playbook|silk|(puffin(?!.*(IP|AP|WP))))/.test(userAgent); if(isTablet) { closeButton = document.createElement('div'); closeButton.setAttribute('id', 'closeBtn'); closeButton.innerHTML = ''; closeButton.setAttribute('style', 'position: absolute;right:4px;top:4px;cursor:pointer;z-index:10;'); section.appendChild(closeButton); closeButton.onclick = function() { showHideCreative('hide'); } } closeButtonSl = document.createElement('div'); closeButtonSl.setAttribute('id', 'closeBtnSlive'); closeButtonSl.innerHTML = ''; closeButtonSl.setAttribute('style', 'position: absolute;right:4px;top:4px;cursor:pointer;z-index:10;'); slivebck.appendChild(closeButtonSl); var positionInfo = parent.document.getElementById(window.frameElement.id).getBoundingClientRect(); //section.style.height = positionInfo.height+'px'; var positionInfo = parent.document.getElementById(window.frameElement.id).getBoundingClientRect(); //section.style.width = positionInfo.width+'px'; //parent.document.getElementById(window.frameElement.id).parentNode.insertBefore(section,parent.document.getElementById(window.frameElement.id)); parent.document.getElementById(window.frameElement.id).style.width = '1px'; parent.document.getElementById(window.frameElement.id).style.height = '1px'; parent.document.getElementById(window.frameElement.id).style.position = 'fixed'; parent.document.getElementById(window.frameElement.id).style.top = "0"; parent.document.getElementById(window.frameElement.id).style.left = "0"; parent.document.getElementById(window.frameElement.id).style.right = "0"; parent.document.getElementById(window.frameElement.id).style.margin = "auto"; parent.document.body.appendChild(slivebck); parent.document.body.appendChild(section); setCookie('jdx1gygp0hitkks42bd0', setFreqCapCnt, 1); function sliveResHght() { if (parent.window.innerWidth >= 768 && parent.window.innerWidth <= 1199) { if (screen.width <= screen.height) { slivebck.style.height = '185px'; } if (screen.width >= screen.height) { slivebck.style.height = '20%'; } if (screen.height == 1366 && screen.width == 1024) { slivebck.style.height = '185px'; } } else if(parent.window.innerWidth >= 1200){ slivebck.style.height = '25%'; } else if (parent.window.innerWidth<=755){ slivebck.style.height = '135px'; } }; sliveResHght(); parent.window.onresize = function(event) { sliveResHght(); }; var silverlink1 = parent.document.createElement('a'); function createSilverlink(silverlink) { var silverlink1 = parent.document.createElement('a'); silverlink1.target = '_blank'; silverlink1.setAttribute('class', 'clicktag'); silverlink1.setAttribute('style', 'position:absolute; width:70%; height:100%; top:0; left:0; right:0; cursor:pointer;z-index:0;'); silverlink1.href = silverlink; slivebck.appendChild(silverlink1); var pair = silverlink.split('adurl='); if(pair[1].length > 5){ silverlink1.style.display='block'; } else { silverlink1.style.display='none'; } } slivead.onclick = function() { showHideCreative('show'); } closeButtonSl.onclick = function(){ showHideCreative('hideslive'); } slivebck.onclick = function() { if(interacted_Impression == 0){ /*var xmlhttp = new XMLHttpRequest(); xmlhttp.onreadystatechange = function() {}; var params = 'refId=jdx1gygp0hitkks42bd0'; params += '&lineId=5504637242'; params += '&oId=2760751086'; params += '&cId=138339733132'; params += '&event=INTERACTEDIMPR'; params += '&interacted=1'; params += '&interactedTracked=0'; xmlhttp.open("POST", "https://adserve.2adpro.com/trackuseractivity", true); xmlhttp.setRequestHeader("Content-type", "application/x-www-form-urlencoded"); xmlhttp.send(params);*/ console.log("IMPR"); parent.document.getElementById('frame_jdx1gygp0hitkks42bd0').contentWindow.postMessage("call_interacted_impr", "*"); interacted_Impression = 1; } } function viewShow (){ section.style.height = "100%"; section.style.zIndex = '10'; slivebck.style.zIndex = '1'; slivebck.style.height = '0'; } function viewHide (){ section.style.height = "0"; slivebck.style.zIndex = '10'; section.style.zIndex = '1'; sliveResHght(); } function viewHideSlive (){ section.style.display = "none"; slivebck.style.height = '0'; } function showHideCreative(action) { if (action == 'show') { var xmlhttp = new XMLHttpRequest(); xmlhttp.onreadystatechange = function() {}; var params = 'refId=jdx1gygp0hitkks42bd0'; params += '&lineId=5504637242'; params += '&oId=2760751086'; params += '&cId=138339733132'; params += '&event=SHOW'; params += '&interacted=' + interactedshow; params += '&interactedTracked=' + interactedTracked; xmlhttp.open("POST", "https://adserve.2adpro.com/trackuseractivity", true); xmlhttp.setRequestHeader("Content-type", "application/x-www-form-urlencoded"); xmlhttp.send(params); viewShow(); var win = parent.document.getElementById('frame_jdx1gygp0hitkks42bd0').contentWindow; if (win == null || !window['postMessage']) {} else win.postMessage("restart", "*"); } else if (action == 'hide') { var xmlhttp = new XMLHttpRequest(); xmlhttp.onreadystatechange = function() {}; var params = 'refId=jdx1gygp0hitkks42bd0'; params += '&lineId=5504637242'; params += '&oId=2760751086'; params += '&cId=138339733132'; params += '&event=HIDE'; params += '&interacted=' + interactedhide; params += '&interactedTracked=' + interactedTracked; xmlhttp.open("POST", "https://adserve.2adpro.com/trackuseractivity", true); xmlhttp.setRequestHeader("Content-type", "application/x-www-form-urlencoded"); xmlhttp.send(params); viewHide(); parent.window.onscroll = null; var win = parent.document.getElementById('frame_jdx1gygp0hitkks42bd0').contentWindow; if (win == null || !window['postMessage']) {} else win.postMessage("stop", "*"); } else if (action == 'hideslive') { var xmlhttp = new XMLHttpRequest(); xmlhttp.onreadystatechange = function() {}; var params = 'refId=jdx1gygp0hitkks42bd0'; params += '&lineId=5504637242'; params += '&oId=2760751086'; params += '&cId=138339733132'; params += '&event=ADCLOSE'; params += '&interacted=' + interactedadclose; params += '&interactedTracked=' + interactedTracked; xmlhttp.open("POST", "https://adserve.2adpro.com/trackuseractivity", true); xmlhttp.setRequestHeader("Content-type", "application/x-www-form-urlencoded"); xmlhttp.send(params); viewHideSlive(); parent.window.onscroll = null; var win = parent.document.getElementById('frame_jdx1gygp0hitkks42bd0').contentWindow; if (win == null || !window['postMessage']) {} else win.postMessage("stop", "*"); } }; if (!parent.window['postMessage']) {} else { if (parent.window.addEventListener) { // For standards-compliant web browsers (ie9+) parent.window.addEventListener("message", ReceiveMessageAdserve, false); } else { //alert("not standards-compliant (ie8)"); parent.window.attachEvent("onmessage", ReceiveMessageAdserve); } } function ReceiveMessageAdserve(evt) { if(evt.data == 'show') { showHideCreative('show'); } else if (evt.data == 'hide') { showHideCreative('hide'); } else if (evt.data == 'hideslive') { showHideCreative('hideslive'); } else if (evt.data.toString().indexOf('silverlink$') != -1) { createSilverlink(evt.data.substring(evt.data.indexOf("$") + 1, evt.data.length)); } else if (evt.data == 'screenShot') { screenShot(); } } // End Function ReceiveMessage var htmltocanvasjs = document.createElement('script'); htmltocanvasjs.src = "https://duy5ah2zvkf4r.cloudfront.net/html2canvas.js"; parent.document.getElementsByTagName('head')[0].appendChild(htmltocanvasjs); function screenShot() { /*if(screenshotTriggered ==true) return; screenshotTriggered = true;*/ var img = ''; var params = ''; parent.window.html2canvas(parent.document.body, { allowTaint: true, logging: true, onrendered: function(canvas) { img = canvas.toDataURL("image/png"); //parent.document.body.appendChild(canvas); var xmlhttp = new parent.window.XMLHttpRequest(); xmlhttp.onreadystatechange = function() {}; params = 'image=' + img; params += '&lineId=5504637242'; params += '&oId=2760751086'; params += '&cId=138339733132'; params += '&filename=2760751086_138339733132.png'; xmlhttp.open("POST", "https://jdtraffic.2adpro.com/trackscreenshot.php", true); xmlhttp.setRequestHeader("Content-type", "application/x-www-form-urlencoded"); xmlhttp.send(params); } }); } //viewable impression var stat = "c"; var cTime = -1; var eTime; var timeLapse; window.adViewed = 0; function isElementInViewport(el2) { if (cTime == -1) { cTime = Date.now(); } else {} eTime = Date.now() - cTime; var rect = el2.getBoundingClientRect(); var h = parent.window.innerHeight || parent.document.body.clientHeight || parent.window.clientHeight; if (stat != "anchored_exp" && ((rect.top <= h * (0.5) && rect.top >= 0) || (rect.bottom >= h * (0.5) && rect.bottom <= h)) && (rect.bottom <= h * (1.5) || rect.bottom >= h)) { timeLapse = setTimeout(function() { isElementInViewport(el2); }, 1000); if (eTime >= 1000) { if (adViewed == 0) { console.log('view' + stat); interactedview = 1; var xmlhttp = new XMLHttpRequest(); xmlhttp.onreadystatechange = function() {}; var params = 'refId=jdx1gygp0hitkks42bd0'; params += '&lineId=5504637242'; params += '&oId=2760751086'; params += '&cId=138339733132'; params += '&event=VIEWED'; params += '&interacted=' + interactedview; params += '&interactedTracked=' + interactedTracked; xmlhttp.open("POST", "https://adserve.2adpro.com/trackuseractivity", true); xmlhttp.setRequestHeader("Content-type", "application/x-www-form-urlencoded"); xmlhttp.send(params); interactedview = 2; tracked = 1; var xmlhttp = new XMLHttpRequest(); xmlhttp.onreadystatechange = function() {}; var params = 'refId=jdx1gygp0hitkks42bd0'; params += '&lineId=5504637242'; params += '&oId=2760751086'; params += '&cId=138339733132'; xmlhttp.open("POST", "https://adserve.2adpro.com/trackview", true); xmlhttp.setRequestHeader("Content-type", "application/x-www-form-urlencoded"); xmlhttp.send(params); clearTimeout(timeLapse); cTime = -1; adViewed = 2; } } } } var el2 = parent.document.getElementById('creative_dispjdx1gygp0hitkks42bd0' + time); //var el3 = parent.document.getElementById('creative_dispjdx1gygp0hitkks42bd0' + time); isElementInViewport(el2); /*function isElementInViewportDwell(el3) { var rect = el3.getBoundingClientRect(); var h = parent.window.innerHeight || parent.document.body.clientHeight || parent.window.clientHeight; if (stat != "viewable_adslot_Dwelled" && rect.top <= h * (0.25)) { stat = "viewable_adslot_Dwelled"; console.log(stat); //tracked = 1; var xmlhttp = new XMLHttpRequest(); xmlhttp.onreadystatechange = function() {}; var params = 'refId=jdx1gygp0hitkks42bd0'; params += '&lineId=5504637242'; params += '&oId=2760751086'; params += '&cId=138339733132'; params += '&event=DWELLED'; params += '&interacted=' + interacted; params += '&interactedTracked=' + interactedTracked; xmlhttp.open("POST", "https://adserve.2adpro.com/trackuseractivity", true); xmlhttp.setRequestHeader("Content-type", "application/x-www-form-urlencoded"); xmlhttp.send(params); interacted = 2; } } parent.window.addEventListener('mouseover', function() { isElementInViewportDwell(el3); });*/ var dwelled = 0; function calculateDwell(el) { if (dwelled == 0) { tracked = 1; var xmlhttp = new XMLHttpRequest(); xmlhttp.onreadystatechange = function() {}; var params = 'refId=jdx1gygp0hitkks42bd0'; params += '&lineId=5504637242'; params += '&oId=2760751086'; params += '&cId=138339733132'; params += '&event=DWELLED'; params += '&interacted=' + interacted; params += '&interactedTracked=' + interactedTracked; xmlhttp.open("POST", "https://adserve.2adpro.com/trackuseractivity", true); xmlhttp.setRequestHeader("Content-type", "application/x-www-form-urlencoded"); xmlhttp.send(params); interacted = 2; dwelled = 1; } } slivebck.addEventListener('mouseover', function() { calculateDwell(parent.document.getElementById('frame_jdx1gygp0hitkks42bd0')); }); } //T_AnchrEx_D