-
Notifications
You must be signed in to change notification settings - Fork 0
/
portal.html
215 lines (189 loc) · 6.61 KB
/
portal.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
<!DOCTYPE html>
<html data-ember-extension="1">
<!--<![endif]-->
<script type="text/javascript">
if (sessionStorage.getItem('room') === null || sessionStorage.getItem('user') === null)
{
window.location = 'http://vidiio.github.io/index.html';
}
</script>
<head>
<meta charset="utf-8">
<title>Vidiio</title>
<script type="text/javascript" src="./assets/pd.js"></script>
<script type="text/javascript" async="" src="./assets/inpage_linkid.js" id="undefined"></script>
<script type="text/javascript" async="" src="./assets/bf.min.js"></script>
<script type="text/javascript" async="" src="./assets/ga.js"></script>
<script src="./assets/30715011.js"></script>
<script src="//code.jquery.com/ui/1.11.2/jquery-ui.js"></script>
<script>
$(function() {
$( document ).tooltip();
});
</script>
<style>
label {
display: inline-block;
width: 5em;
}
</style>
<link href='http://fonts.googleapis.com/css?family=Source+Sans+Pro:300,400,700' rel='stylesheet' type='text/css'>
<link rel="stylesheet" type="text/css" href="portalstyles.css">
<link rel="shortcut icon" href="images/favicon.ico" type="image/x-icon">
<link rel="icon" href="images/favicon.ico" type="image/x-icon">
</head>
<body id="app" class="satemplate" data-ember-extension="1">
<div id="header">
<a href="index.html"><button id="back"><img src="images/back.png" height="40" width="40"></button></a>
<span id="title"></span>
<button id="tab_img">Image</button>
<button id="tab_vid" disabled>Video</button>
</div>
<div id="vid_control">
<div id="player1"></div>
<input type="text" id="url" placeholder="video link" style="display:none;">
<button id="toggledraw" title = "Toggle draw on/off"><img src="images/draw.png" height="40" width="40"></button>
<button id="toggleurl" title = "Enter URL to change video"><img src="images/link.png" height="40" width="40"></button>
</div>
<div id="img_control" style="display: none;">
<input type="text" id="imglink" placeholder="image link">
</div>
<div class="chat">
<div id='box'></div>
<div class="messagebox">
<textarea id='input' placeholder='Chat.'></textarea>
</div>
</div>
<section id="main" style="display:none;">
<canvas id="drawCanvas" width="300" height="300">Canvas is not supported on this browser!</canvas>
<section id="colorSwatch">
<input type="radio" name="color" id="color01" data-color="gold" checked><label for="color01"></label>
<input type="radio" name="color" id="color02" data-color="darkorange"> <label for="color02"></label>
<input type="radio" name="color" id="color03" data-color="navy"> <label for="color03"></label>
<input type="radio" name="color" id="color04" data-color="yellowgreen"> <label for="color04"></label>
<input type="radio" name="color" id="color05" data-color="firebrick"> <label for="color05"></label>
<input type="radio" name="color" id="color06" data-color="powderblue"> <label for="color06"></label>
<button id="clear"><img src="images/x.png" height="40" width="40" title = "Clear all drawings"></button>
</section>
</section>
<script src="./assets/pubnub.min.js"></script>
<script src="./assets/main.js"></script>
<script src="http://code.jquery.com/jquery-2.1.1.min.js"></script>
<script src="./videosync.js"></script>
<script src="./app.js"></script>
<script>
var vidid = 'A9HV5O8Un6k';
var channel = sessionStorage.room;
var user = sessionStorage.user; // set username
//var user ="asdf" + Math.random().toString(); //remove
$('#title').html(channel);
$('#toggledraw').click(function() {
$('#url').hide();
$('#main').fadeToggle();
});
$('#toggleurl').click(function() {
$('#main').hide();
$('#url').fadeToggle();
});
$('#tab_vid').click(function() {
$('#img_control').hide();
$('#vid_control').fadeIn();
$(this).prop('disabled', true);
$('#tab_img').prop('disabled', false);
$('#main').hide();
document.getElementById('colorSwatch').style.left="150px";
document.getElementById("drawCanvas").style.backgroundImage = "none";
});
$('#tab_img').click(function() {
$('#vid_control').hide();
$('#img_control').fadeIn();
$(this).prop('disabled', true);
$('#tab_vid').prop('disabled', false);
$('#main').fadeIn();
document.getElementById('colorSwatch').style.left="25px";
});
$('#url').focus(function() {
player1.pauseVideo();
});
$('#url').keypress(function(e) {
if(e.keyCode == 13) {
var match = $('#url').val().match(/[?&]v=([^&]+)/);
vidid = match[1];
player1.loadVideoById(vidid);
}
});
var tag = document.createElement('script');
tag.src = "https://www.youtube.com/iframe_api";
var firstScriptTag = document.getElementsByTagName('script')[0];
firstScriptTag.parentNode.insertBefore(tag, firstScriptTag);
var playerVars = {
modestbranding: 1,
theme: 'light',
showinfo: 0,
rel: 0,
fs: 0
};
var vidSync1 = new VideoSync(channel, user);
var player1;
function onYouTubeIframeAPIReady() {
player1 = new YT.Player('player1', {
height: '550',
width: '925',
videoId: vidid,
playerVars: playerVars,
events: {
'onReady': vidSync1.onPlayerReady,
'onStateChange': vidSync1.onPlayerStateChange
}
});
}
var pubnub = PUBNUB.init({
publish_key: 'pub-c-8ca801fc-d70a-4a96-b09a-250ca597a6e9',
subscribe_key: 'sub-c-09c251d0-a40f-11e4-a3fb-0619f8945a4f',
uuid: user
});
(function(){
var box = PUBNUB.$('box');
var input = PUBNUB.$('input');
PUBNUB.subscribe({
channel : channel,
callback : function(m) {
box.innerHTML = box.innerHTML + ('<b>' + m.text.user + "</b>: " + m.text.chat) + '<br>'
}
});
PUBNUB.bind( 'keyup', input, function(e) {
(e.keyCode || e.charCode) === 13 && PUBNUB.publish({
channel : channel,
message : {
text: {
chat: input.value,
user: user
}
},
x : (input.value='')
})
} )
})();
PUBNUB.publish({
channel : channel,
message : {
text: {
chat: 'Joined the Channel!',
user: user
}
}
})
$(window).on('beforeunload', function(){
PUBNUB.publish({
channel : channel,
message : {
text: {
chat: 'Left the Channel.',
user: user
}
}
})
});
</script>
</body>
</html>