You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
32 lines
1002 B
32 lines
1002 B
var fin = new Date();
|
|
fin.setMinutes(fin.getMinutes()+tpsRem[1]);
|
|
document.getElementById("timer").innerHTML = tpsRem[0] + ":" + tpsRem[1] + ":" + tpsRem[2];
|
|
|
|
// Update the count down every 1 second
|
|
var x = setInterval(function() {
|
|
|
|
// Get today's date and time
|
|
var now = new Date().getTime();;
|
|
|
|
|
|
// Find the distance between now and the count down date
|
|
var distance = fin - now;
|
|
|
|
// Time calculations for days, hours, minutes and seconds
|
|
var hours = Math.floor((distance % (1000 * 60 * 60 * 24)) / (1000 * 60 * 60));
|
|
var minutes = Math.floor((distance % (1000 * 60 * 60)) / (1000 * 60));
|
|
var seconds = Math.floor((distance % (1000 * 60)) / 1000);
|
|
|
|
document.getElementById("timer").innerHTML = hours + ":" + minutes + ":" + seconds;
|
|
|
|
// If the count down is over, write some text
|
|
if (distance < 0) {
|
|
clearInterval(x);
|
|
window.location.replace("./score.html?pts="+points);
|
|
}
|
|
}, 1000);
|
|
|
|
function addTime(secs)
|
|
{
|
|
fin.setSeconds(fin.getSeconds()+secs);
|
|
} |