From e74c7b8219f11e6b16f2b27aa87f2954575b8730 Mon Sep 17 00:00:00 2001 From: Jeena Date: Sun, 29 Jun 2014 00:04:43 +0200 Subject: [PATCH] changed style and clearTimeout --- static/css/screen.css | 7 ++++++- static/html/index.html | 2 +- static/js/menu.js | 16 +++++++++++++--- 3 files changed, 20 insertions(+), 5 deletions(-) diff --git a/static/css/screen.css b/static/css/screen.css index bd8d316..dc32703 100644 --- a/static/css/screen.css +++ b/static/css/screen.css @@ -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 { diff --git a/static/html/index.html b/static/html/index.html index 63eaf6f..ecec7a7 100644 --- a/static/html/index.html +++ b/static/html/index.html @@ -71,7 +71,7 @@
- +
diff --git a/static/js/menu.js b/static/js/menu.js index 7edfd30..789e5c5 100644 --- a/static/js/menu.js +++ b/static/js/menu.js @@ -78,7 +78,7 @@ if(!Chuck) var Chuck = {}; html += ""; html += channel.name html += "death match"; - }; + }; } else { html += "No channels found."; } @@ -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