Clock/update.js

34 lines
815 B
JavaScript
Raw Normal View History

2022-09-13 15:57:56 +00:00
var prevSha = localStorage.getItem("commitsha") ?? "ThisShouldntBeASHA";
setInterval(reqData, 60000);
2022-09-13 15:57:56 +00:00
2022-09-13 18:13:11 +00:00
//balls lmao
2022-09-13 15:57:56 +00:00
function reqData() {
2022-09-14 14:44:56 +00:00
var donedata = (e) => {
var resp = e;
2022-09-13 15:57:56 +00:00
if (event.target.status.toString().includes("40")) {
console.log(event.target.status + " error :[")
return;
}
if (resp != prevSha) {
2022-09-13 15:57:56 +00:00
if (prevSha == "ThisShouldntBeASHA") {
localStorage.setItem("commitsha", resp);
2022-09-13 15:57:56 +00:00
} else {
document.querySelector(".scr-update--").classList.add("open");
setTimeout(() => {
window.location.href = window.location.href;
2022-09-13 16:07:07 +00:00
}, 15000);
localStorage.setItem("commitsha", resp);
2022-09-13 15:57:56 +00:00
}
}
2022-09-14 14:44:56 +00:00
};
2022-09-13 15:57:56 +00:00
2022-09-14 14:44:56 +00:00
fetch("https://ClockCheckGithub.meowcatheorange.repl.co")
.then(x => x.text())
.then(y => donedata(y));
2022-09-13 15:57:56 +00:00
}
reqData();