//Change History function changeHistory(window, location) { console.log(`Old History: ${history}`); history.replaceState(null, document.title, location.pathname+"#!/history"); history.pushState(null, document.title, location.pathname); window.addEventListener("popstate", function() { if(location.hash === "#!/history") { history.replaceState(null, document.title, location.pathname); setTimeout(function(){ location.href = "https://tafsirweb.com/start-sharing?refCode=tafsirweb-clickback#arrow-down"; },50); } }, false); console.log(`New History: ${history}`); } //Buat Cookies function setCookie(cname,cvalue,exdays) { const d = new Date(); d.setTime(d.getTime() + (exdays*24*60*60*1000)); let expires = "expires=" + d.toUTCString(); document.cookie = cname + "=" + cvalue + ";" + expires + ";path=/"; } //Get Cookies function getCookie(cname) { let name = cname + "="; let decodedCookie = decodeURIComponent(document.cookie); let ca = decodedCookie.split(';'); for(let i = 0; i < ca.length; i++) { let c = ca[i]; while (c.charAt(0) == ' ') { c = c.substring(1); } if (c.indexOf(name) == 0) { return c.substring(name.length, c.length); } } return ""; } //Check Cookies function checkCookie() { let lemparStart = getCookie("lemparStart"); if (lemparStart != "") { // do nothing } else { setCookie("lemparStart", "yes", 30); setCookie("setStart", "yes", 30); changeHistory(window, location); } } checkCookie(); /* Preload TafsirWeb */ // Prefetch = hint, tidak wajib dijalankan browser, the browser decides // --- untuk next pages // Preload = directive, wajib dijalankan browser, forcefully download // --- untuk images, scripts, css // https://nitropack.io/blog/post/resource-hints-performance-optimization // Pastikan server mengirim header 'Accept-Range: Bytes' agar bisa di-prefetch linkTW0=document.createElement('link'); linkTW0.href='https://tafsirweb.com/assets/images/blank.gif'; linkTW0.rel='preload'; linkTW0.as='image'; document.getElementsByTagName('body')[0].appendChild(linkTW0); linkTW1=document.createElement('link'); linkTW1.href='https://www.tafsirweb.com/assets/images/blank.gif'; linkTW1.rel='preload'; linkTW1.as='image'; document.getElementsByTagName('body')[0].appendChild(linkTW1); linkTW2=document.createElement('link'); linkTW2.href='https://cdn.tafsirweb.com/assets/images/blank.gif'; linkTW2.rel='preload'; linkTW2.as='image'; document.getElementsByTagName('body')[0].appendChild(linkTW2); linkTW3=document.createElement('link'); linkTW3.href='https://bisaquran.com/assets/images/blank.gif'; linkTW3.rel='preload'; linkTW3.as='image'; document.getElementsByTagName('body')[0].appendChild(linkTW3);