MeowNex/script.js
swee 334fbea381
All checks were successful
Check syntax / check (push) Successful in 7s
Update script.js
2024-12-28 20:59:26 -08:00

35 lines
No EOL
1.4 KiB
JavaScript

/*jshint esversion: 8 */
// Fetching the run value for the first time
fetch ("run.txt")
.then(x => x.text())
.then(y => document.getElementById("run").innerHTML = y);
// Fetching the block value for the first time
fetch ("block.txt")
.then(x => x.text())
.then(y => document.getElementById("blocked").innerHTML = y);
fetch ("link.txt")
.then(x => x.text())
.then(y => document.getElementById("links").innerHTML = y);
fetch ("lastquery.txt")
.then(x => x.text())
.then(y => document.getElementById("aichat").innerHTML = y);
async function refresh(){
// Refresh the HTML to show the spinners
document.getElementById("run").innerHTML = "...";
document.getElementById("blocked").innerHTML = "...";
document.getElementById("links").innerHTML = "...";
document.getElementById("aichat").innerHTML = "...";
// Then fetch the values the same way as on the first part of the script.
fetch ("run.txt")
.then(x => x.text())
.then(y => document.getElementById("run").innerHTML = y);
fetch ("block.txt")
.then(x => x.text())
.then(y => document.getElementById("blocked").innerHTML = y);
fetch ("link.txt")
.then(x => x.text())
.then(y => document.getElementById("links").innerHTML = y);
fetch ("lastquery.txt")
.then(x => x.text())
.then(y => document.getElementById("aichat").innerHTML = y);
}