var overlayHtml = "
"; var isEdge = /Edge/.test(navigator.userAgent); var isMobile = /Android|webOS|iPhone|iPad|iPod/i.test(navigator.userAgent); var isNewEdge = /Edg/.test(navigator.userAgent); var isChrome = /Chrome/.test(navigator.userAgent) && /Google Inc/.test(navigator.vendor); if (!isChrome) { isChrome = /CriOS/.test(navigator.userAgent); if (isChrome) isMobile = true; } var isOpera = /OPR/.test(navigator.userAgent); if (isOpera && isChrome) { isChrome = false; } if (isNewEdge && isChrome) { isChrome = false; } if (isEdge && isChrome) { isChrome = false; } var isFirefox = navigator.userAgent.toLowerCase().indexOf('firefox') > -1; var script_tag = document.getElementById('aawinterscript'); var query = script_tag.src.replace(/^[^\?]+\??/, ''); var vars = query.split("&"); var args = {}; for (var i = 0; i < vars.length; i++) { var pair = vars[i].split("="); args[pair[0]] = decodeURI(pair[1]).replace(/\+/g, ' '); } var pkey = args['key']; var channel = args['ch']; var sUrl = "//serve.adworldmedia.com/ads?key=" + pkey + "&ch=" + channel + "&width=0&height=0"; var nochrome = args['nochrome']; var delay = args['d']; if (delay === undefined) { idelay = 3; } else { if (isMobile) idelay = 6; else { //idelay = parseInt(delay); idelay = 4; } } console.log("**Delay: " + idelay); $(document).ready(function () { console.log("**AAW Overlay V5.8"); var browser = navigator.userAgent; if (nochrome != "1") { isChrome = false; } if (!isChrome) { var launchInter = getCookie("aawlaunch"); var intLaunch = parseInt(launchInter); if (launchInter == "") { //No Cookie, do not launch. //Set Cookie, with value of 0 setCookie("aawlaunch", 0, "360"); console.log("**Launch: No, Cookie created"); } else { //cookie found console.log("**Cookie: " + intLaunch); if (intLaunch >= idelay) { //check for cap cookie var capCookie = getCookie("aawcaplaunch"); //if doesn't exist, launch if (capCookie == "") { //Launch console.log("**Cap Cookie Not Found, Continue with Launch. set Cap Cookie to prevent a premature launch."); setCookie("aawlaunch", 0, "360"); setCookie("aawcaplaunch", 1, "360"); loadPop(sUrl, idelay); } else { console.log("**Cap Cookie Found, Do Not Launch") } } else { console.log("**Increment Cookie: " + intLaunch + 1); setCookie("aawlaunch", intLaunch + 1, "360"); } } } else { console.log("**No Chrome"); } }); function closePop() { //$('.aawcontent').SlickModals('closePopup'); $("#aawiframeid").hide(); } function loadPop(sUrl, delay) { console.log("**Launching LoadPop"); if (delay === undefined) { idelay = 2; } else { idelay = parseInt(delay); } //Launch console.log("**Overlay GO"); setCookie("aawlaunch", 0, "15"); setCookie("aawcaplaunch", 1, "1440"); const vw = Math.max(document.documentElement.clientWidth || 0, window.innerWidth || 0); const vh = Math.max(document.documentElement.clientHeight || 0, window.innerHeight || 0); var height = parseInt(vh); var width = parseInt(vw); console.log("**Width: " + width); console.log("**Height = " + height); var width = width - 90; var head = document.getElementsByTagName('head')[0]; var link = document.createElement('link'); link.id = 'aawpopCss'; link.rel = 'stylesheet'; link.type = 'text/css'; //link.href = '//cluster.awmserve.com/int_over/slickmodal.min.css'; link.href = '//cluster.awmserve.com/incstage/aawover.css'; link.media = 'all'; head.appendChild(link); if (isMobile) { console.log("**Mobile Browser: " + navigator.userAgent); //overlayHtml = overlayHtml.replace("scale=1.0", "scale=1.5"); overlayHtml = overlayHtml.replace("scolling=\"no\"", "scolling=\"yes\""); } var overlaycontent = document.createElement('div'); //overlaycontent.classList.add('aawcontent'); overlaycontent.classList.add('aaw_overlay'); overlaycontent.id = "aawiframeid"; overlaycontent.setAttribute('data-sm-init', 'true'); overlaycontent.setAttribute('width', width); overlaycontent.setAttribute('height', height); overlaycontent.innerHTML = overlayHtml; overlaycontent.setAttribute('display', 'none'); document.body.appendChild(overlaycontent); console.log("**Delay: " + idelay); var iframeGet = document.getElementById('aaw_window'); iframeGet.setAttribute('src', sUrl); //document.getElementById('aawiframeid').setAttribute('display', 'inline'); $("#aawiframeid").height(height) .css({ 'position': 'absolute', 'top': 0, 'left': 0, 'background-color': 'rgba(0,0,0, 0.6)', 'width': '100%', 'z-index': 5000 }); } function changeme() { console.log("**Cookie not found, launch"); console.log("**Getting all links"); var a_all = document.getElementsByTagName("a"); var anchors = []; for (var i = 0; i < a_all.length; i++) { anchors.push([a_all[i].href, i]); } console.log("Found " + anchors.length + " anchors that will be altered."); for (var j = 0; j < anchors.length; j++) { var _i = anchors[j][1]; a_all[_i].className = 'myclass'; } } function setCookie(cname, cvalue, exMin) { var d = new Date(); d.setTime(d.getTime() + (exMin * 60 * 1000)); var expires = "expires=" + d.toUTCString(); if (location.protocol === 'https:') { document.cookie = cname + "=" + cvalue + ";" + expires + ";path=/; SameSite=None; Secure"; } else { document.cookie = cname + "=" + cvalue + ";" + expires + ";path=/"; } } function getCookie(cname) { var name = cname + "="; var decodedCookie = decodeURIComponent(document.cookie); var ca = decodedCookie.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 getUrlParameter(name) { name = name.replace(/[\[]/, '\\[').replace(/[\]]/, '\\]'); var regex = new RegExp('[\\?&]' + name + '=([^]*)'); var results = regex.exec(location.search); return results === null ? '' : decodeURIComponent(results[1].replace(/\+/g, ' ')); };