diff --git a/src/alfagok/static/game.js b/src/alfagok/static/game.js index 0ea9245..e1e7457 100644 --- a/src/alfagok/static/game.js +++ b/src/alfagok/static/game.js @@ -135,7 +135,7 @@ function getFormattedTime(milliseconds) { /* Clipboard stuff **/ -var clip = new Clipboard('.copy'); +let clip = new Clipboard('.copy'); clip.on("success", function(e) { document.getElementById('copyresults').innerHTML = '

Gekopieerd! Deel je resultaat.

'; @@ -150,23 +150,23 @@ clip.on("error", function() { /* Game timer, original from alphaguess.com **/ function go() { - window.timerID = window.setInterval(timer, 0); + window.timerID = window.setInterval(timer, 0); } function timer(){ - var nextgame = document.getElementById('nextgame'); - var now = new Date(); - var midnight = new Date(now.getFullYear(), now.getMonth(), now.getDate()+1, 0, 0, 0); - var diff = Math.floor((midnight - now)/1000); - var hoursRemain = Math.floor(diff/(60*60)); - var minutesRemain = Math.floor((diff-hoursRemain*60*60)/60); - var secondsRemain = Math.floor(diff%60); - nextgame.innerHTML = ''+addZero(hoursRemain)+':'+addZero(minutesRemain)+':'+addZero(secondsRemain)+' over'; + let nextgame = document.getElementById('nextgame'); + let now = new Date(); + let midnight = new Date(now.getFullYear(), now.getMonth(), now.getDate()+1, 0, 0, 0); + let diff = Math.floor((midnight - now)/1000); + let hoursRemain = Math.floor(diff/(60*60)); + let minutesRemain = Math.floor((diff-hoursRemain*60*60)/60); + let secondsRemain = Math.floor(diff%60); + nextgame.innerHTML = ''+addZero(hoursRemain)+':'+addZero(minutesRemain)+':'+addZero(secondsRemain)+' over'; } function addZero(num){ - if(num <=9) return '0'+num; - else return num; + if(num <=9) return '0'+num; + else return num; } go();