changed style and clearTimeout

This commit is contained in:
Jeena 2014-06-29 00:04:43 +02:00
parent 9e6c42f221
commit e74c7b8219
3 changed files with 20 additions and 5 deletions

View file

@ -12,6 +12,11 @@ body {
display: table;
}
#back-to-menu {
display: inline-block;
margin: 10px;
}
::selection {
background: #607950; /* Safari */
}
@ -99,7 +104,7 @@ canvas {
right: 0;
top: 0;
padding: 10px;
background: #222;
background: #333;
}
#devtools p {

View file

@ -71,7 +71,7 @@
</form>
</article>
<article id="game">
<button onclick="window.location.href='/'">Menu</button>
<button id="back-to-menu" onclick="window.location.href='/'">Menu</button>
<div id="canvasContainer">
<canvas id="canvas"></canvas>
</div>

View file

@ -167,7 +167,7 @@ if(!Chuck) var Chuck = {};
function startTimer(seconds) {
var now = new Date();
var end = new Date(now.getTime() + seconds * 1000);
setInterval(function() {
channelDestructionTimeout = setInterval(function() {
now = new Date();
var diff = new Date(end.getTime() - now.getTime());
if(diff.getTime() < 0) {
@ -263,6 +263,15 @@ if(!Chuck) var Chuck = {};
$("#menu").style.display = "none";
$("#game").style.display = "block";
Chuck.run(channelName, nickname);
if(refreshInterval) {
clearInterval(refreshInterval);
}
if(channelDestructionTimeout) {
clearInterval(channelDestructionTimeout);
}
}
}
@ -301,7 +310,8 @@ if(!Chuck) var Chuck = {};
$("#refresh").onclick = refresh;
refresh();
setInterval(refresh, 5000);
var channelDestructionTimeout = null;
var refreshInterval = setInterval(refresh, 5000);
Chuck.menu = {
show: show