Skip to content

Commit de029bb

Browse files
committed
Initial commit
0 parents  commit de029bb

File tree

10 files changed

+9336
-0
lines changed

10 files changed

+9336
-0
lines changed

.gitmodules

+6
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,6 @@
1+
[submodule "deck-remote-server/websocket-server"]
2+
path = deck-remote-server/websocket-server
3+
url = https://github.com/Worlize/WebSocket-Node.git
4+
[submodule "example/deck.js"]
5+
path = example/deck.js
6+
url = https://github.com/imakewebthings/deck.js.git

deck-remote-client/index.html

+156
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,156 @@
1+
<!DOCTYPE html>
2+
3+
<style type="text/css">
4+
* { margin: 0; padding:0; border: 0; }
5+
html, body {
6+
width: 100%;
7+
overflow:hidden;
8+
font: 16px Helvetica, Arial, sans-serif;
9+
}
10+
11+
a, a:visited {
12+
color: #090;
13+
text-decoration: none;
14+
}
15+
16+
iframe {
17+
border: 1px solid #000;
18+
width: 20%;
19+
height:300px;
20+
float: left;
21+
}
22+
23+
p#cur_frame_label {
24+
width: 50%;
25+
text-align: center;
26+
position: absolute;
27+
left: 25%;
28+
top: 4px;
29+
}
30+
31+
iframe#cur_frame {
32+
width: 50%;
33+
height:300px;
34+
position: absolute;
35+
top: 20px;
36+
left: 25%;
37+
}
38+
39+
p#prev_frame_label {
40+
width: 20%;
41+
text-align: center;
42+
position: absolute;
43+
left: 0;
44+
bottom: 300px;
45+
}
46+
47+
iframe#prev_frame {
48+
position: absolute;
49+
left: 0;
50+
bottom: 0;
51+
}
52+
53+
p#next_frame_label {
54+
width: 20%;
55+
text-align: center;
56+
position: absolute;
57+
right: 0;
58+
bottom: 300px;
59+
}
60+
61+
iframe#next_frame {
62+
position: absolute;
63+
right: 0;
64+
bottom: 0;
65+
}
66+
67+
</style>
68+
<script src="jquery.js"></script>
69+
<script>
70+
try {
71+
if ('WebSocket' in window == false && 'MozWebSocket' in window) window.WebSocket = window.MozWebSocket;
72+
73+
var remoteClient = {
74+
myWebSocket: null,
75+
init: function() {
76+
$this = this;
77+
this.myWebSocket = new WebSocket("ws://127.0.0.1:8080"),
78+
this.myWebSocket.onopen = function(evt) {
79+
$this.myWebSocket.send('{"type":"identify", "data":"client"}');
80+
};
81+
this.myWebSocket.onmessage = function(evt) {
82+
var data = jQuery.parseJSON(evt.data);
83+
if (data.type == 'status') {
84+
$('#current-slide').text(data.data.currentSlide + 1);
85+
}
86+
if (data.type == 'url') {
87+
$this.url = data.data;
88+
$('#prev_frame').attr('src', $this.url + '#mirror-1');
89+
$('#cur_frame').attr('src', $this.url + '#mirror+0');
90+
$('#next_frame').attr('src', $this.url + '#mirror+1');
91+
}
92+
};
93+
this.myWebSocket.onclose = function(evt) {
94+
};
95+
},
96+
next: function() {
97+
this.myWebSocket.send('{"type":"command", "data":"next"}');
98+
},
99+
prev: function() {
100+
this.myWebSocket.send('{"type":"command", "data":"prev"}');
101+
},
102+
}
103+
remoteClient.init();
104+
} catch (e) { alert(e); }
105+
$(function() {
106+
$('#next').click(function() { remoteClient.next(); });
107+
$('#prev').click(function() { remoteClient.prev(); });
108+
$(document).keyup(function(e) {
109+
if (e.keyCode == 37) { remoteClient.prev(); }
110+
if (e.keyCode == 39) { remoteClient.next(); }
111+
});
112+
});
113+
var clock = {
114+
startDate: null,
115+
timer: null,
116+
start: function() {
117+
if (clock.timer) {
118+
clearInterval(clock.timer);
119+
clock.timer = null;
120+
$('#start-stop-clock').text('Start Timer');
121+
return;
122+
}
123+
clock.startDate = new Date();
124+
clock.timer = setInterval(clock.update, 100);
125+
$('#start-stop-clock').text('Stop Timer');
126+
},
127+
update: function() {
128+
var ms = (new Date()).getTime() - clock.startDate.getTime();
129+
var milliseconds = ms % 1000;
130+
milliseconds = "" + milliseconds;
131+
while (milliseconds.length < 3) milliseconds += '0';
132+
var x = Math.floor(ms / 1000);
133+
var seconds = x % 60;
134+
if (seconds < 10) seconds = '0' + seconds;
135+
x = Math.floor(x / 60);
136+
var minutes = x % 60;
137+
if (minutes < 10) minutes = '0' + minutes;
138+
x = Math.floor(x / 60);
139+
var hours = x;
140+
if (hours < 10) hours = '0' + hours;
141+
$('#clock').text(hours + ":" + minutes + ":" + seconds + ":" + milliseconds);
142+
},
143+
};
144+
$(function() { $('#start-stop-clock').click(clock.start); });
145+
</script>
146+
<a href="#" id="prev">&lt;&lt;</a>
147+
<span id="current-slide"></span>
148+
<a href="#" id="next">&gt;&gt;</a><br />
149+
<span id="clock"></span><br />
150+
<a href="#" id="start-stop-clock">Start Timer</a><br />
151+
<p id="prev_frame_label">Previous Slide</p>
152+
<iframe id="prev_frame"></iframe>
153+
<p id="cur_frame_label">Current Slide</p>
154+
<iframe id="cur_frame"></iframe>
155+
<p id="next_frame_label">Next Slide</p>
156+
<iframe id="next_frame"></iframe>

0 commit comments

Comments
 (0)