comparison www/m/js/nodescore-slides.js @ 60:e868cdd4b3e9

.
author tzara <rc-web@kiben.net>
date Sun, 21 Apr 2013 23:41:13 +0000
parents 5ba250832739
children ab53902406d4
comparison
equal deleted inserted replaced
59:5ba250832739 60:e868cdd4b3e9
5 5
6 //socket.on("metroPulse", metronomeTick); 6 //socket.on("metroPulse", metronomeTick);
7 ///////////////////////////////////////////////// 7 /////////////////////////////////////////////////
8 socket.on("metroPulse", pulseInClient); 8 socket.on("metroPulse", pulseInClient);
9 function pulseInClient(pulse,groupID,metrobeat){ 9 function pulseInClient(pulse,groupID,metrobeat){
10
10 var groupPage=document.getElementById('group').value 11 var groupPage=document.getElementById('group').value
11 if (groupID == groupPage) { 12 if (groupID == groupPage) {
12 metronomeTick(1000, groupID, metrobeat); 13 metronomeTick(1000, groupID, metrobeat);
13 } 14 }
14 } 15 }
15 ///////////////////////////////////////////////// 16 /////////////////////////////////////////////////
16 function metroCss(beat, beatcolor,text){ 17 function metroCss(beat, beatcolor,text){
17 var color = beatcolor; 18 var color = beatcolor;
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({color: blue}, 22 // $(".metrocase > div").each(function(){$(this).animate({color: blue},
23 // 50, 23 // 50,
31 metroCss(0, "red", "4") 31 metroCss(0, "red", "4")
32 setTimeout(function(){metroCss(0, "black", "4")},150); 32 setTimeout(function(){metroCss(0, "black", "4")},150);
33 }; 33 };
34 34
35 ///////////////////////////////////////////////// 35 /////////////////////////////////////////////////
36
37 // update the stopwatch value on the client page in line with server 36 // update the stopwatch value on the client page in line with server
38 socket.on("chronFromServer", function(chron) { 37 socket.on("chronFromServer", function(chron) { $("div#client_chronometer").text(chron); });
39 $("div#client_chronometer").text(chron);
40 });
41
42 38
43 // server time 39 // server time
44
45 //var groupPage=document.getElementById('group').value 40 //var groupPage=document.getElementById('group').value
46 //if (groupID == groupPage) { 41 //if (groupID == groupPage) {
47 socket.on("dateTime", function(datetime) { 42 socket.on("dateTime", function(datetime) {
48 $("div#datetime").text("" +datetime); 43 $("div#datetime").text("" +datetime);
49
50 }); 44 });
51 45
52 ///////////////////////////////////////////////// 46 /////////////////////////////////////////////////
53 // countdown to change 47 // countdown to change
54
55 socket.on("countinFromServer", countinClient); 48 socket.on("countinFromServer", countinClient);
56 function countinClient(groupID, currentseconds,mm,text,colour,background,unit){ 49 function countinClient(groupID, currentseconds,mm,text,colour,background,unit){
57 var groupPage=document.getElementById('group').value 50 var groupPage=document.getElementById('group').value
58 if (groupID == groupPage) { 51 if (groupID == groupPage) {
59 //document.getElementById("count").style.visibility="visible";
60 //document.getElementById("midcomms").style.visibility="visible";
61 $("#counttitle").css('color','white'); 52 $("#counttitle").css('color','white');
62 $("#counttitle").text(text); 53 $("#counttitle").text(text);
63 // in box 54 $("#count").text(currentseconds);
64 //$('#sqr'+unit).text(currentseconds);
65 $("#count").text(currentseconds);
66 //$("#cnt").text(currentseconds);
67
68 $("#count").css('background-color', background);
69 document.getElementById("count").style.color=colour; 55 document.getElementById("count").style.color=colour;
70 if ( currentseconds == 0) { 56 }}
71 //document.getElementById("midcomms").style.visibility='hidden';
72 }
73 }}
74 /////////////////////////////////////////////////
75 57
76 ///////////////////////////////////////////////// 58 /////////////////////////////////////////////////
77 // countdown to change 59 // countdown to change
78
79 socket.on("counterText", cText); 60 socket.on("counterText", cText);
80 function cText(groupID, currentseconds,text){ 61 function cText(groupID, currentseconds,text){
81 $("#totalcountdown"+groupID).text(text); 62 $("#totalcountdown"+groupID).text(text);
82 var groupPage=document.getElementById('group').value 63 var groupPage=document.getElementById('group').value
83 if (groupID == groupPage) { 64 if (groupID == groupPage) {
84 //console.log(text) 65 //console.log(text)
85 $("#totalcountdown").text(text); 66 $("#totalcountdown").text(text);
86 }} 67 }}
87 68
88 /////////////////////////////////////// 69 ///////////////////////////////////////
89 function pageFlip(unit) { 70 function pageFlip(unit) { $('#sections').trigger('goto', [parseFloat(unit)]); }
90
91 $('#sections').trigger('goto', [parseFloat(unit)]);
92 }
93 71
94 ///////////////////////////////////////////////// 72 /////////////////////////////////////////////////
95 // call the fancy jquery functions 73 // call the fancy jquery functions
96 //function slideTo (target) { $('#sections').trigger('goto', [target]); } 74 //function slideTo (target) { $('#sections').trigger('goto', [target]); }
97 function pad2(number) { return (number < 10 ? '0' : '') + number } 75 function pad2(number) { return (number < 10 ? '0' : '') + number }
220 socket.on('error', function (e) { 198 socket.on('error', function (e) {
221 message('System', e ? e : 'A unknown error occurred'); 199 message('System', e ? e : 'A unknown error occurred');
222 }); 200 });
223 201
224 function message (from, msg) { 202 function message (from, msg) {
225 $('#lines').append($('<p>').append($('<b>').text(from), msg)); 203 $('#lines').prepend($('<p>').prepend($('<b>').text(from), msg));
226 } 204 }
227 205
228 // dom manipulation 206 // dom manipulation
229 $(function () { 207 $(function () {
230 $('#set-nickname').submit(function (ev) { 208 $('#set-nickname').submit(function (ev) {