added timer

This commit is contained in:
2020-03-16 03:43:44 +01:00
parent 3e7d944827
commit f45aa57693
4 changed files with 25 additions and 3 deletions

View File

@@ -20,6 +20,7 @@ var no_fail_round = 0;
var round_values = 0;
function initiate() { // Call all the functions
setInterval(setTime, 1000);
round_value();
lifes();
prep();

View File

@@ -21,11 +21,11 @@ function uncheck() {
}
function check_allowspin() {
allow_spin = true;
document.getElementById("button-text-01-spin").innerHTML = "Disable spinning board";
document.getElementById("button-text-01-spin").innerHTML = "Disable spinning";
}
function uncheck_allowspin() {
allow_spin = false;
document.getElementById("button-text-01-spin").innerHTML = "Enable spinning board";
document.getElementById("button-text-01-spin").innerHTML = "Enable spinning";
}
function cardspeed(){
viewspeed = document.getElementById("card-speed-number-value").value;

19
scripts/timer.js Normal file
View File

@@ -0,0 +1,19 @@
var minutesLabel = document.getElementById("minutes");
var secondsLabel = document.getElementById("seconds");
var totalSeconds = 0;
function setTime() {
if(!health == 0){
++totalSeconds;
secondsLabel.innerHTML = pad(totalSeconds % 60);
minutesLabel.innerHTML = pad(parseInt(totalSeconds / 60));
}
}
function pad(val) {
var valString = val + "";
if (valString.length < 2) {
return "0" + valString;
} else {
return valString;
}
}