-
Notifications
You must be signed in to change notification settings - Fork 5
Expand file tree
/
Copy pathBaseView.html
More file actions
203 lines (191 loc) · 8.4 KB
/
BaseView.html
File metadata and controls
203 lines (191 loc) · 8.4 KB
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
<!DOCTYPE html>
<#-- @ftlvariable name="" type="com.example.views.PersonView" -->
<head>
<meta charset="utf-8">
<meta name="viewport"
content="width=device-width, initial-scale=1, shrink-to-fit=no">
<meta name="description" content="">
<meta name="author" content="">
<title>Equations GameView 1.0</title>
<link rel="stylesheet" href="/css/bootstrap.min.css">
<link rel="stylesheet" href="/css/custom.css">
<!-- Sets the style for the elements -->
<style>
#resources {
background-color: #7B3DB2;
width: 100%;
height: 33vh;
border: 1px solid black;
}
#forbidden, #permitted, #required {
background-color: #12EC38;
margin: auto;
width: 33%;
float: left;
height: 33vh;
border: 1px solid black;
}
#proposedSolution {
background-color: #7B3DB2;
float: left;
width: 60%;
height: 33vh;
border: 1px solid black;
}
#solution {
background-color: #7B3DB2;
float: left;
width: 39%;
height: 33vh;
border: 1px solid black;
}
.menuButton {
height: 50px;
width: 100px;
font-size: 100%;
float: left;
}
.challenge {
background-color: #f44336;
height: 50px;
width: 100px;
font-size: 100%;
float: right;
}
</style>
<!-- The code that allows the dice to be dropped into their places -->
<script>
function allowDrop(ev){
ev.preventDefault();
}
<!-- Essentially just transfers text data between locations -->
function drag(ev){
ev.dataTransfer.setData("text", ev.target.id);
}
<!-- Allows dice to drop and sends drop location to Controller -->
function drop(ev) {
ev.preventDefault();
var data = ev.dataTransfer.getData("text");
ev.target.appendChild(document.getElementById(data));
this.sendDropLoc(ev.target.id)
}
<!-- Loads the dice images when the page loads -->
function loadDice(id, link){
document.getElementById(id).src = link;
}
let socket = new WebSocket("url");
socket.onopen = function(e) {
alert("[open] Connection established");
alert("Sending to server");
socket.send("New Message");
};
socket.onmessage = function(event) {
alert(`[message] Data received from server: ${event.data}`);
};
socket.onclose = function(event) {
if (event.wasClean) {
alert(`[close] Connection closed cleanly, code=${event.code} reason=${event.reason}`);
} else {
// e.g. server process killed or network down
// event.code is usually 1006 in this case
alert('[close] Connection died');
}
};
socket.onerror = function(error) {
alert(`[error] ${error.message}`);
};
</script>
</head>
<body>
<div style="justify-content: center;">
<div align="center">
<h1 align="center">Equations</h1>
<button id=menuButton>Menu</button>
<button id=challenge>Challenge</button>
</div>
<!-- Makes the dice and puts them in the resources -->
<div id="resources" ondrop="drop(event)" ondragover="allowDrop(event)">
<img
src="https://etc.usf.edu/clipart/21900/21988/square_21988_md.gif"
onload="loadDice(${die.id?html}, ${die.face?html}" draggable="true" ondragstart="drag(event)"
id="1" width="100px" height="100px"> <img
src="https://etc.usf.edu/clipart/21900/21988/square_21988_md.gif"
onload="loadDice(${die.id?html}, ${die.face?html}" draggable="true" ondragstart="drag(event)"
id="2" width="100px" height="100px"> <img
src="https://etc.usf.edu/clipart/21900/21988/square_21988_md.gif"
onload="loadDice(${die.id?html}, ${die.face?html}" draggable="true" ondragstart="drag(event)"
id="3" width="100px" height="100px"> <img
src="https://etc.usf.edu/clipart/21900/21988/square_21988_md.gif"
onload="loadDice(${die.id?html}, ${die.face?html}" draggable="true" ondragstart="drag(event)"
id="4" width="100px" height="100px"> <img
src="https://etc.usf.edu/clipart/21900/21988/square_21988_md.gif"
onload="loadDice(${die.id?html}, ${die.face?html}" draggable="true" ondragstart="drag(event)"
id="5" width="100px" height="100px"> <img
src="https://etc.usf.edu/clipart/21900/21988/square_21988_md.gif"
onload="loadDice(${die.id?html}, ${die.face?html}" draggable="true" ondragstart="drag(event)"
id="6" width="100px" height="100px"> <img
src="https://etc.usf.edu/clipart/21900/21988/square_21988_md.gif"
onload="loadDice(${die.id?html}, ${die.face?html}" draggable="true" ondragstart="drag(event)"
id="7" width="100px" height="100px"> <img
src="https://etc.usf.edu/clipart/21900/21988/square_21988_md.gif"
onload="loadDice(${die.id?html}, ${die.face?html}" draggable="true" ondragstart="drag(event)"
id="8" width="100px" height="100px"> <img
src="https://etc.usf.edu/clipart/21900/21988/square_21988_md.gif"
onload="loadDice(${die.id?html}, ${die.face?html}" draggable="true" ondragstart="drag(event)"
id="9" width="100px" height="100px"> <img
src="https://etc.usf.edu/clipart/21900/21988/square_21988_md.gif"
onload="loadDice(${die.id?html}, ${die.face?html}" draggable="true" ondragstart="drag(event)"
id="10" width="100px" height="100px"> <img
src="https://etc.usf.edu/clipart/21900/21988/square_21988_md.gif"
onload="loadDice(${die.id?html}, ${die.face?html}" draggable="true" ondragstart="drag(event)"
id="11" width="100px" height="100px"> <img
src="https://etc.usf.edu/clipart/21900/21988/square_21988_md.gif"
onload="loadDice(${die.id?html}, ${die.face?html}" draggable="true" ondragstart="drag(event)"
id="12" width="100px" height="100px"> <img
src="https://etc.usf.edu/clipart/21900/21988/square_21988_md.gif"
onload="loadDice(${die.id?html}, ${die.face?html}" draggable="true" ondragstart="drag(event)"
id="13" width="100px" height="100px"> <img
src="https://etc.usf.edu/clipart/21900/21988/square_21988_md.gif"
onload="loadDice(${die.id?html}, ${die.face?html}" draggable="true" ondragstart="drag(event)"
id="14" width="100px" height="100px"> <img
src="https://etc.usf.edu/clipart/21900/21988/square_21988_md.gif"
onload="loadDice(${die.id?html}, ${die.face?html}" draggable="true" ondragstart="drag(event)"
id="15" width="100px" height="100px"> <img
src="https://etc.usf.edu/clipart/21900/21988/square_21988_md.gif"
onload="loadDice(${die.id?html}, ${die.face?html}" draggable="true" ondragstart="drag(event)"
id="16" width="100px" height="100px"> <img
src="https://etc.usf.edu/clipart/21900/21988/square_21988_md.gif"
onload="loadDice(${die.id?html}, ${die.face?html}" draggable="true" ondragstart="drag(event)"
id="17" width="100px" height="100px"> <img
src="https://etc.usf.edu/clipart/21900/21988/square_21988_md.gif"
onload="loadDice(${die.id?html}, ${die.face?html}" draggable="true" ondragstart="drag(event)"
id="18" width="100px" height="100px"> <img
src="https://etc.usf.edu/clipart/21900/21988/square_21988_md.gif"
onload="loadDice(${die.id?html}, ${die.face?html}" draggable="true" ondragstart="drag(event)"
id="19" width="100px" height="100px"> <img
src="https://etc.usf.edu/clipart/21900/21988/square_21988_md.gif"
onload="loadDice(${die.id?html}, ${die.face?html}" draggable="true" ondragstart="drag(event)"
id="20" width="100px" height="100px"> <img
src="https://etc.usf.edu/clipart/21900/21988/square_21988_md.gif"
onload="loadDice(${die.id?html}, ${die.face?html}" draggable="true" ondragstart="drag(event)"
id="21" width="100px" height="100px"> <img
src="https://etc.usf.edu/clipart/21900/21988/square_21988_md.gif"
onload="loadDice(${die.id?html}, ${die.face?html}" draggable="true" ondragstart="drag(event)"
id="22" width="100px" height="100px"> <img
src="https://etc.usf.edu/clipart/21900/21988/square_21988_md.gif"
onload="loadDice(${die.id?html}, ${die.face?html}" draggable="true" ondragstart="drag(event)"
id="23" width="100px" height="100px"> <img
src="https://etc.usf.edu/clipart/21900/21988/square_21988_md.gif"
onload="loadDice(${die.id?html}, ${die.face?html}" draggable="true" ondragstart="drag(event)"
id="24" width="100px" height="100px">
</div>
<!-- Makes the places of the board -->
<div id="forbidden" ondrop="drop(event)" ondragover="allowDrop(event)"></div>
<div id="permitted" ondrop="drop(event)" ondragover="allowDrop(event)"></div>
<div id="required" ondrop="drop(event)" ondragover="allowDrop(event)"></div>
<div id="proposedSolution" ondrop="drop(event)"
ondragover="allowDrop(event)"></div>
<div id="solution" ondrop="drop(event)" ondragover="allowDrop(event)"></div>
</div>
</body>
</html>