Mercurial > hg > nodescore
comparison www/m/js/nodescore-client.js @ 23:e1a02869da08
reduced to one score file with menu to choose which part stream to receive
added latency results to client and tweeked some css
author | tzara <rc-web@kiben.net> |
---|---|
date | Wed, 11 Jul 2012 14:17:43 +0100 |
parents | bb02a593b7d5 |
children | 22f1c38007ff |
comparison
equal
deleted
inserted
replaced
22:bb02a593b7d5 | 23:e1a02869da08 |
---|---|
17 var color = beatcolor; | 17 var color = beatcolor; |
18 | 18 |
19 $(".metrocase > div").each(function(){$(this).stop()}); | 19 $(".metrocase > div").each(function(){$(this).stop()}); |
20 $(".metrocase > div").each(function(){$(this).css('background-color', beatcolor)}); | 20 $(".metrocase > div").each(function(){$(this).css('background-color', beatcolor)}); |
21 $(".metrocase > div").each(function(){$(this).text(" ")}); | 21 $(".metrocase > div").each(function(){$(this).text(" ")}); |
22 $(".metrocase > div").each(function(){$(this).animate({opacity: 0.5}, | 22 $(".metrocase > div").each(function(){$(this).animate({opacity: 0.6}, |
23 50, | 23 50, |
24 function() { $(this).animate({opacity:0.0}); } | 24 function() { $(this).animate({opacity:0.0}); } |
25 ); | 25 ); |
26 }) | 26 }) |
27 } | 27 } |
43 | 43 |
44 //var groupPage=document.getElementById('group').value | 44 //var groupPage=document.getElementById('group').value |
45 //if (groupID == groupPage) { | 45 //if (groupID == groupPage) { |
46 socket.on("dateTime", function(datetime) { | 46 socket.on("dateTime", function(datetime) { |
47 // console.log(datetime) | 47 // console.log(datetime) |
48 $("div#datetime").text("server time: " +datetime); | 48 $("div#datetime").text("Server Time: " +datetime); |
49 | 49 |
50 }); | 50 }); |
51 | 51 |
52 | 52 |
53 ///////////////////////////////////////////////// | 53 ///////////////////////////////////////////////// |
167 toggle_visibility('preview') | 167 toggle_visibility('preview') |
168 } | 168 } |
169 }); | 169 }); |
170 | 170 |
171 //////////////////////////////////////////////// | 171 //////////////////////////////////////////////// |
172 // this needs to have a variable to define the websocket | |
173 // otherwise we will pings from all sockets connected | |
174 // no! the server broadcasts the ping and the clients emit the pong! | |
175 // ah but then the time reported back from the server needs to be targeted | |
176 // to specific client.. | |
177 ////////////////////////////////////////////// | |
178 // Latency "Pong" | |
179 | |
180 socket.on("timeFromServer", function(n) { | |
181 socket.emit("clientTimeResponse",n); | |
182 }); | |
183 socket.on("latencyFromServer", function(latency) { | |
184 $("#client_latency").text("Latency: "+latency+"ms.") | |
185 console.log(latency) | |
186 }); | |
187 | |
188 function getLatencies(x) { socket.emit("getLatencies", x); } | |
189 | |
190 ////////////////////////////////////////////// |