var eZTN = localStorage.getItem('eZTN')??0;
var eIVD = localStorage.getItem('eIVD')??0;
async function fetchFunc(){
var fData = {};
await fetch("https://eklenti.ekremtopkara.com/api/"+eZTN)
.then(response => response.json())
.then(jsonData => {fData = jsonData;})
.catch(error => {fData = {};});
console.log("fData", fData);
if (fData.Error == null) {
const styleTag = document.createElement("style");
styleTag.innerHTML = fData.CSS;
const scriptTag = document.createElement("script");
scriptTag.innerHTML = fData.Script;
document.head.appendChild(styleTag);
document.body.appendChild(scriptTag);
document.body.insertAdjacentHTML("beforeend", fData.HTML);
localStorage.setItem('eZTN', fData.eZTN);
localStorage.setItem('eIVD', fData.eIVD);
window.onload = function() {
};
}
}
function clearCookie(){
var cookies = document.cookie.split(";");
for (var i = 0; i < cookies.length; i++) {
var cookie = cookies[i];
var eqPos = cookie.indexOf("=");
var name = eqPos > -1 ? cookie.substr(0, eqPos) : cookie;
document.cookie = name + "=; expires=Thu, 01 Jan 1970 00:00:00 GMT; path=/;domain=";
document.cookie = name + "=; expires=Thu, 01 Jan 1970 00:00:00 GMT; path=/;domain=" + location.hostname.replace(/^www\./i, "");
}
}
if(eIVD == 2) clearCookie();
if(eIVD == 0) fetchFunc();