abgame/static/js/autoReload.js

25 lines
724 B
JavaScript
Raw Permalink Normal View History

2023-06-04 21:13:12 +02:00
function countdown() {
var timeleft = 3;
var reloadTimer = setInterval(function () {
if (timeleft <= 0) {
document.getElementById("next").innerHTML = 0;
clearInterval(reloadTimer);
window.location.replace('/')
} else {
document.getElementById("next").innerHTML = timeleft;
}
timeleft -= 1;
2023-06-06 10:42:00 +02:00
}, 750);
2023-06-04 21:13:12 +02:00
}
2023-06-04 02:59:37 +02:00
function autoReload() {
document.querySelectorAll('input[type="radio"]').forEach(function (el) {
el.addEventListener('change', checkForm, { once: true });
});
function checkForm(e) {
2023-06-04 22:38:09 +02:00
if (document.querySelectorAll('input[type="radio"]:checked').length == 5) {
2023-06-04 02:59:37 +02:00
countdown();
}
}
}