From 6a8ae720310021b13f8aec447482f05641c8f908 Mon Sep 17 00:00:00 2001 From: Jules Laplace Date: Fri, 22 Feb 2013 11:50:49 -0800 Subject: dirs --- public/css/drawdrawdraw.css | 1 + public/index.html | 37 ++++--------------------------------- public/js/game.js | 26 ++++++++++++++++++++++++++ 3 files changed, 31 insertions(+), 33 deletions(-) create mode 100644 public/css/drawdrawdraw.css create mode 100644 public/js/game.js (limited to 'public') diff --git a/public/css/drawdrawdraw.css b/public/css/drawdrawdraw.css new file mode 100644 index 0000000..20f548b --- /dev/null +++ b/public/css/drawdrawdraw.css @@ -0,0 +1 @@ +html,body { padding: 0; margin: 0; width: 100%; height: 100%; } diff --git a/public/index.html b/public/index.html index 9fa2d48..2336d19 100644 --- a/public/index.html +++ b/public/index.html @@ -1,46 +1,17 @@ -dump2 +drawdrawdraw + - + + -
- - -
- -
- diff --git a/public/js/game.js b/public/js/game.js new file mode 100644 index 0000000..d7c96dc --- /dev/null +++ b/public/js/game.js @@ -0,0 +1,26 @@ +var socket = io.connect(window.location.hostname); + + + +var imageCount = 0; +socket.on('join', function(json) { + var data = JSON.parse(json); + for (var i in data) { + appendImage(data[i]); + } +}); +socket.on('url', function(json) { + var data = JSON.parse(json); + appendImage(data); +}); +function appendImage(img) { + var image = new Image(); + image.src = img.url; + $("#images").prepend(image); + imageCount++; + while (imageCount > 20) { + $("#images").children().last().remove(); + imageCount--; + } +} + -- cgit v1.2.3-70-g09d2