-
Notifications
You must be signed in to change notification settings - Fork 6
/
Copy pathchat.html
536 lines (444 loc) · 12.7 KB
/
chat.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
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
<!doctype html>
<html>
<head>
<meta charset="UTF-8">
<meta name="SOS Mentors" content="Peer to Peer Mentoring">
<meta name="keywords" content="HTML,CSS,XML,JavaScript">
<meta name="Team Tiffanie" content="HackingEDU Project">
<!-- API's: Moxtra, Twilio, Back& (?) -->
<!-- Twitter Bootstrap -->
<link rel="stylesheet" href="http://maxcdn.bootstrapcdn.com/bootstrap/3.3.5/css/bootstrap.min.css">
<link href='https://fonts.googleapis.com/css?family=Lato:400,700,300' rel='stylesheet' type='text/css'>
<style>
a, h1, p, h2{
font-family: 'Lato', sans-serif;
}
h2 {
font-weight: normal;
font-size: 30px;
margin-bottom: 20px;
margin-top: 0;
}
.textbox p {
font-size: 18px;
font-weight: lighter;
}
body {
background-color: #FFE6DE;
}
.box {
box-shadow: 3px 3px 8px #888888;
}
.box h1 {
background-color: #fff;
margin: 0;
padding-left: 30px;
padding-top: 20px;
padding-bottom: 20px;
font-size: 40px;
color: #888;
text-shadow: 1px 1px #000;
font-weight: lighter;
}
a:hover, a:visited, a:link{
text-decoration: none;
}
.box h1 span {
color: #fff;
text-shadow: 2px 2px #B00800;
font-weight: normal;
-webkit-text-stroke-width: 1px;
-webkit-text-stroke-color: #B00800;
}
.box ul {
text-align: right;
background-color: #7F736F;
}
.box li {
display: inline;
padding-left: 50px;
padding-right: 50px;
color: #E5531F;
}
.box li a {
color: #fff;
font-size: 16px;
font-weight: lighter;
display: inline;
}
.box li a:hover {
color: #000;
}
.separator1 {
background: url("sep1bg.jpg");
border-style: solid;
border-width: 1px;
border-color: #756D67;
margin: 0;
margin-bottom: 30px;
margin-top: 20px;
}
.separator1 h1, .separator2 h1, .separator3 h1 {
padding-top: 80px;
padding-bottom: 80px;
text-align: center;
color: #fff;
text-shadow: 2px 2px 2px #000;
}
.separator2 {
background: url("sep2bg.jpg");
border-style: solid;
border-width: 1px;
border-color: #756D67;
margin: 0;
margin-top: 30px;
margin-bottom: 30px;
}
.separator3 {
background: url("sep3bg.jpg");
border-style: solid;
border-width: 1px;
border-color: #756D67;
margin: 0;
margin-top: 30px;
margin-bottom: 30px;
}
.textbox {
background-color: #fff;
padding-top: 35px;
padding-bottom: 35px;
margin-top: 5px;
margin-bottom: 5px;
}
footer {
height: 200px;
text-align: center;
padding-top: 70px;
background-color: #E5DED9;
margin-top: 30px;
color: #888;
font-weight: lighter;
border-top: solid 1px #BFB9B5;
}
html {
color: #222;
font-size: 1em;
line-height: 1.4;
}
/*
* Remove text-shadow in selection highlight:
* https://twitter.com/miketaylr/status/12228805301
*
* These selection rule sets have to be separate.
* Customize the background color to match your design.
*/
::-moz-selection {
background: #b3d4fc;
text-shadow: none;
}
::selection {
background: #b3d4fc;
text-shadow: none;
}
/*
* A better looking default horizontal rule
*/
hr {
display: block;
height: 1px;
border: 0;
border-top: 1px solid #ccc;
margin: 1em 0;
padding: 0;
}
/*
* Remove the gap between audio, canvas, iframes,
* images, videos and the bottom of their containers:
* https://github.com/h5bp/html5-boilerplate/issues/440
*/
audio,
canvas,
iframe,
img,
svg,
video {
vertical-align: middle;
}
/*
* Remove default fieldset styles.
*/
fieldset {
border: 0;
margin: 0;
padding: 0;
}
/*
* Allow only vertical resizing of textareas.
*/
textarea {
resize: vertical;
}
/* ==========================================================================
Browser Upgrade Prompt
========================================================================== */
.browserupgrade {
margin: 0.2em 0;
background: #ccc;
color: #000;
padding: 0.2em 0;
}
/* ==========================================================================
Author's custom styles
========================================================================== */
/* ==========================================================================
Helper classes
========================================================================== */
/*
* Hide visually and from screen readers:
*/
.hidden {
display: none !important;
}
/*
* Hide only visually, but have it available for screen readers:
* http://snook.ca/archives/html_and_css/hiding-content-for-accessibility
*/
.visuallyhidden {
border: 0;
clip: rect(0 0 0 0);
height: 1px;
margin: -1px;
overflow: hidden;
padding: 0;
position: absolute;
width: 1px;
}
/*
* Extends the .visuallyhidden class to allow the element
* to be focusable when navigated to via the keyboard:
* https://www.drupal.org/node/897638
*/
.visuallyhidden.focusable:active,
.visuallyhidden.focusable:focus {
clip: auto;
height: auto;
margin: 0;
overflow: visible;
position: static;
width: auto;
}
/*
* Hide visually and from screen readers, but maintain layout
*/
.invisible {
visibility: hidden;
}
/*
* Clearfix: contain floats
*
* For modern browsers
* 1. The space content is one way to avoid an Opera bug when the
* `contenteditable` attribute is included anywhere else in the document.
* Otherwise it causes space to appear at the top and bottom of elements
* that receive the `clearfix` class.
* 2. The use of `table` rather than `block` is only necessary if using
* `:before` to contain the top-margins of child elements.
*/
.clearfix:before,
.clearfix:after {
content: " "; /* 1 */
display: table; /* 2 */
}
.clearfix:after {
clear: both;
}
/* ==========================================================================
EXAMPLE Media Queries for Responsive Design.
These examples override the primary ('mobile first') styles.
Modify as content requires.
========================================================================== */
@media only screen and (min-width: 35em) {
/* Style adjustments for viewports that meet the condition */
}
@media print,
(-webkit-min-device-pixel-ratio: 1.25),
(min-resolution: 1.25dppx),
(min-resolution: 120dpi) {
/* Style adjustments for high resolution devices */
}
/* ==========================================================================
Print styles.
Inlined to avoid the additional HTTP request:
http://www.phpied.com/delay-loading-your-print-css/
========================================================================== */
@media print {
*,
*:before,
*:after {
background: transparent !important;
color: #000 !important; /* Black prints faster:
http://www.sanbeiji.com/archives/953 */
box-shadow: none !important;
text-shadow: none !important;
}
a,
a:visited {
text-decoration: underline;
}
a[href]:after {
content: " (" attr(href) ")";
}
abbr[title]:after {
content: " (" attr(title) ")";
}
/*
* Don't show links that are fragment identifiers,
* or use the `javascript:` pseudo protocol
*/
a[href^="#"]:after,
a[href^="javascript:"]:after {
content: "";
}
pre,
blockquote {
border: 1px solid #999;
page-break-inside: avoid;
}
/*
* Printing Tables:
* http://css-discuss.incutio.com/wiki/Printing_Tables
*/
thead {
display: table-header-group;
}
tr,
img {
page-break-inside: avoid;
}
img {
max-width: 100% !important;
}
p,
h2,
h3 {
orphans: 3;
widows: 3;
}
h2,
h3 {
page-break-after: avoid;
}
}
@media screen and (max-width: 647px) {
.box a {
text-align: center;
display: block;
}
}
</style>
<!-- Include Moxtra JavaScript Library -->
<script type="text/javascript" src="https://www.moxtra.com/api/js/moxtra-latest.js" id="moxtrajs"></script>
<!-- Authenticate/Initialize and get the "Access Token" for the user -->
<!-- Refer to the doc at https://developer.moxtra.com/docs/docs-oauth/#uniqueid to authenticate user based on UniqueID Method -->
<!-- For other authentication methods and overview refer to the doc at https://developer.moxtra.com/docs/docs-authentication/ -->
<!-- In this example user is authenticated and access token is passed as a URL parameter -->
<!-- JS function to get access token from the URL parameter -->
<script type="text/javascript" >
function getURLParameter(name) {
return decodeURIComponent((new RegExp('[?|&]' + name + '=' + '([^&;]+?)(&|#|;|$)').exec(location.search)||[,""])[1].replace(/\+/g, '%20'))||null
}
function parseURI() {
var uri = window.location.hash.substring(1);
var elements = uri.split('&');
var data = new Object();
for(i = 0; i < elements.length; i++) {
var cur = elements[i].split('=');
data[cur[0]] = cur[1];
}
return data;
}
urldata = parseURI();
access_token=urldata.access_token;
if (access_token) {
// Initialize Moxtra SDK Object
var options = {
mode: "production",
client_id: "r3muLyOsAxQ", //
access_token: access_token,
invalid_token: function(event) {
//Triggered when the access token is expired or invalid
alert("Access Token expired for session id: " + event.session_id);
}
};
Moxtra.init(options);
}
else {
//Authenticate and get access token for the user before proceeding further
console.log ("No access token found");
}
</script>
<!-- Start Chat Function -->
<script type="text/javascript">
function start_chat () {
var chat_options = {
//unique id of the users who will be part of the chat. These users should already exist in Moxtra.
unique_id: "unique_user_id_2,unique_user_id_3",
iframe: true,
//ID of the HTML tag within which the chat window will show up. Refer https://developer.grouphour.com/moxo/docs-js-sdk/#conversation
tagid4iframe: "chat-container",
iframewidth: "1000px",
iframeheight: "750px",
autostart_meet: true,
autostart_note: true,
extension: { "show_dialogs": { "member_invite": true } },
start_chat: function(event) {
console.log("Chat started binder ID: " + event.binder_id);
//Your application server can upload files to draw using the binder_id and access_token
},
start_meet: function(event) {
console.log("Meet started session key: " + event.session_key + " session id: " + event.session_id);
},
end_meet: function(event) {
console.log("Meet end event");
},
invite_member: function(event) {
console.log("Invite member into binder Id: " + event.binder_id);
},
request_note: function(event) {
console.log("Note start request");
},
error: function(event) {
console.log("Chat error code: " + event.error_code + " error message: " + event.error_message);
}
};
Moxtra.chat(chat_options);
}
</script>
</head>
<body>
<div class="box">
<a href="#"><h1><span class="red">SOS</span> Mentors</h1></a>
<ul>
<li><a href="#mentors">Mentors</a></li>
<li><a href="#classes">Classes</a></li>
<li><a href="#">Chat</a></li>
<li><a href="#">Sign Up</a></li>
<li><a href="#">Log In</a></li>
</ul>
</div>
<h3><a id="getToken" href="javascript:start_chat();">Moxtra Chat</a></h3>
<div id="chat-container"></div>
<footer>
<p>Copyright SOS Mentors 2015<br>
Powered by the Moxtra API<br>
Built in a weekend at HackingEDU 2015
</p>
</footer>
<script src="js/main.js"></script>
<script src="js/plugins.js"></script>
<script src="js/vendor/jquery-1.11.3.min.js"></script>
<script src="js/vendor/modernizr-2.8.3.min.js"></script>
<!-- Moxtra API Javascript File -->
<script type="text/javascript" src="https://www.moxtra.com/api/js/moxtra-latest.js" id="moxtrajs" />
</body>
</html>