forked from gabrielefilipp/SmartHunter
-
Notifications
You must be signed in to change notification settings - Fork 2
/
Copy pathPAGE.html
338 lines (304 loc) · 12.6 KB
/
PAGE.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
<!DOCTYPE html>
<html>
<head>
<meta charset="UTF-8">
<meta name="viewport" content="width=device-width,initial-scale=1,maximum-scale=1,user-scalable=no">
<meta http-equiv="X-UA-Compatible" content="IE=edge,chrome=1">
<meta name="HandheldFriendly" content="true">
<style>
* {
box-sizing: border-box;
}
body {
font-family: Arial;
padding: 10px;
background: #f1f1f1;
}
/* Header/Blog Title */
.header {
padding: 30px;
text-align: center;
background: white;
}
.header h1 {
font-size: 50px;
}
a {
color: rgb(83, 83, 83);
}
/* Style the top navigation bar */
.topnav {
overflow: hidden;
background-color: #333;
}
/* Style the topnav links */
.topnav a {
float: left;
display: block;
color: #f2f2f2;
text-align: center;
padding: 14px 16px;
text-decoration: none;
}
/* Change color on hover */
.topnav a:hover {
background-color: #ddd;
color: black;
}
/* Create two unequal columns that floats next to each other */
/* Left column */
.leftcolumn {
float: left;
width: 75%;
}
/* Right column */
.rightcolumn {
float: left;
width: 25%;
background-color: #f1f1f1;
padding-left: 20px;
}
/* Fake image */
.fakeimg {
border-radius: 6px;
background-color: #eee;
width: 100%;
padding: 20px;
}
/* Add a card effect for articles */
.card {
background-color: white;
padding: 20px;
margin-top: 20px;
}
/* Clear floats after the columns */
.row:after {
content: "";
display: table;
clear: both;
}
/* Footer */
.footer {
padding: 20px;
text-align: center;
background: #ddd;
margin-top: 20px;
}
.collapsible {
margin-top: 10px;
background-color: #eee;
cursor: pointer;
padding: 10px;
width: 100%;
border: none;
text-align: left;
outline: none;
font-size: 15px;
}
.active, .collapsible:hover {
background-color: #e1e1e1;
}
.content {
padding: 0 18px;
display: none;
overflow: hidden;
background-color: #f1f1f1;
}
.MonsterHealthBar {
width: 100%;
background-color: #ddd;
border-radius: 6px;
}
.MonsterHealthBarField {
width: 1%;
height: 10px;
background-color: #4CAF50;
border-radius: 6px;
}
/* Responsive layout - when the screen is less than 1060px wide, make the two columns stack on top of each other instead of next to each other */
@media screen and (max-width: 1060px) {
.leftcolumn, .rightcolumn {
width: 100%;
padding: 0;
}
}
/* Responsive layout - when the screen is less than 768px wide, make the navigation links stack on top of each other instead of next to each other */
@media screen and (max-width: 768px) {
.topnav a {
float: none;
width: 100%;
}
}
</style>
</head>
<body>
<div class="header" id="header">
<h1>Http Smart Hunter</h1>
<p>Dynamic web end for monster data display based on <a href="https://github.com/gabrielefilipp/SmartHunter">SmartHunter</a></p>
</div>
<div class="topnav">
<a href="#Monster1">Monster 1</a>
<a href="#Monster2">Monster 2</a>
<a href="#Monster3">Monster 3</a>
<a onclick="darkMode()">Dark Mode</a>
<a href="#Player" style="float:right">Player</a>
</div>
<div class="row">
<div class="leftcolumn">
<div class="card" id="Monster1">
<h2 class="MonsterNameData">Monster Name Here</h2>
<h5 class="MonsterSizeData">Monster Size Data</h5>
<div class="fakeimg" style="height:80px;">
<div style="text-align: center;padding-bottom: 10px;" class="MonsterHealthLevel">Health Percentage</div>
<div class="MonsterHealthBar"><div class="MonsterHealthBarField" style="width:30%"></div></div>
</div>
<button type="button" class="collapsible">Part and Status Data (Click)</button>
<div class="content">
<p class="MonsterStatusData">Monster Data Here</p>
</div>
</div>
<div class="card" id="Monster2">
<h2 class="MonsterNameData">Monster Name Here</h2>
<h5 class="MonsterSizeData">Monster Size Data</h5>
<div class="fakeimg" style="height:80px;">
<div style="text-align: center;padding-bottom: 10px;" class="MonsterHealthLevel">Health Percentage</div>
<div class="MonsterHealthBar"><div class="MonsterHealthBarField" style="width:30%"></div></div>
</div>
<button type="button" class="collapsible">Part and Status Data (Click)</button>
<div class="content">
<p class="MonsterStatusData">Monster Data Here</p>
</div>
</div>
<div class="card" id="Monster3">
<h2 class="MonsterNameData">Monster Name Here</h2>
<h5 class="MonsterSizeData">Monster Size Data</h5>
<div class="fakeimg" style="height:80px;">
<div style="text-align: center;padding-bottom: 10px;" class="MonsterHealthLevel">Health Percentage</div>
<div class="MonsterHealthBar"><div class="MonsterHealthBarField" style="width:30%"></div></div>
</div>
<button type="button" class="collapsible">Part and Status Data (Click)</button>
<div class="content">
<p class="MonsterStatusData">Monster Data Here</p>
</div>
</div>
</div>
<div class="rightcolumn">
<div class="card" id="Player">
<h2>Player Data</h2>
<h5>Player Buff and Damage Data</h5>
<div class="fakeimg" style="margin-bottom:10px;">
<button type="button" class="collapsible">Player Status Data</button>
<div class="content">
<p id="PlayerData1">Data Goes Here</p>
</div>
</div>
<div class="fakeimg">
<button type="button" class="collapsible">Player Damage Data</button>
<div class="content">
<p id="PlayerData2">Player Damage Data here</p>
</div>
</div>
</div>
<div class="card">
<h3>Info</h3>
<div class="fakeimg" style="margin-bottom:10px; padding-top:1px">
<p>Monster that was tracked was registered</p>
</div>
<div class="fakeimg" style="margin-bottom:10px; padding-top:1px">
<p>Damages are not available unless specifically turned on in WebServer.cs</p>
</div>
<div class="fakeimg" style="margin-bottom:0px; padding-top:1px">
<p>You need firewall and to change settings in WebServer.cs to share to local network</p>
</div>
</div>
</div>
</div>
<div class="footer">
<h2><a href="#header" style="text-decoration: none;">Back to Top</a></h2>
</div>
</body>
<script>
function darkMode(){
var textColor = "gray"
if(document.querySelectorAll('h1')[0].style.color == "gray"){
textColor = "black"
console.log("turn to white")
document.body.style.backgroundColor="white";
document.querySelectorAll(".card").forEach(e => e.style.backgroundColor = "white");
document.querySelectorAll(".collapsible").forEach(e => e.style.backgroundColor = "#eeeeee");
document.querySelectorAll(".fakeimg").forEach(e => e.style.backgroundColor = "#eeeeee");
document.querySelectorAll(".content").forEach(e => e.style.backgroundColor = "#f1f1f1");
document.querySelectorAll(".header").forEach(e => e.style.backgroundColor = "#dddddd");
document.querySelectorAll(".row").forEach(e => e.style.backgroundColor = "#dddddd");
document.querySelectorAll(".rightcolumn").forEach(e => e.style.backgroundColor = "#dddddd");
document.querySelectorAll(".footer").forEach(e => e.style.backgroundColor = "#dddddd");
}
else{
textColor = "gray"
console.log("turn to black")
document.body.style.backgroundColor="black";
document.querySelectorAll(".card").forEach(e => e.style.backgroundColor = "#303030");
document.querySelectorAll(".collapsible").forEach(e => e.style.backgroundColor = "#202020");
document.querySelectorAll(".fakeimg").forEach(e => e.style.backgroundColor = "#202020");
document.querySelectorAll(".content").forEach(e => e.style.backgroundColor = "#101010");
document.querySelectorAll(".header").forEach(e => e.style.backgroundColor = "#202020");
document.querySelectorAll(".row").forEach(e => e.style.backgroundColor = "#202020");
document.querySelectorAll(".rightcolumn").forEach(e => e.style.backgroundColor = "#202020");
document.querySelectorAll(".footer").forEach(e => e.style.backgroundColor = "#202020");
}
document.querySelectorAll('h1').forEach(e => e.style.color = textColor);
document.querySelectorAll('h2').forEach(e => e.style.color = textColor);
document.querySelectorAll('h3').forEach(e => e.style.color = textColor);
document.querySelectorAll('h4').forEach(e => e.style.color = textColor);
document.querySelectorAll('h5').forEach(e => e.style.color = textColor);
document.querySelectorAll('div').forEach(e => e.style.color = textColor);
document.querySelectorAll('button').forEach(e => e.style.color = textColor);
document.querySelectorAll('p').forEach(e => e.style.color = textColor);
}
var coll = document.getElementsByClassName("collapsible");
var i;
for (i = 0; i < coll.length; i++) {
coll[i].addEventListener("click", function() {
this.classList.toggle("active");
var content = this.nextElementSibling;
if (content.style.display === "block") {
content.style.display = "none";
} else {
content.style.display = "block";
}
});
}
var update = setInterval(updateData, 1000);
var xhttp = new XMLHttpRequest();
function updateData() {
fetch("/MonsterDataPack",{method:'POST'})
.then(res => res.text())
.then(monsterJson => {
var monsterData = JSON.parse(monsterJson);
document.getElementById("PlayerData1").innerHTML = monsterData.playerBuffs;
document.getElementById("PlayerData2").innerHTML = monsterData.playerDamage;
var monsterNameField = document.getElementsByClassName("MonsterNameData");
var monsterSizeField = document.getElementsByClassName("MonsterSizeData");
var monsterHealthField = document.getElementsByClassName("MonsterHealthLevel");
var monsterHealthBar = document.getElementsByClassName("MonsterHealthBarField");
var monsterStatusField = document.getElementsByClassName("MonsterStatusData");
for (i = 0; i < monsterNameField.length; i++) {
monsterNameField[i].innerHTML = monsterData.monsters[i].monsterName;
}
for (i = 0; i < monsterSizeField.length; i++) {
monsterSizeField[i].innerHTML = monsterData.monsters[i].monsterSize;
}
for (i = 0; i < monsterHealthField.length; i++) {
monsterHealthField[i].innerHTML = monsterData.monsters[i].monsterCurrentHealth + "/" + monsterData.monsters[i].monsterMaxHealth;
}
for (i = 0; i < monsterHealthBar.length; i++) {
monsterHealthBar[i].style.width = (monsterData.monsters[i].monsterCurrentHealth * 100 / monsterData.monsters[i].monsterMaxHealth) + "%";
}
for (i = 0; i < monsterStatusField.length; i++) {
monsterStatusField[i].innerHTML = monsterData.monsters[i].monsterStatus;
}
})
.catch(error => {});;
}
</script>
</html>