/
scoreboard_gui.html
433 lines (373 loc) · 18.1 KB
/
scoreboard_gui.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
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
<html>
<head>
<!--
A scoreboard for a martial arts fight. This is the control side from
referee table.
Copyright (C) 2023 Daniel Moritz
This program is free software: you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
the Free Software Foundation, according to version 3 of the License.
This program is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU General Public License for more details.
You should have received a copy of the GNU General Public License
along with this program. If not, see <https://www.gnu.org/licenses/>.
-->
<meta charset="utf-8">
<link rel="stylesheet" href="themes/blue/theme.css">
<link rel="stylesheet" href="themes/blue/scoreboard_gui.css">
<link rel="stylesheet" href="themes/blue/settings.css">
<link rel="stylesheet" href="themes/blue/history.css">
<link rel="stylesheet" href="themes/blue/groups.css">
<link rel="stylesheet" href="themes/blue/persons.css">
<script src="node_modules/durata/dist/durata.min.js"></script>
<script src="node_modules/peerjs/dist/peerjs.min.js"></script>
<script src="node_modules/direzione-lib/dist/direzione-lib.min.js"></script>
<script src="js/AppSettings.js"></script>
<script src="js/Controllers.js"></script>
<script src="js/ViewTranslator.js"></script>
<script src="js/ThemeManager.js"></script>
<script src="sounds/file_list.js"></script>
</head>
<body>
<div id="scoreboardLayout">
<img class="absolute reset" src="node_modules/lucide-static/icons/timer-reset.svg" alt="reset" />
<img class="absolute finish" src="node_modules/lucide-static/icons/square-check-big.svg" alt="finish" />
<img class="absolute toketa" src="node_modules/lucide-static/icons/arrow-up.svg" alt="toketa" />
<img class="absolute osaekomi-left" src="node_modules/lucide-static/icons/arrow-down-left.svg" alt="osaekomi-left" />
<img class="absolute osaekomi-right" src="node_modules/lucide-static/icons/arrow-down-right.svg" alt="osaekomi-right" />
<div id="countdown">
<span> </span>
<span class="display">-:--</span>
<span class="startStop">
<img class="start" src="node_modules/lucide-static/icons/circle-play.svg" alt="start" />
<img class="stop" src="node_modules/lucide-static/icons/circle-pause.svg" alt="stop" />
</span>
</div>
<div id="countUp" class="center"><span id="countUpSec">0</span>.<span id="countUpMSec">000</span></div>
<div class="rowWrapper">
<div class="name center white opponent"><span id="whiteOpponent" class="middle"> </span></div>
<div class="name center red opponent"><span id="redOpponent" class="middle"> </span></div>
</div>
<div class="rowWrapper scores">
<div class="score scoreControlWrapper white">
<span class="triangle up"></span>
<div id="whiteScore">0</div>
<span class="triangle down"></span>
</div>
<div class="shidoControlWrapper white">
<div class="triangle up"></div>
<div class="shidoBox">
<span class="shidoLabel">Shido</span>
<span id="whiteShido" class="shido">0</span>
</div>
<div class="triangle down"></div>
</div>
<div class="white opponent placeholder"> </div>
<div class="red opponent placeholder"> </div>
<div class="shidoControlWrapper red">
<div class="triangle up"></div>
<div class="shidoBox">
<span class="shidoLabel">Shido</span>
<span id="redShido" class="shido">0</span>
</div>
<div class="triangle down"></div>
</div>
<div class="score scoreControlWrapper red">
<span class="triangle up"></span>
<div id="redScore">0</div>
<span class="triangle down"></span>
</div>
</div>
<div class="rowWrapper">
<div class="club center white opponent"><span id="whiteClub" class="middle"> </span></div>
<div class="club center red opponent"><span id="redClub" class="middle"> </span></div>
</div>
</div>
<div id="control">
<div id="remoteIndicator" class="off">
<span class="onLabel">remote board connected</span>
<span class="offLabel">remote board disconnected</span>
</div>
<h2 id="tournamentHeadline"></h2>
<div id="fightlist">
<ul id="repertoire">
<li id="entryJig">
<img class="history" src="node_modules/lucide-static/icons/file-clock.svg" alt="history" />
<span class="white"></span><span class="white lockOut">-:--</span> -
<span class="red"></span><span class="red lockOut">-:--</span>
</li>
</ul>
</div>
<div id="menue">
<img class="settings" src="node_modules/lucide-static/icons/settings.svg" alt="settings" />
<img class="opponents" src="node_modules/lucide-static/icons/users.svg" alt="opponents" />
</div>
</div>
<div id="history" style="display:none">
<img class="close" src="node_modules/lucide-static/icons/x.svg" alt="close" />
<h2 id="protocol">Protocol</h2>
<div id="logWrapper">
<table id="log">
<tr><th class="first">Entry time</th><th class="second">Type</th><th class="third">Info</th></tr>
</table>
</div>
</div>
<div id="settings" style="display:none">
<img class="close" src="node_modules/lucide-static/icons/x.svg" alt="close" />
<h1>Settings</h1>
<h3 id="h_general">General</h3>
<form>
<label for="connID">Connection ID: </label>
<input id="connID" type="text" />
<label for="lockOut">Lock-out for opponents (ms): </label>
<input id="lockOut" type="text" />
<div>
<label for="theme">Theme: </label>
<select id="theme">
<option value="blue">blue</option>
<option value="green">green</option>
</select>
<label for="lang">Language: </label>
<select id="lang">
<option value="de-DE">deutsch (DE)</option>
<option value="en-GB">english (GB)</option>
</select>
</div>
</form>
<h3 class="scoreboard">Scoreboard</h3>
<form>
<div>
<input id="invertGripSide" type="checkbox" />
<label for="invertGripSide">Invert side evaluation for count up</label>
</div>
<div>
<input id="invertGripDisplay" type="checkbox" />
<label for="invertGripDisplay">Invert side display for count up</label>
</div>
<div>
<label for="duration">Duration (ms): </label>
<input id="duration" type="text" />
</div>
<div>
<label for="countUpLimit">Count UP Limit Wazari (ms): </label>
<input id="countUpLimit" type="text" />
</div>
<div>
<label for="countUpLimitIppon">Count UP Limit Ippon (ms): </label>
<input id="countUpLimitIppon" type="text" />
</div>
<!-- Avoids form submit for pressing the enter-key -->
<input type="submit" disabled style="display: none" aria-hidden="true" />
<div>
<label for="fightEndSound">Signal to play on fight end: </label>
<select id="fightEndSound">
</select>
<button id="fightEndSoundTest">test</button>
</div>
</form>
</div>
<div id="groups" style="display:none">
<img class="close" src="node_modules/lucide-static/icons/x.svg" alt="close" />
<h1>Groups</h1>
<form>
<div>
<label for="groupName">Group name: </label>
<input id="groupName" type="text" />
<button id="addGroup">add</button>
</div>
<div id="tournamentInputs">
<label for="tournamentName">Tournament name: </label>
<input id="tournamentName" type="text" />
<button id="buildTournament">build</button>
</div>
</form>
<div id="groupWrapper">
</div>
<h2>Tournaments</h2>
<div id="tournamentWrapper">
<ul id="tournamentList">
<li id="tournamentEntryJig">
<span class="label"></span>
<img class="tournament remove" src="node_modules/lucide-static/icons/circle-minus.svg" alt="remove tournament" />
</li>
</ul>
</div>
<table id="groupJig" class="group">
<caption>Group name</caption>
<thead>
<tr>
<th class="hfn">First name</th>
<th class="hln">Last name</th>
<th class="hcn">Club</th>
<th>
<img class="group remove" src="node_modules/lucide-static/icons/package-minus.svg" alt="remove group" />
</th>
</tr>
</thead>
<tbody>
<tr id="personJig">
<td class="fname"></td>
<td class="lname"></td>
<td class="clubname"></td>
<td class="ctrls">
<img class="opponents remove" src="node_modules/lucide-static/icons/user-minus.svg" alt="remove user" />
</td>
</tr>
</tbody>
<tfoot>
<tr><td colspan="4">
<img class="opponents add" src="node_modules/lucide-static/icons/user-plus.svg" alt="add user" />
</td></tr>
</tfoot>
</table>
</div>
<div id="persons" style="display:none">
<img class="close" src="node_modules/lucide-static/icons/x.svg" alt="close" />
<h1>Person</h1>
<form>
<div>
<label for="firstName">First name: </label>
<input id="firstName" type="text" />
</div>
<div>
<label for="lastName">Last name: </label>
<input id="lastName" type="text" />
</div>
<div>
<label for="clubName">Club: </label>
<input id="clubName" type="text" />
</div>
<button id="addPerson">add</button>
</form>
</div>
</body>
<script>
var viewConfig
var translationConfig = {
"settings": {
"headline": "#settings h1",
"general": "#h_general",
"scoreboard": "#settings .scoreboard",
"connection-id": "#settings label[for='connID']",
"theme": {
"label": "#settings label[for='theme']",
"blue": "#theme [value='blue']",
"green": "#theme [value='green']"
},
"language": {
"label": "#settings label[for='lang']"
},
"lock-out": "#settings label[for='lockOut']",
"time-up-sound": "#settings label[for='fightEndSound']"
},
"scoreboard": {
"connected": "#remoteIndicator .onLabel",
"disconnected": "#remoteIndicator .offLabel",
"duration": "#settings label[for=duration]",
"countup-limit": "#settings label[for=countUpLimit]",
"countup-limit-ippon": "#settings label[for=countUpLimitIppon]",
"invert-grip-side": "#settings label[for=invertGripSide]",
"invert-grip-display": "#settings label[for=invertGripDisplay]"
},
"history": {
"headline": "#history #protocol",
"entryTime": "#history #log .first",
"entryType": "#history #log .second",
"entryInfo": "#history #log .third"
},
"person": {
"headline": "#persons h1",
"firstName": "#persons label[for=firstName]",
"lastName": "#persons label[for=lastName]",
"club": "#persons label[for=clubName]",
"addButton": "#persons #addPerson"
},
"groups": {
"headline": "#groups h1",
"subline": "#groups h2",
"groupName": "#groups label[for=groupName]",
"addButton": "#groups #addGroup",
"tournamentName": "#groups label[for=tournamentName]",
"buildButton": "#groups #buildTournament"
}
}
var appSettings = Direzione.AppSettings.create()
var fightSettings = Direzione.FightSettings.create()
!fightSettings.getTimeUpSoundFile() && fightSettings.setTimeUpSoundFile('sounds/fight_end.ogg')
var translator = Direzione.ViewTranslator.create(appSettings.getLanguage(), translationConfig)
var historyController = Direzione.HistoryController.create(appSettings)
var tournament = Direzione.Tournament.create(fightSettings)
viewConfig = {
entryJigElem: document.getElementById('entryJig'),
entryWrapperElem: document.getElementById('repertoire'),
selectorWhiteOpponentLockOut: '.white.lockOut',
selectorRedOpponentLockOut: '.red.lockOut'
}
var repertoire = Direzione.Repertoire.create(tournament, viewConfig)
Direzione.ThemeManager.changeThemeCSSForControlBoard(appSettings.getThemeID())
viewConfig = {
inputElemCommunicationID: document.getElementById('connID'),
inputElemTheme: document.getElementById('theme'),
inputElemLanguage: document.getElementById('lang'),
inputElemDuration: document.getElementById('duration'),
inputElemCountUpLimit: document.getElementById('countUpLimit'),
inputElemCountUpLimitIppon: document.getElementById('countUpLimitIppon'),
inputElemLockOut: document.getElementById('lockOut'),
inputElemInvertGripSide: document.getElementById('invertGripSide'),
inputElemInvertGripDisplay: document.getElementById('invertGripDisplay'),
selectElemFightEndSound: document.getElementById('fightEndSound'),
buttonElemFightEndSoundTest: document.getElementById('fightEndSoundTest')
}
Direzione.SettingsController.create(appSettings, fightSettings, viewConfig, translator)
viewConfig = {
groupWrapperElem: document.getElementById('groupWrapper'),
groupJigElem: document.getElementById('groupJig'),
personJigElem: document.getElementById('personJig'),
tournamentWrapperElem: document.getElementById('tournamentList'),
tournamentHeadlineElem: document.getElementById('tournamentHeadline'),
tournamentEntryJigElem: document.getElementById('tournamentEntryJig'),
inputElemGroupName: document.getElementById('groupName'),
buttonElemAddGroupName: document.getElementById('addGroup'),
inputElemPersonFirstName: document.getElementById('firstName'),
inputElemPersonLastName: document.getElementById('lastName'),
inputElemPersonClubName: document.getElementById('clubName'),
buttonElemAddPerson: document.getElementById('addPerson'),
buttonElemBuildTournament: document.getElementById('buildTournament'),
inputElemTournamentName: document.getElementById('tournamentName')
}
Direzione.OpponentsController.create(tournament, repertoire, viewConfig, translator)
viewConfig = {
outputElemCountdown: document.querySelector('#countdown span.display'),
outputElemStopwatchSeconds: document.getElementById('countUpSec'),
outputElemStopwatchMilliseconds: document.getElementById('countUpMSec'),
outputElemRedScore: document.getElementById('redScore'),
outputElemWhiteScore: document.getElementById('whiteScore'),
outputElemRedShido: document.getElementById('redShido'),
outputElemWhiteShido: document.getElementById('whiteShido'),
outputElemRedOpponent: document.getElementById('redOpponent'),
outputElemWhiteOpponent: document.getElementById('whiteOpponent'),
outputElemRedClub: document.getElementById('redClub'),
outputElemWhiteClub: document.getElementById('whiteClub')
};
var fight = Direzione.Fight.create(
fightSettings,
Direzione.Opponent.create(Direzione.Person.create('', '', '')),
Direzione.Opponent.create(Direzione.Person.create('', '', ''))
)
var board = Direzione.Scoreboard.create(fight, viewConfig)
var fightEmitter = Direzione.FightEmitterLocal.create(appSettings.getCommunicationID(), fight)
var fightController = Direzione.FightController.create(fightEmitter, translator)
Direzione.ControlPanelController
.create(fightEmitter, translator)
.on('fightChange', function (cfight) {
fight = cfight
board.replaceFight(cfight)
fightEmitter.replaceFight(cfight)
})
.on('fightHistoryTrigger', function (fight) {
historyController.setFight(fight).show()
})
</script>
</html>