-
Notifications
You must be signed in to change notification settings - Fork 34
/
battleplayer.html
333 lines (287 loc) · 10.7 KB
/
battleplayer.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
<!DOCTYPE HTML>
<html>
<head>
<title>KanColle Battle Replayer</title>
<!--meta-->
<meta content="text/html; charset=utf-8" http-equiv="Content-Type">
<!---->
<script src="js/kcSHIPDATA.js"></script>
<script src="js/kcEQDATA.js"></script>
<script src="js/kcEDGES.js"></script>
<script src="js/kcMAPDATA.js"></script>
<script src="js/shared.js"></script>
<script src="js/pixi.min.js"></script>
<script src="js/howler.min.js"></script>
<script src="js/URI.js"></script>
<script type="text/javascript" src="reader/steganography.js"></script>
<script type="text/javascript" src="reader/lz-string.js"></script>
<script src="js/battleText/playertext-table.js"></script>
<script src="https://cdn.jsdelivr.net/npm/lzma/src/lzma_worker.min.js"></script>
<script type="text/javascript">
function loadImage(file) {
var preview = document.getElementById('imgpreview');
var reader = new FileReader();
$('#error').text('Loading');
preview.onload = function () {
//console.log(reader.result);
try {
var msg = steganography.decode(reader.result);
document.getElementById('code').value = msg;
console.log(msg.length);
} catch (e) {
$('#error').text('Error, data may be corrupted');
return;
}
loadCode();
//$('#error').text('');
};
reader.onloadend = function (e) {
preview.src = reader.result;
}
if (file) {
reader.readAsDataURL(file);
} else {
preview.src = "";
}
}
function loadImgURL(url) {
if (url.indexOf('cors.piro.moe') == -1) url = 'https://cors.piro.moe/' + url;
var preview = document.getElementById('imgpreview');
var xhr = new XMLHttpRequest();
xhr.responseType = 'blob';
$('#error').text('Waiting for response...');
xhr.onload = function () {
loadImage(xhr.response);
}
xhr.onerror = function (e) {
$('#error').text('Invalid URL');
console.log(e);
}
xhr.open('GET', url);
xhr.send();
}
</script>
<style>
.infotable {
border-collapse: collapse;
font-size: 14px;
}
.infotable td {
border: 1px solid black;
padding: 0px;
width: 50px;
height: 10px;
}
.infotable img {
vertical-align: middle;
}
</style>
<!--Bootstrap CDN-->
<link rel="stylesheet" href="css/bootstrap.min.css" integrity="sha384-rwoIResjU2yc3z8GV/NPeZWAv56rSmLldC3R/AZzGRnGxQQKnKkoFVhFQhNUwEyJ"
crossorigin="anonymous">
<script src="https://code.jquery.com/jquery-3.1.1.slim.min.js" integrity="sha384-A7FZj7v+d/sdmMqp/nOQwliLvUsJfDHW+k9Omg/a/EheAdgtzNs3hpfag6Ed950n"
crossorigin="anonymous"></script>
<script src="https://cdnjs.cloudflare.com/ajax/libs/tether/1.4.0/js/tether.min.js" integrity="sha384-DztdAPBWPRXSA/3eYEEUWrWCy7G5KFbe8fFjk5JAIxUYHKkDx6Qin1DkWx51bBrb"
crossorigin="anonymous"></script>
<script src="js/bootstrap.min.js" integrity="sha384-vBWWzlZJ8ea9aCX4pEW3rVHjgjt7zpkNpZk+02D9phzyeVkE+jo0ieGizqPLForn"
crossorigin="anonymous"></script>
<!--Material Design Lite-->
<link rel="stylesheet" href="https://code.getmdl.io/1.3.0/material.blue-red.min.css" />
<link rel="stylesheet" href="https://fonts.googleapis.com/icon?family=Material+Icons">
<script defer src="https://code.getmdl.io/1.3.0/material.min.js"></script>
<!--Custom-->
<link rel="stylesheet" href="./css/battleplayer.css" />
</head>
<body>
<div id="bp-container" class="d-flex flex-column">
<!--Title-->
<div class="d-flex flex-row align-items-center justify-content-center">
<div id="bp-title" class="p-1">
KanColle Battle Replayer
</div>
<div id="bp-title-ver" class="p-1">
v1.6.7
</div>
<div id="bp-title-upd" class="p-1">
(Last update: 2023-04-27)
</div>
</div>
<!--Main Component-->
<div class="d-flex flex-row justify-content-center align-items-start">
<!--Left-->
<div id="bp-comp-left" class="d-flex flex-column align-items-center">
<!--Part 1-->
<div class="d-flex flex-row">
<div>
<!--Pause/Reset-->
<div class="d-flex flex-row justify-content-center align-items-center">
<button id="btnPause" class="mdl-button mdl-js-button mdl-button--raised mdl-button--colored mdl-js-ripple-effect">Pause</button>
<button id="btnReset" class="mdl-button mdl-js-button mdl-button--raised mdl-button--colored mdl-js-ripple-effect">Reset</button>
</div>
<!--Speed-->
<div class="d-flex flex-row justify-content-between align-items-center" style="height: 36px">
<input id="rangeSpeed" class="mdl-slider mdl-js-slider" data-toggle="tooltip" data-placement="bottom" title="Speed" type="range" data-animation="false"
min="0" max="80" value="40">
<span id="speednum" style="width:50px;margin-left:-20px">x1</span>
</div>
</div>
<div>
<!--Sound/Voice-->
<div id="bp-sound-1" class="d-flex flex-column justify-content-center">
<div style="margin-bottom:10px">
<label for="switchSound" class="mdl-switch mdl-js-switch mdl-js-ripple-effect">
<input type="checkbox" id="switchSound" class="mdl-switch__input" checked>
<span class="mdl-switch__label">Sound</span>
</label>
</div>
<div>
<label for="chkvoice" class="mdl-switch mdl-js-switch mdl-js-ripple-effect">
<input type="checkbox" id="chkvoice" class="mdl-switch__input" checked>
<span class="mdl-switch__label">Voice</span>
</label>
</div>
</div>
<!--Volume-->
<div id="bp-sound-2" class="d-flex flex-row justify-content-between align-items-center" style="height: 36px">
<input id="rangeVolume" class="mdl-slider mdl-js-slider" data-toggle="tooltip" data-placement="bottom" title="Volume" type="range" data-animation="false"
min="0" max="100" value="60">
</div>
</div>
</div>
<!--Part 2-->
<div id="bp-com-left-2" class="d-flex flex-column" style="height: 60px;">
<div>
<div>
<span style="font-weight:bold">Upload image</span>
</div>
<div>
<input id="upload-image" type="file" onchange="loadImage(this.files[0])">
</div>
<hr>
<div>
<span style="font-weight:bold">Load from URL</span>
</div>
<div>
<input id="textimgurl" type="text">
<input type="button" value="Load" onclick="loadImgURL($('#textimgurl').val())" />
</div>
<hr>
<div style="height:180px">
<img src="" id="imgpreview" height="180" alt="Image preview...">
</div>
</div>
<div>
<hr>
<div>
<span style="font-weight:bold">Load from text</span>
<textarea id="code" cols="38" rows="5"></textarea>
</div>
<div>
<input id="codeb" type="button" value="Load" onClick="loadCode()" />
<input type="button" value="Sample Code 1" onclick="$('#code').val(APIsample);" />
<input type="button" value="Sample Code 2" onclick="$('#code').val(APIsample2);" />
</div>
<div style="display:flex;width:300px">
<span id="error" style="color:red; font-size: 10px;"></span>
<input type="button" value="Create Shared Link (TinyURL)" style="margin-left:auto;margin-top:5px" onclick="onclickCreateSharedLink()"/>
</div>
</div>
</div>
</div>
<!--Right-->
<div id="bp-comp-right" class=" d-flex flex-column">
<!--Battle node-->
<div class="d-inline-flex flex-row align-items-center">
<div class="bp-label">
Skip to Battle
</div>
<div id="skipbuttonspace">
</div>
</div>
<!--Battle info-->
<div class="d-inline-flex flex-row justify-content-between align-items-center" style="height: 50px">
<!--Battle 1-->
<div class="d-flex flex-column">
<div class="d-flex flex-row">
<div class="bp-label bp-air-battle-text">
Air Battle
</div>
<div id="plAS1" class="bp-air-battle-value"></div>
</div>
<div class="bp-battle-bar">
<!--<canvas id="plHP1" width="240px" height="10px" style="border:1px solid black;border-radius:5px"></canvas>-->
<canvas id="plHP1"></canvas>
</div>
</div>
<!--Engagement-->
<div class="d-flex flex-column align-items-center">
<div class="bp-label bp-engagement">
Engagement
</div>
<div class="bt-engagement-value">
<span id="plEngage"></span>
<span id="plEngageT"></span>
</div>
</div>
<!--Battle 2-->
<div class="d-flex flex-column">
<div class="d-flex flex-row">
<div class="bp-label bp-air-battle-text">
Air Battle
</div>
<div id="plAS2" class="bp-air-battle-value"></div>
</div>
<div class="bp-battle-bar">
<!--<canvas id="plHP2" width="240px" height="10px" style="border:1px solid black;border-radius:5px"></canvas>-->
<canvas id="plHP2"></canvas>
</div>
</div>
</div>
<div id="warningwebgl" style="display:none;color:red">
Warning: WebGL is not enabled. Animation may not display correctly. (Try checking if your browser's "Use hardware acceleration when available" is enabled.)
</div>
<!--Player-->
<div class="d-inline-flex flex-column">
<div id="battlespace"></div>
<span id="bp-player-fps">FPS: <span id="FPS"></span></span>
</div>
</div>
</div>
<hr>
<!--Fleet-->
<div class="d-flex flex-column">
<div id="bp-fleet-comp" class="d-flex flex-row align-items-center">
<div>
<button id="btnFleet" class="mdl-button mdl-js-button mdl-button--raised mdl-button--colored mdl-js-ripple-effect">Show Fleet Details</button>
</div>
<div>
<label class="mdl-radio mdl-js-radio mdl-js-ripple-effect" for="radJP" onclick="translateTable('JP')">
<input type="radio" id="radJP" class="mdl-radio__button" name="lang" value="1"/>
<span class="mdl-radio__label">JP</span>
</label>
<label class="mdl-radio mdl-js-radio mdl-js-ripple-effect" for="radEN" onclick="translateTable('EN')">
<input type="radio" id="radEN" class="mdl-radio__button" name="lang" value="2" checked/>
<span class="mdl-radio__label">EN</span>
</label>
</div>
<div style="margin-left:100px">
<button id="btnBattle" class="mdl-button mdl-js-button mdl-button--raised mdl-button--colored mdl-js-ripple-effect" onclick="">Show Battle Log</button>
</div>
<div style="margin-left:100px">
<button id="btnImportSim" class="mdl-button mdl-js-button mdl-button--raised mdl-button--colored mdl-js-ripple-effect" onclick="">Import Into Simulator</button>
</div>
</div>
<div id="fleetinfospace">
<div id="friendfleetspace"></div>
<div id="lbasspace"></div>
<div id="enemyfleetspace"></div>
</div>
</div>
</div>
<script src="js/playersound.js"></script>
<script src="js/playersound2.js"></script>
<script src="js/player.js"></script>
<script src="js/battleplayer.js"></script>
<script src="js/battleplayer2.js"></script>
</body>
</html>