diff --git a/code/chrono.js b/code/chrono.js index b8f025b..1d4ccf0 100644 --- a/code/chrono.js +++ b/code/chrono.js @@ -22,8 +22,9 @@ function chrono(){ } else if(msec < 100){ msec = "0" +msec - } - document.getElementById("chronotime").innerHTML = hr + ":" + min + ":" + sec + } + document.getElementById("chronotime").innerHTML = hr + ":" + min + ":" + sec + timerID = setTimeout("chrono()", 10) } function chronoStart(){ diff --git a/code/game.html b/code/game.html index 487d0b8..9626c1a 100644 --- a/code/game.html +++ b/code/game.html @@ -11,6 +11,7 @@ @@ -43,6 +44,7 @@ + diff --git a/code/index.html b/code/index.html index 7b18736..785ca2c 100644 --- a/code/index.html +++ b/code/index.html @@ -6,15 +6,22 @@

- - + Jouer la partie en :
+
- +
- +
- +
+ +
+ +
+ + +
diff --git a/code/selecteur.js b/code/selecteur.js index d124d66..442500e 100644 --- a/code/selecteur.js +++ b/code/selecteur.js @@ -20,4 +20,13 @@ if(get['diff']=="no-res") document.getElementById("canvasR").style.display="none"; document.getElementById("reserveText").style.display="none"; } -objPts=get['mode']; \ No newline at end of file +if (get['mode'].includes('p')) +{ + objPts=get['mode'].substring(0,get['mode'].length-1); + document.getElementById("timer").style.display="none"; +} +else if(get['mode'].includes('m')) +{ + tpsRem=[0,parseInt(get['mode'].substring(0,get['mode'].length-1),10),0]; + document.getElementById("chronotime").style.display="none"; +} \ No newline at end of file diff --git a/code/timer.js b/code/timer.js new file mode 100644 index 0000000..50d04a6 --- /dev/null +++ b/code/timer.js @@ -0,0 +1,27 @@ +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); \ No newline at end of file