-
Notifications
You must be signed in to change notification settings - Fork 0
/
player.html
211 lines (183 loc) · 7.35 KB
/
player.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
<!DOCTYPE html>
<html>
<head>
<link type="text/css" rel="stylesheet" href="style.css?version=2">
<script src="Scripts/DataChannel.js"></script>
<script src="https://ajax.googleapis.com/ajax/libs/jquery/1.11.2/jquery.min.js"></script>
<script src="./svg-pan-zoom.js"></script>
<style type="text/css"></style>
<script src="Scripts/client.js?version=1" type="text/javascript"></script>
</head>
<body>
<div id="overlay">
<div id="Connection">
<span class="largefont" id="first"> Connecting! </span><br>
</div>
</div>
<div id="sagPanel">
<div id="ChatPanel">
<div id="chatOutput">
</div>
<textarea id="chatInput" rows="3" cols="50"></textarea>
<button id="send" onClick="sendEvent();" type="button">Send</button>
</div>
</div>
<div id="solPanel">
<div id="beforeStart">
<div id="chooserDiv">
<div class="chooserRow">
<div id="Stark" class="chooserElement">
<img src="images/houseOfStark.PNG"/>
<h3>House of Stark</h3>
</div>
<div id="Arryn" class="chooserElement">
<img src="images/houseOfArryn.PNG"/>
<h3>House of Arryn</h3>
</div>
<div id="Baratheon" class="chooserElement">
<img src="images/houseOfBaratheon.PNG"/>
<h3>House of Baratheon</h3>
</div>
</div>
<div class="chooserRow">
<div id="Greyjoy" class="chooserElement">
<img src="images/houseOfGreyjoy.PNG"/>
<h3>House of Greyjoy</h3>
</div>
<div class="chooserElement">
</div>
<div id="Lannister" class="chooserElement">
<img src="images/houseOfLannister.PNG"/>
<h3>House of Lannister</h3>
</div>
</div>
<div class="chooserRow">
<div id="Martell" class="chooserElement">
<img src="images/houseOfMartell.PNG"/>
<h3>House of Martell</h3>
</div>
<div id="Tully" class="chooserElement">
<img src="images/houseOfTully.PNG"/>
<h3>House of Tully</h3>
</div>
<div id="Tyrell" class="chooserElement">
<img src="images/houseOfTyrell.PNG"/>
<h3>House of Tyrell</h3>
</div>
</div>
</div>
<div id="waiting">
Waiting For Respond...
</div>
<script>
var waiting = "none";
$(".chooserElement img").click(function () {
waiting = $(this).prop('src').split('houseOf')[1].split('.')[0];
channel.send('choose-' + waiting + '-' + sesUserId);
$(".chooserElement").css("display", "none");
$("#waiting").css("display", "block");
});
</script>
</div>
<object id="svgCanvas" type="image/svg+xml" data="map.svg"></object>
<script>
var count = 0;
var username = prompt("Please enter your name");
var dragging = 0;
var color;
var class1;
var svgDoc;
var svgDom = document.getElementById("svgCanvas");
svgDom.addEventListener("load", function () {
svgDoc = svgDom.contentDocument;
var path = $(svgDoc).find('path');
$(svgDoc).ready(function () {
$(path).hover(function () {
class1 = $(svgDoc).find('.' + $(this).attr('class'));
if (myHouse != class1.attr('class')) {
color = class1.css('fill');
class1.css('fill', '#DBB8FF');
}
}, function () {
switch (class1.attr('class')) {
case 'Stark':
class1.css('fill', '#b4b4b4');
break;
case 'Tully':
class1.css('fill', '#00b7f0');
break;
case 'Greyjoy':
class1.css('fill', '#9b5a3c');
break;
case 'Arryn':
class1.css('fill', '#2e3699');
break;
case 'Lannister':
class1.css('fill', '#99002f');
break;
case 'KingsLand':
class1.css('fill', '#fff');
break;
case 'Baratheon':
class1.css('fill', '#fef200');
break;
case 'Tyrell':
class1.css('fill', '#23b14d');
break;
case 'Martell':
class1.css('fill', '#ff7e00');
break;
}
});
$(path).mousedown(function () {
$(svgDoc).mousemove(function () {
dragging = 1;
});
});
$(svgDoc).mouseup(function () {
$(svgDoc).unbind('mousemove');
});
$(path).click(function () {
if (dragging != 1) {
//alert($(this).attr('id')+" komsu "+AdjArray[$(this).attr('id')] + " " + event.type);
} else {
dragging = 0;
return false;
}
});
});
}, false);
// Don't use window.onLoad like this in production, because it can only listen to one function.
window.onload = function () {
var beforePan;
beforePan = function (oldPan, newPan) {
var stopHorizontal = false,
stopVertical = false,
gutterWidth = 210,
gutterHeight = 210
// Computed variables
,
sizes = this.getSizes(),
leftLimit = -((sizes.viewBox.x + sizes.viewBox.width) * sizes.realZoom) + gutterWidth,
rightLimit = sizes.width - gutterWidth - (sizes.viewBox.x * sizes.realZoom),
topLimit = -((sizes.viewBox.y + sizes.viewBox.height) * sizes.realZoom) + gutterHeight,
bottomLimit = sizes.height - gutterHeight - (sizes.viewBox.y * sizes.realZoom)
customPan = {}
customPan.x = Math.max(leftLimit, Math.min(rightLimit, newPan.x))
customPan.y = Math.max(topLimit, Math.min(bottomLimit, newPan.y))
return customPan
}
// Expose to window namespace for testing purposes
window.panZoom = svgPanZoom('#svgCanvas', {
zoomEnabled: true,
controlIconsEnabled: true,
fit: 1,
center: 1,
beforePan: beforePan
});
// panZoom.setBeforePan(beforePan)
};
</script>
</div>
</body>
</html>