Skip to content

Commit

Permalink
timer text
Browse files Browse the repository at this point in the history
  • Loading branch information
Roboneet committed Feb 19, 2018
1 parent cfe37fb commit 93f579c
Show file tree
Hide file tree
Showing 2 changed files with 12 additions and 3 deletions.
2 changes: 1 addition & 1 deletion main/static/assets/css/common.css
Original file line number Diff line number Diff line change
Expand Up @@ -115,7 +115,7 @@ body {
text-align: right;
}
.overlay p {
font-size: 20px;
font-size: 16px;
color: #FFFFFF;
margin: 0 auto;
}
Expand Down
13 changes: 11 additions & 2 deletions main/templates/minesweeper.html
Original file line number Diff line number Diff line change
Expand Up @@ -47,7 +47,7 @@ <h1>CHECKMATE 18<span class="letter6">_</span></h1>
<p>

<progress value="0" max="7200" id="progressBar"></progress>
<span id="countdowntimer">0 </span> Seconds
<span id="countdowntimer" style="font-size: 22px;display: block;">01:00:00</span>



Expand Down Expand Up @@ -161,13 +161,22 @@ <h1>CHECKMATE 18<span class="letter6">_</span></h1>
var timeleft2 = timeleft1-1;
var downloadTimer = setInterval(function(){
document.getElementById("progressBar").value = 7200 - --timeleft1;
document.getElementById("countdowntimer").textContent = timeleft2--;
timeleft2--;
var seconds = (timeleft2%60);
var minutes = Math.floor((timeleft2/60)%60);
var hours = Math.floor((timeleft2/3600))
var timeText = pad(hours) + " : " + pad(minutes) + " : " + pad(seconds);
// console.log(timeleft2)
document.getElementById("countdowntimer").textContent = timeText;
if(timeleft1 <= 0){
clearInterval(downloadTimer);
gameOver();
}
},1000);

function pad(text){
return ("00" + text).slice(-2);
}

function openInst(){
window.location.href = "/main/welcome"
Expand Down

0 comments on commit 93f579c

Please sign in to comment.