added timer
This commit is contained in:
@@ -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();
|
||||
|
||||
@@ -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
19
scripts/timer.js
Normal 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;
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user