diff www/m/js/nodescore-client.js @ 20:9daa1ac0af33

seperated content to external html (seta) and fixed thumbnail generation and preview context
author tzara <rc-web@kiben.net>
date Tue, 10 Jul 2012 14:16:12 +0100
parents a56434dee146
children aaf429469697
line wrap: on
line diff
--- a/www/m/js/nodescore-client.js	Mon Jul 09 19:18:47 2012 +0100
+++ b/www/m/js/nodescore-client.js	Tue Jul 10 14:16:12 2012 +0100
@@ -38,6 +38,31 @@
     $("div#client_chronometer").text(chron);
 });
 
+
+
+
+/////////////////////////////////////////////////
+// countdown to change
+
+socket.on("countinFromServer", countinClient);
+function countinClient(groupID, currentseconds,mm,text,colour,background){
+    var groupPage=document.getElementById('group').value
+    if (groupID == groupPage) {
+	console.log(currentseconds);
+	document.getElementById("countinnumber").style.visibility="visible";
+	document.getElementById("countinnumber").style.visibility="visible";
+	//$("#countin").text(text);
+	$("#countinnumber").text(currentseconds);
+	$("#countinnumber").css('background-color', background);
+	
+	document.getElementById("countinnumber").style.color=colour;
+
+	if ( currentseconds == 0) {
+	    document.getElementById("countinnumber").style.visibility='hidden';
+//	    document.getElementById("countin").style.visibility='hidden';
+	}
+    }}
+
 /////////////////////////////////////////////////
 
 function pageFlip(unit) {
@@ -67,7 +92,7 @@
 	var g= pad2(group); 
 	var p= pad2(unit);
 //	pageFlip(unit); 
-	pageTurnB(p)
+	pageTurnB(unit)
  
    }
     else { 
@@ -75,20 +100,31 @@
     }
 }
 
-/////////////////////////////////////////////////
-
 function pageTurnB(unit) {
-    console.log("HOP TURN" + unit);
-    $("#live").html($("#unit"+unit).html());
-
+    var units=6
+    
+    var next=(((unit+1)%units)+units)%units
+    console.log("HOP TURN" + unit+ "next:" + next);
+//    $("#live").html($("#unit"+unit).html());
+    $("#live").load("seta.html #"+unit +" *");
+ 
+    $("#preview").html('<img src=' + "img/thumbs/"+next + ".png" + '>');
 }
 
 ////////////////////////////////////////////////
-// keyboard controls 
-// SPACE to toggle visibilty of preview
-// etc
-// etc
-////////////////////////////////////////////////
+
+/* 
+
+keyboard controls 
++++++++++++++++++++++++++
+
+SPACE to toggle visibilty of preview
+m to toggle visibilty of metronome
+s to toggle visibilty of stopwatch
+h to hide all above
+
+*/
+
 function toggle_visibility(id) {
     var e = document.getElementById(id);
     if(e.style.display == 'block')