27 lines
No EOL
706 B
JavaScript
27 lines
No EOL
706 B
JavaScript
const getCurval = function() {
|
|
const xhttp = new XMLHttpRequest();
|
|
xhttp.withCredentials = true;
|
|
xhttp.onreadystatechange = updateUwuCounter;
|
|
xhttp.open("GET", window.location.href + "/getCurval", true);
|
|
xhttp.send();
|
|
};
|
|
|
|
const updateUwuCounter = function() {
|
|
const uwu_counter = document.getElementById("uwu-counter");
|
|
if (!this.response) {
|
|
uwu_counter.textContent = uwu_counter.textContent;
|
|
} else {
|
|
try {
|
|
uwu_counter.textContent = this.response;
|
|
} catch (error) {
|
|
console.log(error);
|
|
console.log(response);
|
|
}
|
|
}
|
|
};
|
|
|
|
window.addEventListener("load", function() {
|
|
console.log("View specific JS initialized.");
|
|
this.setInterval(getCurval, 5000);
|
|
});
|
|
|