Mercurial > hg > nodescore
comparison www/m/js/nodescore-client.js @ 24:22f1c38007ff
latency ping pong check added for clients
author | tzara <rc-web@kiben.net> |
---|---|
date | Wed, 11 Jul 2012 19:44:37 +0100 |
parents | e1a02869da08 |
children | ac9641ecf84f |
comparison
equal
deleted
inserted
replaced
23:e1a02869da08 | 24:22f1c38007ff |
---|---|
55 | 55 |
56 socket.on("countinFromServer", countinClient); | 56 socket.on("countinFromServer", countinClient); |
57 function countinClient(groupID, currentseconds,mm,text,colour,background){ | 57 function countinClient(groupID, currentseconds,mm,text,colour,background){ |
58 var groupPage=document.getElementById('group').value | 58 var groupPage=document.getElementById('group').value |
59 if (groupID == groupPage) { | 59 if (groupID == groupPage) { |
60 console.log(currentseconds); | 60 //console.log(currentseconds); |
61 document.getElementById("countinnumber").style.visibility="visible"; | 61 document.getElementById("countinnumber").style.visibility="visible"; |
62 document.getElementById("countinnumber").style.visibility="visible"; | 62 document.getElementById("countinnumber").style.visibility="visible"; |
63 //$("#countin").text(text); | 63 //$("#countin").text(text); |
64 $("#countinnumber").text(currentseconds); | 64 $("#countinnumber").text(currentseconds); |
65 $("#countinnumber").css('background-color', background); | 65 $("#countinnumber").css('background-color', background); |
155 | 155 |
156 // "h" button for hideall | 156 // "h" button for hideall |
157 var hcheckWebkitandIE=(e.which==104 ? 1 : 0); | 157 var hcheckWebkitandIE=(e.which==104 ? 1 : 0); |
158 var hcheckMoz=(e.which==104 ? 1 : 0); | 158 var hcheckMoz=(e.which==104 ? 1 : 0); |
159 | 159 |
160 console.log(e.which); | 160 // console.log(e.which); |
161 if (checkWebkitandIE || checkMoz) { toggle_visibility('preview') } | 161 if (checkWebkitandIE || checkMoz) { toggle_visibility('preview') } |
162 if (mcheckWebkitandIE || mcheckMoz) { toggle_visibility('metro') } | 162 if (mcheckWebkitandIE || mcheckMoz) { toggle_visibility('metro') } |
163 if (ccheckWebkitandIE || ccheckMoz) { toggle_visibility('client_chronometer') } | 163 if (ccheckWebkitandIE || ccheckMoz) { toggle_visibility('client_chronometer') } |
164 if (hcheckWebkitandIE || hcheckMoz) { | 164 if (hcheckWebkitandIE || hcheckMoz) { |
165 toggle_visibility('client_chronometer') | 165 toggle_visibility('client_chronometer') |
180 socket.on("timeFromServer", function(n) { | 180 socket.on("timeFromServer", function(n) { |
181 socket.emit("clientTimeResponse",n); | 181 socket.emit("clientTimeResponse",n); |
182 }); | 182 }); |
183 socket.on("latencyFromServer", function(latency) { | 183 socket.on("latencyFromServer", function(latency) { |
184 $("#client_latency").text("Latency: "+latency+"ms.") | 184 $("#client_latency").text("Latency: "+latency+"ms.") |
185 console.log(latency) | 185 //console.log(latency) |
186 }); | 186 }); |
187 | 187 |
188 function getLatencies(x) { socket.emit("getLatencies", x); } | 188 function getLatencies(x) { socket.emit("getLatencies", x); } |
189 | 189 |
190 ////////////////////////////////////////////// | 190 ////////////////////////////////////////////// |