Update update.js
This commit is contained in:
parent
2f3ef75e34
commit
165d7daa0e
1 changed files with 7 additions and 19 deletions
24
update.js
24
update.js
|
@ -1,26 +1,12 @@
|
||||||
var prevSha = localStorage.getItem("commitsha") ?? "ThisShouldntBeASHA";
|
function reqData(start) {
|
||||||
|
|
||||||
setInterval(reqData, 60000);
|
|
||||||
|
|
||||||
//balls lmao
|
|
||||||
|
|
||||||
function reqData() {
|
|
||||||
var donedata = (e) => {
|
var donedata = (e) => {
|
||||||
var resp = e;
|
var resp = e;
|
||||||
|
|
||||||
// if (event.target.status.toString().includes("40")) {
|
|
||||||
// console.log(event.target.status + " error :[")
|
|
||||||
// return;
|
|
||||||
// }
|
|
||||||
|
|
||||||
if (resp != prevSha) {
|
if (resp != prevSha) {
|
||||||
|
window.sessionStorage.setItem("commitsha", resp);
|
||||||
|
if (start) return;
|
||||||
document.querySelector("#updatesha").innerHTML = `from ${prevSha} to ${resp}`;
|
document.querySelector("#updatesha").innerHTML = `from ${prevSha} to ${resp}`;
|
||||||
if (prevSha == "ThisShouldntBeASHA") {
|
|
||||||
localStorage.setItem("commitsha", resp);
|
|
||||||
} else {
|
|
||||||
document.querySelector("#updatedialog").classList.add("open");
|
document.querySelector("#updatedialog").classList.add("open");
|
||||||
localStorage.setItem("commitsha", resp);
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
|
@ -29,4 +15,6 @@ function reqData() {
|
||||||
.then(y => donedata(y));
|
.then(y => donedata(y));
|
||||||
}
|
}
|
||||||
|
|
||||||
reqData();
|
setInterval(reqData, 60000);
|
||||||
|
|
||||||
|
reqData(true);
|
||||||
|
|
Loading…
Reference in a new issue