-
Notifications
You must be signed in to change notification settings - Fork 7
/
Copy pathindex.html
283 lines (269 loc) · 15.7 KB
/
index.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
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="utf-8">
<meta http-equiv="X-UA-Compatible" content="IE=edge">
<meta name="viewport" content="width=device-width, initial-scale=1">
<meta name="description" content="UEFA Champions League & UEFA Europa League round of 16 draw probabilities and simulation.">
<meta name="author" content="eminga">
<meta name="msapplication-TileColor" content="#2b5797">
<meta name="msapplication-config" content="icons/browserconfig.xml">
<meta name="theme-color" content="#ffffff">
<title>CL R16 Draw Probabilities</title>
<link rel="apple-touch-icon" sizes="180x180" href="icons/apple-touch-icon.png">
<link rel="icon" type="image/png" sizes="32x32" href="icons/favicon-32x32.png">
<link rel="icon" type="image/png" sizes="16x16" href="icons/favicon-16x16.png">
<link rel="manifest" href="icons/site.webmanifest">
<link rel="mask-icon" href="icons/safari-pinned-tab.svg" color="#2b5797">
<link rel="shortcut icon" href="icons/favicon.ico">
<link rel="stylesheet" href="bootstrap/bootstrap.min.css">
<link rel="stylesheet" href="ui.css">
</head>
<body>
<nav class="navbar navbar-expand-sm navbar-light bg-light">
<div class="container">
<button class="navbar-toggler" type="button" data-bs-toggle="collapse" data-bs-target="#navbar" aria-controls="navbar" aria-expanded="false">
<span class="navbar-toggler-icon"></span>
</button>
<a class="navbar-brand" role="button" onclick="initialize()">CL/EL Draw</a>
<div class="collapse navbar-collapse" id="navbar">
<ul class="navbar-nav mb-2 mb-sm-0" id="cldraw-competitions">
</ul>
<ul class="nav navbar-nav ms-auto mb-2 mb-sm-0">
<li class="nav-item dropdown">
<a class="nav-link dropdown-toggle" id="cldraw-seasons-button" data-bs-toggle="dropdown" role="button" aria-haspopup="true" aria-expanded="false">Season</a>
<ul class="dropdown-menu dropdown-menu-end" id="cldraw-seasons">
<li id="cldraw-seasons-separator"><hr class="dropdown-divider"></li>
<li><a class="dropdown-item" role="button" id="cldraw-add-season" onclick="createEditor(true)" data-bs-toggle="modal" data-bs-target="#cldraw-editor">Add season</a></li>
</ul>
</li>
</ul>
</div>
</div>
</nav>
<div class="container" role="main">
<div class="modal fade" id="cldraw-editor" tabindex="-1" role="dialog" aria-labelledby="modalLabel">
<div class="modal-dialog modal-lg" role="document">
<div class="modal-content">
<div class="modal-header">
<h5 class="modal-title" id="modalLabel">Team Editor</h5>
<button type="button" class="btn-close" data-bs-dismiss="modal" aria-label="Close"></button>
</div>
<div class="modal-body">
<div class="row row-cols-2">
<div class="col">
<label class="form-label">Winners:</label>
</div>
<div class="col">
<label class="form-label">Runners-up:</label>
</div>
</div>
<form id="cldraw-editor-groups" class="form-horizontal">
<div class="form-group" style="margin-bottom: 5px">
<div class="row row-cols-2">
<div class="col">
<div class="input-group">
<span class="input-group-text cldraw-winner-label w-25">Group</span>
<input type="text" placeholder="Team" aria-label="Team" class="form-control cldraw-winner w-50">
<input type="text" placeholder="Country" aria-label="Country" class="form-control cldraw-winner-country w-25">
</div>
</div>
<div class="col">
<div class="input-group">
<span class="input-group-text cldraw-runner-up-label w-25">Group</span>
<input type="text" placeholder="Team" aria-label="Team" class="form-control cldraw-runner-up w-50">
<input type="text" placeholder="Country" aria-label="Country" class="form-control cldraw-runner-up-country w-25">
</div>
</div>
</div>
</div>
</form>
<form class="form-horizontal" style="margin-top: 30px">
<div class="form-group">
<div class="col-2">
<label class="form-label" for="cldraw-editor-season">Season:</label>
</div>
<div class="col-3">
<input class="form-control" id="cldraw-editor-season" size="10" placeholder="20xx/xx">
</div>
</div>
</form>
</div>
<div class="modal-footer">
<button type="button" class="btn btn-light" data-bs-dismiss="modal">Cancel</button>
<button type="button" class="btn btn-primary" data-bs-dismiss="modal" onclick="saveTeams()">Save</button>
</div>
</div>
</div>
</div>
<div class="pb-2 mt-4 mb-2 border-bottom">
<h1>CL Draw Probabilities <small class="text-muted">(Round of 16)</small></h1>
</div>
<div class="card mb-3" id="cldraw-browser" style="display: none">
<div class="card-header bg-danger">
Browser not supported
</div>
<div class="card-body">
Your web browser is not supported, sorry! :(<br>
Please visit this site with a modern browser like Firefox, Chrome, Safari, or Edge.
</div>
</div>
<noscript>
<div class="card mb-3">
<div class="card-header bg-danger">
JavaScript required
</div>
<div class="card-body">
To use this tool, please enable JavaScript.
</div>
</div>
</noscript>
<div class="card mb-3" id="cldraw-computation" style="display: none">
<div class="card-header bg-warning">
Please select an option
</div>
<div class="list-group">
<button class="list-group-item list-group-item-action" id="cldraw-computation-download" onclick="downloadProbabilities()"><strong>Download precomputed probabilities</strong> <span id="cldraw-dlsize">(ca. 5 MB)</span> <span id="cldraw-dlbadge" class="badge bg-secondary">recommended</span></button>
<button class="list-group-item list-group-item-action" onclick="reset(true)"><strong>Compute probabilities locally</strong> (Does not work on devices with less than 2GB of RAM (8GB recommended) and can take a long time.)</button>
</div>
</div>
<div class="card mb-3" id="cldraw-dlprogress" style="display: none">
<div class="card-header bg-info">
Downloading probabilities...
</div>
<div class="card-body">
<div class="progress">
<div class="progress-bar progress-bar-striped active" id="cldraw-dlprogressbar" role="progressbar" aria-valuenow="0" aria-valuemin="0" aria-valuemax="100" style="width: 100%; transition: 0.2s;">
</div>
</div>
<span id="cldraw-dlprogress-text" style="display: none"></span>
<button type="button" class="btn btn-light mt-2 float-end" onclick="initialize(selectedSeason[0], selectedSeason[1])">
Cancel
</button>
</div>
</div>
<div class="alert alert-info" id="cldraw-computation-running" role="alert" style="display: none">
The probabilities are being computed. Please wait...
</div>
<div class="alert alert-danger" id="cldraw-impossible" role="alert" style="display: none">
<strong>Error!</strong> It is not possible to match the teams without violating a restriction.
</div>
<div class="row">
<div class="col-lg-3" id="cldraw-fixtures-card">
<div class="card card-primary text-center mb-3">
<div class="card-header text-white bg-primary">
Fixtures
</div>
<div class="card-body bg-light text-nowrap px-0">
<div class="row row-cols-1 row-cols-sm-2 row-cols-lg-1" id="cldraw-fixtures-row">
<div class="col order-sm-1 order-lg-1 cldraw-fixtures">
</div>
<div class="col order-sm-3 order-lg-2 cldraw-fixtures">
</div>
<div class="col order-sm-2 order-lg-3 cldraw-fixtures">
</div>
<div class="col order-sm-4 order-lg-4 cldraw-fixtures">
</div>
</div>
</div>
</div>
</div>
<div class="col-lg-9 order-lg-first table-responsive">
<table class="table" id="cldraw-table">
<thead>
<tr>
<th>
<div class="btn-group btn-group-sm" role="group">
<button type="button" class="btn btn-dark" id="button-shrink" onclick="resizeTable(false)">
<svg xmlns="http://www.w3.org/2000/svg" width="16" height="16" fill="currentColor" class="bi bi-zoom-out" viewBox="0 0 16 16">
<path fill-rule="evenodd" d="M6.5 12a5.5 5.5 0 1 0 0-11 5.5 5.5 0 0 0 0 11zM13 6.5a6.5 6.5 0 1 1-13 0 6.5 6.5 0 0 1 13 0z"/>
<path d="M10.344 11.742c.03.04.062.078.098.115l3.85 3.85a1 1 0 0 0 1.415-1.414l-3.85-3.85a1.007 1.007 0 0 0-.115-.1 6.538 6.538 0 0 1-1.398 1.4z"/>
<path fill-rule="evenodd" d="M3 6.5a.5.5 0 0 1 .5-.5h6a.5.5 0 0 1 0 1h-6a.5.5 0 0 1-.5-.5z"/>
</svg>
</button>
<button type="button" class="btn btn-dark" id="button-enlarge" onclick="resizeTable(true)">
<svg xmlns="http://www.w3.org/2000/svg" width="16" height="16" fill="currentColor" class="bi bi-zoom-in" viewBox="0 0 16 16">
<path fill-rule="evenodd" d="M6.5 12a5.5 5.5 0 1 0 0-11 5.5 5.5 0 0 0 0 11zM13 6.5a6.5 6.5 0 1 1-13 0 6.5 6.5 0 0 1 13 0z"/>
<path d="M10.344 11.742c.03.04.062.078.098.115l3.85 3.85a1 1 0 0 0 1.415-1.414l-3.85-3.85a1.007 1.007 0 0 0-.115-.1 6.538 6.538 0 0 1-1.398 1.4z"/>
<path fill-rule="evenodd" d="M6.5 3a.5.5 0 0 1 .5.5V6h2.5a.5.5 0 0 1 0 1H7v2.5a.5.5 0 0 1-1 0V7H3.5a.5.5 0 0 1 0-1H6V3.5a.5.5 0 0 1 .5-.5z"/>
</svg>
</button>
</div>
</th>
</tr>
</thead>
<tbody>
</tbody>
</table>
</div>
</div>
<div class="alert alert-info" id="cldraw-computation-running2" role="alert" style="display: none">
The remaining probabilities are being computed. Please wait...
</div>
<h3 id="cldraw-buttons-heading" class="d-none">Draw team</h3>
<div class="btn-toolbar" id="cldraw-buttons">
</div>
<h3>Options</h3>
<div class="btn-options">
<button type="button" class="btn btn-primary" id="button-randomteam" onclick="drawRandomTeam()">
<svg xmlns="http://www.w3.org/2000/svg" width="16" height="16" fill="currentColor" class="bi bi-shuffle" viewBox="0 0 16 16">
<path fill-rule="evenodd" d="M0 3.5A.5.5 0 0 1 .5 3H1c2.202 0 3.827 1.24 4.874 2.418.49.552.865 1.102 1.126 1.532.26-.43.636-.98 1.126-1.532C9.173 4.24 10.798 3 13 3v1c-1.798 0-3.173 1.01-4.126 2.082A9.624 9.624 0 0 0 7.556 8a9.624 9.624 0 0 0 1.317 1.918C9.828 10.99 11.204 12 13 12v1c-2.202 0-3.827-1.24-4.874-2.418A10.595 10.595 0 0 1 7 9.05c-.26.43-.636.98-1.126 1.532C4.827 11.76 3.202 13 1 13H.5a.5.5 0 0 1 0-1H1c1.798 0 3.173-1.01 4.126-2.082A9.624 9.624 0 0 0 6.444 8a9.624 9.624 0 0 0-1.317-1.918C4.172 5.01 2.796 4 1 4H.5a.5.5 0 0 1-.5-.5z"/>
<path d="M13 5.466V1.534a.25.25 0 0 1 .41-.192l2.36 1.966c.12.1.12.284 0 .384l-2.36 1.966a.25.25 0 0 1-.41-.192zm0 9v-3.932a.25.25 0 0 1 .41-.192l2.36 1.966c.12.1.12.284 0 .384l-2.36 1.966a.25.25 0 0 1-.41-.192z"/>
</svg> Draw random team
</button>
<div class="btn-group">
<button type="button" class="btn btn-warning" id="button-undo" onclick="undo()">
<svg xmlns="http://www.w3.org/2000/svg" width="16" height="16" fill="currentColor" class="bi bi-arrow-return-left" viewBox="0 0 16 16">
<path fill-rule="evenodd" d="M14.5 1.5a.5.5 0 0 1 .5.5v4.8a2.5 2.5 0 0 1-2.5 2.5H2.707l3.347 3.346a.5.5 0 0 1-.708.708l-4.2-4.2a.5.5 0 0 1 0-.708l4-4a.5.5 0 1 1 .708.708L2.707 8.3H12.5A1.5 1.5 0 0 0 14 6.8V2a.5.5 0 0 1 .5-.5z"/>
</svg> Undo
</button>
<button type="button" class="btn btn-danger" id="button-restart" onclick="reset()">
<svg xmlns="http://www.w3.org/2000/svg" width="16" height="16" fill="currentColor" class="bi bi-arrow-repeat" viewBox="0 0 16 16">
<path d="M11.534 7h3.932a.25.25 0 0 1 .192.41l-1.966 2.36a.25.25 0 0 1-.384 0l-1.966-2.36a.25.25 0 0 1 .192-.41zm-11 2h3.932a.25.25 0 0 0 .192-.41L2.692 6.23a.25.25 0 0 0-.384 0L.342 8.59A.25.25 0 0 0 .534 9z"/>
<path fill-rule="evenodd" d="M8 3c-1.552 0-2.94.707-3.857 1.818a.5.5 0 1 1-.771-.636A6.002 6.002 0 0 1 13.917 7H12.9A5.002 5.002 0 0 0 8 3zM3.1 9a5.002 5.002 0 0 0 8.757 2.182.5.5 0 1 1 .771.636A6.002 6.002 0 0 1 2.083 9H3.1z"/>
</svg> Restart
</button>
</div>
<div class="btn-group">
<button type="button" class="btn btn-outline-dark" id="button-heat" onclick="toggleHeatMode()">
<svg xmlns="http://www.w3.org/2000/svg" width="16" height="16" fill="currentColor" class="bi bi-thermometer-half" viewBox="0 0 16 16">
<path d="M9.5 12.5a1.5 1.5 0 1 1-2-1.415V6.5a.5.5 0 0 1 1 0v4.585a1.5 1.5 0 0 1 1 1.415z"/>
<path d="M5.5 2.5a2.5 2.5 0 0 1 5 0v7.55a3.5 3.5 0 1 1-5 0V2.5zM8 1a1.5 1.5 0 0 0-1.5 1.5v7.987l-.167.15a2.5 2.5 0 1 0 3.333 0l-.166-.15V2.5A1.5 1.5 0 0 0 8 1z"/>
</svg> Heat map
</button>
<button type="button" class="btn btn-outline-dark" id="button-hide" onclick="toggleHideMode()">
<svg xmlns="http://www.w3.org/2000/svg" width="16" height="16" fill="currentColor" class="bi bi-eye-slash-fill" viewBox="0 0 16 16">
<path d="M10.79 12.912l-1.614-1.615a3.5 3.5 0 0 1-4.474-4.474l-2.06-2.06C.938 6.278 0 8 0 8s3 5.5 8 5.5a7.027 7.027 0 0 0 2.79-.588zM5.21 3.088A7.028 7.028 0 0 1 8 2.5c5 0 8 5.5 8 5.5s-.939 1.721-2.641 3.238l-2.062-2.062a3.5 3.5 0 0 0-4.474-4.474L5.21 3.088z"/>
<path d="M5.525 7.646a2.5 2.5 0 0 0 2.829 2.829l-2.83-2.829zm4.95.708l-2.829-2.83a2.5 2.5 0 0 1 2.829 2.829zm3.171 6l-12-12 .708-.708 12 12-.708.707z"/>
</svg> Hide drawn teams
</button>
<button type="button" class="btn btn-outline-dark" onclick="transposeTable()">
<svg xmlns="http://www.w3.org/2000/svg" width="16" height="16" fill="currentColor" class="bi bi-arrow-left-right" viewBox="0 0 16 16">
<path fill-rule="evenodd" d="M1 11.5a.5.5 0 0 0 .5.5h11.793l-3.147 3.146a.5.5 0 0 0 .708.708l4-4a.5.5 0 0 0 0-.708l-4-4a.5.5 0 0 0-.708.708L13.293 11H1.5a.5.5 0 0 0-.5.5zm14-7a.5.5 0 0 1-.5.5H2.707l3.147 3.146a.5.5 0 1 1-.708.708l-4-4a.5.5 0 0 1 0-.708l4-4a.5.5 0 1 1 .708.708L2.707 4H14.5a.5.5 0 0 1 .5.5z"/>
</svg> Transpose table
</button>
</div>
<button type="button" class="btn btn-secondary" id="button-editor" style="display: none" data-bs-toggle="modal" data-bs-target="#cldraw-editor" onclick="createEditor()">
<svg xmlns="http://www.w3.org/2000/svg" width="16" height="16" fill="currentColor" class="bi bi-pencil-square" viewBox="0 0 16 16">
<path d="M15.502 1.94a.5.5 0 0 1 0 .706L14.459 3.69l-2-2L13.502.646a.5.5 0 0 1 .707 0l1.293 1.293zm-1.75 2.456l-2-2L4.939 9.21a.5.5 0 0 0-.121.196l-.805 2.414a.25.25 0 0 0 .316.316l2.414-.805a.5.5 0 0 0 .196-.12l6.813-6.814z"/>
<path fill-rule="evenodd" d="M1 13.5A1.5 1.5 0 0 0 2.5 15h11a1.5 1.5 0 0 0 1.5-1.5v-6a.5.5 0 0 0-1 0v6a.5.5 0 0 1-.5.5h-11a.5.5 0 0 1-.5-.5v-11a.5.5 0 0 1 .5-.5H9a.5.5 0 0 0 0-1H2.5A1.5 1.5 0 0 0 1 2.5v11z"/>
</svg> Edit teams
</button>
<button type="button" class="btn btn-light" id="button-dl" style="display: none" onclick="exportJSON(13, true)">
<svg xmlns="http://www.w3.org/2000/svg" width="16" height="16" fill="currentColor" class="bi bi-download" viewBox="0 0 16 16">
<path d="M.5 9.9a.5.5 0 0 1 .5.5v2.5a1 1 0 0 0 1 1h12a1 1 0 0 0 1-1v-2.5a.5.5 0 0 1 1 0v2.5a2 2 0 0 1-2 2H2a2 2 0 0 1-2-2v-2.5a.5.5 0 0 1 .5-.5z"/>
<path d="M7.646 11.854a.5.5 0 0 0 .708 0l3-3a.5.5 0 0 0-.708-.708L8.5 10.293V1.5a.5.5 0 0 0-1 0v8.793L5.354 8.146a.5.5 0 1 0-.708.708l3 3z"/>
</svg> Export probabilities
</button>
</div>
</div>
<footer class="footer">
<div class="container">
<p>Developed by Emmanuel Syrmoudis</p>
<p>Source code, background info, and bug reports on <a href="https://github.com/eminga/cldraw">GitHub</a></p>
</div>
</footer>
<script src="bootstrap/bootstrap.bundle.min.js"></script>
<script src="ui.js"></script>
</body>
</html>