-
Notifications
You must be signed in to change notification settings - Fork 1
/
index.html
217 lines (175 loc) · 6.37 KB
/
index.html
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="utf-8">
<title>Unplugged!</title>
<script type="text/javascript" src="http://static.firebase.com/v0/firebase.js"></script>
<script type="text/javascript" src="http://www.firebase.com/js/libs/jquery-1.7.1.js"></script>
<script type="text/javascript" src="http://www.firebase.com/submarine/js/libs/json2.min.js"></script>
<script type="text/javascript" src="js/jquery.cookie.js"></script>
<script type="text/javascript" src="synccarousel.js"></script>
<script type="text/javascript" src="js/bootstrap.js"></script>
<script type="text/javascript" src="js/bootstrap-carousel.js"></script>
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<!-- Le styles -->
<link href="css/bootstrap.css" rel="stylesheet">
<link href="css/bootstrap-responsive.css" rel="stylesheet">
<link href="css/app.css" rel="stylesheet">
<!-- Le HTML5 shim, for IE6-8 support of HTML5 elements -->
<!--[if lt IE 9]>
<script src="http://html5shim.googlecode.com/svn/trunk/html5.js"></script>
<![endif]-->
<!-- Fav and touch icons -->
<link rel="shortcut icon" href="ico/favicon.ico">
<link rel="apple-touch-icon-precomposed" sizes="144x144" href="ico/apple-touch-icon-144-precomposed.png">
<link rel="apple-touch-icon-precomposed" sizes="114x114" href="ico/apple-touch-icon-114-precomposed.png">
<link rel="apple-touch-icon-precomposed" sizes="72x72" href="ico/apple-touch-icon-72-precomposed.png">
<link rel="apple-touch-icon-precomposed" href="ico/apple-touch-icon-57-precomposed.png">
<!-- Scripts -->
<script src="js/gen_validatorv4.js" type="text/javascript"></script>
</head>
<body>
<div id="initContainer" class="container">
<div class="row pagination-centered">
<img src="img/plug.png" class="logo" />
</div>
<div class="row">
<span class="span6 offset3 pagination-centered mainOutline">
<p class="prompt">Start controlling this screen:</p>
<p id="number"></p>
</span>
</div>
<div class="row pagination-centered or">
<p>or</p>
</div>
<div class="row">
<span id="loadByCode" class="span6 offset3 pagination-centered mainOutline">
<p class="pronpt">Join a presentation by entering its code:</p>
<input type="text" id="codeEntry1" class="codeEntry" name="codeEntry1" maxlength="1" />
<input type="text" id="codeEntry2" class="codeEntry" name="codeEntry2" maxlength="1" />
<input type="text" id="codeEntry3" class="codeEntry" name="codeEntry3" maxlength="1" />
<input type="text" id="codeEntry4" class="codeEntry" name="codeEntry4" maxlength="1" />
</span>
</div>
<div class="row pagination-centered or">
<p>or</p>
</div>
<div class="row">
<span class="span6 offset3 pagination-centered mainOutline">
<a href="create.html" class="createPresentation">Create a presentation!</a>
</span>
</div>
<div class="row">
<span class="span8 offset2 bottom">
<div class="row-fluid">
<span class="span6">
<p><a href="about.html">Learn more about Unplugged!</a></p>
</span>
<span class="span6 pagination-right">
<p>A TechCrunch Disrupt product powered by <a href="http://twitter.com/firebase" target="_blank">Firebase</a>.</p>
</span>
</div>
</span>
</div>
</div> <!-- /container -->
<div id="carouselContainer" class="hide">
<div id="myCarousel" class="carousel slide" style="width: 100%; height: 100%;">
<!-- Carousel items -->
<div id="slideHolder" class="carousel-inner">
</div>
</div>
</div>
<script type="text/javascript">
//first, lets make up a screen id.
var screenId = '' + Math.floor(Math.random() * 10000);
//make sure to display leading "0"
while(screenId.length < 4) {
screenId = "0" + screenId;
}
//Create a Firebase reference to the root of the data
var dataRoot = new Firebase("http://gamma.firebase.com/unplugged/")
$('input').keyup(function(e) {
if(e.which == 8) {
shiftFocus(e.currentTarget.id, -1);
}
});
$('input').keypress(function(e) {
if(e.which >= 48 && e.which <= 57)
{
//Move to the next textBox
shiftFocus(e.currentTarget.id, 1);
} else {
e.preventDefault();
}
});
//Check when we've entered the code, then called loadPresentation
$(function() {
var content = $("#" + entryBoxList[entryBoxList.length - 1]).val();
$("#" + entryBoxList[entryBoxList.length - 1]).keyup(function() {
if ($("#" + entryBoxList[entryBoxList.length - 1]).val() != content) {
content = $("#" + entryBoxList[entryBoxList.length - 1]).val();
var presentationCode = "";
for ( var j = 0; j < entryBoxList.length; j++ )
{
presentationCode += $("#" + entryBoxList[j]).val();
}
loadPresentation(presentationCode);
}
});
});
var entryBoxList = ["codeEntry1", "codeEntry2", "codeEntry3", "codeEntry4"];
function shiftFocus(fromField, dir)
{
for ( var i = 0; i < entryBoxList.length; i++)
{
//Move focus to the next text box
if ( fromField === entryBoxList[i] && (i + dir) >= 0 && (i + dir) < entryBoxList.length)
{
var newBox =$("#" + entryBoxList[i+dir]);
newBox.val("");
newBox.focus();
}
}
}
$(function(){
$("#" + entryBoxList[0]).focus();
});
function loadPresentation(presentationCode) {
//Hide the input box.
$("#loadByCode").hide();
//and start watching this screen id
waitForScreenId(presentationCode);
}
var unlisten = null;
function doUnlisten() {
if(unlisten != null) {
unlisten();
}
}
/**
* Watches Firebase for this screen ID to get pointed to a user.
*/
function waitForScreenId(sid) {
doUnlisten();
$("#number").text(sid);
//Now create a Firebase reference to watch the screen ID
var screenRoot = dataRoot.child("screens").child(sid);
var func = screenRoot.on("value", function(uidSnap) {
var uid = uidSnap.val();
if(uid != null) {
$("#initContainer").hide();
$("#carouselContainer").show();
displayCarousel(dataRoot.child("users").child(uid), $("#myCarousel"), $("#slideHolder"));
doUnlisten();
}
});
unlisten = function() {
screenRoot.off("value", func);
}
}
dataRoot.child("screens").child(screenId).remove(function() {
waitForScreenId(screenId);
});
</script>
</body>
</html>