var apxTag = window.apxTag || {}; apxTag.cmd = apxTag.cmd || []; apxTag.data = apxTag.data || {}; apxTag.getCookie = function(cookieKey) { var cookies = document.cookie; var cookieItemList = cookies.split(';'); for (var i = 0; i < cookieItemList.length; i++) { try { var cookieItem = cookieItemList[i]; var cookieItemKey = cookieItem.split('=', 1)[0].trim(); var cookieItemValue = cookieItem.substring(cookieItem.indexOf('=') + 1); if (cookieKey === cookieItemKey) { return decodeURIComponent(cookieItemValue); } } catch (e) { continue; } } return undefined; }; (function(){ var APX_DIV_PREFIX = 'apxzone_'; var APX_IFRAME_PREFIX = 'apxiframe_'; var APX_COOKIE_PREFIX = 'apxz_'; apxTag.data.zones = apxTag.data.zones || {}; var zone = apxTag.data.zones["HtW59M-Q"] || {}; var createXMLHttpRequest = function() { var xmlHttp = null; if (typeof XDomainRequest !== 'undefined' && window.FormData === undefined) { return new XDomainRequest(); } else if (typeof XMLHttpRequest !== 'undefined') { xmlHttp = new XMLHttpRequest(); } else { return null; } return xmlHttp; }; var addAdsIframe = function(enc_zone_id, divid, ads_iframe_url, ads_iframe_html) { var iframeId = APX_IFRAME_PREFIX + enc_zone_id; var iframe = document.createElement('iframe'); var div = document.getElementById(divid); // set parent font size 0 to reset iframe's default height div.style.fontSize = '0px'; iframe.width = "336"; iframe.height = "280"; iframe.style.border = 'none'; iframe.style.overflow = 'hidden'; iframe.marginheight = 0; iframe.marginwidth = 0; iframe.frameBorder = 0; iframe.scrolling = 'no'; iframe.id = iframeId; div.appendChild(iframe); if(ads_iframe_url) { iframe.src = ads_iframe_url; } else { var fw = (iframe.contentWindow || iframe.contentDocument); fw.document.open(); fw.document.write(ads_iframe_html); fw.document.close(); } }; var showPassback = function(enc_zone_id, divid) { var passback_url = ('https:' == document.location.protocol ? 'https://' : 'http://') + "cdn.adnw.xyz/pb/HtW59M-Q/passback.html"; if (typeof zone.registerPassback !== 'undefined') { setTimeout(function() { zone.registerPassback(); }, 0); } else { var xhr = createXMLHttpRequest(); xhr.onload = function() { var passbackHtml = xhr.responseText; passbackHtml = '\n' + passbackHtml + ''; addAdsIframe(enc_zone_id, divid, null, passbackHtml); if (typeof zone.onPassback !== 'undefined') { setTimeout(function() { zone.onPassback(); }, 0); } } xhr.open('GET', passback_url); xhr.send(); } }; var sendLog = function(msg) { try{ var xhr = createXMLHttpRequest(); var log_url = ('https:' == document.location.protocol ? 'https://' : 'http://') + 'log.apx.appier.net/log?msg=' + encodeURIComponent(msg); xhr.open('GET', log_url); } catch(err) { } }; var showCreative = function(enc_zone_id, divid, cid, crid) { var page_url = ""; var creative_url = ('https:' == document.location.protocol ? 'https://' : 'http://') + "crt.adnw.xyz/pb/0wHT9JDiP3SORJx/show?hzid=HtW59M-Q&cid=" + cid + "&crid=" + crid + "&apx_info=lI7fkqQhj9MBJzvJ1UEjUU8tWCC_Nu-Xt6s3vZX7MRcQ1h1o4ObJv4a6sVKPJaHAXa9cIjItLlJHpJ1JgktU29&bi=MVwzquvdBrK-ZROr1PguXA&pg=" + encodeURIComponent(page_url) + ""; addAdsIframe(enc_zone_id, divid, creative_url, null); if (typeof zone.onAdLoaded !== 'undefined') { setTimeout(function() { sendLog("showCreativeAjax: " + divid + ",bi: MVwzquvdBrK-ZROr1PguXA"); new Image().src = "//log.apx.appier.net/log?msg=showCreativeSrc&divid=" + divid + "&bi=MVwzquvdBrK-ZROr1PguXA"; zone.onAdLoaded(); }, 0); } }; var messageHandler = function(enc_zone_id, divid) { window.addEventListener('message', function(e) { if (e.data && typeof(e.data) === 'object' && 'apxMsgType' in e.data && (enc_zone_id === e.data['encZoneId'])) { var iframeId = APX_IFRAME_PREFIX + enc_zone_id; var msgType = e.data.apxMsgType; if (msgType === 'resize') { var ifa = document.getElementById(iframeId); ifa.height = e.data.height; } else if (msgType === 'passback') { var div = document.getElementById(divid); var adIframe = document.getElementById(iframeId); if (div !== null && adIframe !== null) { div.removeChild(adIframe); } showPassback(enc_zone_id, divid); } } }); } try { var cid_crid_cookie = apxTag.getCookie(APX_COOKIE_PREFIX + "HtW59M-Q") || ''; var cid_cookie = ''; var crid_cookie = ''; var enc_zone_id = "HtW59M-Q"; var divid = APX_DIV_PREFIX + enc_zone_id; if (cid_crid_cookie) { var cid_crid = cid_crid_cookie.split('|'); if(cid_crid.length === 2){ cid_cookie = cid_crid[0]; crid_cookie = cid_crid[1]; } } var cid = zone.cid || "" || cid_cookie ; var crid = zone.crid || "" || crid_cookie; if (cid && crid) { showCreative(enc_zone_id, divid, cid, crid); } else{ showPassback(enc_zone_id, divid); } } catch(err) { showPassback(enc_zone_id, divid); } messageHandler(enc_zone_id, divid); })();