changeset 22:bb02a593b7d5

server side push of datetime to client
author tzara <rc-web@kiben.net>
date Wed, 11 Jul 2012 09:51:05 +0100
parents aaf429469697
children e1a02869da08
files nodescore.js www/m/5.html www/m/controls.html www/m/css/nodescore.css www/m/js/nodescore-client.js www/m/seta/img/thumbs/1.png www/m/seta/img/thumbs/2.png www/m/seta/img/thumbs/3.png www/m/seta/img/thumbs/4.png www/m/seta/img/thumbs/5.png www/m/seta/img/thumbs/6.png
diffstat 11 files changed, 42 insertions(+), 5 deletions(-) [+]
line wrap: on
line diff
--- a/nodescore.js	Tue Jul 10 22:34:11 2012 +0100
+++ b/nodescore.js	Wed Jul 11 09:51:05 2012 +0100
@@ -72,6 +72,20 @@
 			   socket.emit('chronFromServer', chron)
 			}
     
+    var ding
+    function dateTime() { 
+
+	ding = setInterval( function () {
+	    var datetime= new Date(); 
+	    var now=datetime.toString()
+//	    console.log(now);
+	    socket.broadcast.emit("dateTime", now);
+ 	    socket.emit("dateTime", now);}, 1000)}
+   
+    clearInterval(ding);
+    dateTime()
+
+    
     function chronometer() {
 	
 	if (chronstate==1){
--- a/www/m/5.html	Tue Jul 10 22:34:11 2012 +0100
+++ b/www/m/5.html	Wed Jul 11 09:51:05 2012 +0100
@@ -24,6 +24,7 @@
     <div id="countinnumber"></div>
     <div id="live"> </div>    
     <div id="preview"></div>    
+    <div id="datetime"></div>
   </div>    
 </body>
 </html>
--- a/www/m/controls.html	Tue Jul 10 22:34:11 2012 +0100
+++ b/www/m/controls.html	Wed Jul 11 09:51:05 2012 +0100
@@ -71,6 +71,8 @@
 	<h1 id="client_latency">0ms</h2>
 </div>
 
+<div id="datetime"></div>
+
       </div>	
       
 
--- a/www/m/css/nodescore.css	Tue Jul 10 22:34:11 2012 +0100
+++ b/www/m/css/nodescore.css	Wed Jul 11 09:51:05 2012 +0100
@@ -91,6 +91,20 @@
     background-color: blue;    
 }
 
+#datetime{
+    opacity: 0.6;
+    height: 30px;
+    width: 700px;
+    font-size:2em;
+    color: white;
+    border: 1px solid white;
+    position: absolute;
+    float: left;
+    bottom: 1px;
+    padding: 5px 5px 5px 5px ;
+    background-color: blue;    
+}
+
 .metrocase {
     position: absolute;
     top: 10px;
@@ -104,7 +118,7 @@
     height: 60px;
     z-index: 2;
     padding: 5px 5px 5px 5px; 
-    border: 1px solid gray;
+    border: 1px solid blue;
 }
 
 #metronome0 { width: 60px; height: 60px; border-radius: 30px; float:left; }
@@ -121,7 +135,7 @@
 }
 
 #client_chronometer{ 
-    border: 2px solid gray ; 
+    border: 1px solid blue ; 
     background-color: black;   
     color: #666;
     font-size: 6em;    
@@ -148,9 +162,6 @@
     height: 800px;
 }
 
-
-
-
 #content-txt {
 //   padding: 2px 2px 2px 2px;
   font-size: 3em;
--- a/www/m/js/nodescore-client.js	Tue Jul 10 22:34:11 2012 +0100
+++ b/www/m/js/nodescore-client.js	Wed Jul 11 09:51:05 2012 +0100
@@ -39,6 +39,15 @@
 });
 
 
+// server time
+
+//var groupPage=document.getElementById('group').value
+//if (groupID == groupPage) {
+    socket.on("dateTime", function(datetime) {
+//	console.log(datetime)
+	$("div#datetime").text("server time: " +datetime);
+	
+    });
 
 
 /////////////////////////////////////////////////
Binary file www/m/seta/img/thumbs/1.png has changed
Binary file www/m/seta/img/thumbs/2.png has changed
Binary file www/m/seta/img/thumbs/3.png has changed
Binary file www/m/seta/img/thumbs/4.png has changed
Binary file www/m/seta/img/thumbs/5.png has changed
Binary file www/m/seta/img/thumbs/6.png has changed