-
Notifications
You must be signed in to change notification settings - Fork 3
/
index.html
334 lines (306 loc) · 10.4 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
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
<!DOCTYPE html>
<!--
note 04/2023:
rides separated in ./rides/rides.json
for using on local machine, now needs "browser-sync start --server ."
finding routes:
https://my.rouvy.com/virtual-routes/detail/56662
-->
<html>
<head>
<meta name="viewport" content="width=device-width, initial-scale=1">
<script src="https://cdnjs.cloudflare.com/ajax/libs/jquery/3.4.1/jquery.min.js"></script>
<script src="https://cdn.jsdelivr.net/npm/axios/dist/axios.min.js"></script>
<script src="https://cdn.jsdelivr.net/npm/@thelevicole/youtube-to-html5-loader@4.0.0/dist/YouTubeToHtml5.min.js"></script>
<!-- for the pedal chart -->
<script src="https://cdnjs.cloudflare.com/ajax/libs/Chart.js/2.9.4/Chart.bundle.min.js"></script>
<script src="gpxFile.js"></script>
<script src="rouvyXmlFile.js"></script>
<script src="VincentyFormula.js"></script>
<script src="direto.js"></script>
<script src="hrm.js"></script>
<script src="track.js"></script>
<script src="rider.js"></script>
<script src="ghost.js"></script>
<script src="simulator.js"></script>
<script src="app.js"></script>
<style>
* {
box-sizing: border-box;
}
body {
margin: 0;
font-family: Arial;
font-size: 15px;
}
#myVideo {
position: fixed;
right: 0;
bottom: 0;
min-width: 100%;
min-height: 100%;
}
#cvsProfile, #cvsMap, #cvsGradient, #myRadarChart {
border:1px solid #FFFFFF;
border-radius:5px;
margin:5px;
flex:0;
}
.graphicsOverlay {
position: fixed;
bottom: 0;
color: #f1f1f1;
width: 100%;
padding: 0px 20px;
}
.flex-container {
display: flex;
flex-wrap: wrap;
align-items: flex-start;
justify-content:flex-end;
}
/* a trick to force next row in flex layout */
.break {
flex-basis: 100%;
height: 0;
}
.grid-container {
display: grid;
gap: 20px 0px;
grid-template-columns: minmax(auto,150px) auto minmax(auto,200px);
grid-template-rows: auto minmax(110px,auto);
grid-template-areas: "data-left . data-right"
"footer footer footer";
}
.footer {
grid-area: footer;
/* border: 1px solid #FFFFFF; */ /* for test */
background: rgba(0, 0, 0, 0.5);
}
.data-left {
grid-area: data-left;
align-self: end;
}
.data-right {
grid-area: data-right;
align-self: end;
}
p.dataitem {
border-radius: 10px;
border: 2px solid #FFFFFF;
margin : 5px;
padding: 5px;
background: rgba(0, 0, 0, 0.5);
text-align: center;
}
.datavalue {
font-size: 1.5rem;
font-weight: bold;
}
span.averagevalue {
font-size: 0.75rem;
}
span.climbdata {
text-align: left;
display: block; /* needed for the text-align to work on the span text, dunno why */
}
button {
/*width: 100px; */
width: auto;
font-size: 12px;
padding: 5px;
border: none;
background: #ddd;
color: black;
cursor: pointer;
}
button:hover {
background: blue;
}
/* change the BLE connect button bg color */
button.connected {
background: green;
}
/* The Modal (background) */
.modal {
display: none; /* Hidden by default */
position: fixed; /* Stay in place */
z-index: 1; /* Sit on top */
left: 0;
top: 0;
width: 100%; /* Full width */
height: 100%; /* Full height */
overflow: auto; /* Enable scroll if needed */
background-color: rgb(0,0,0); /* Fallback color */
background-color: rgba(0,0,0,0.4); /* Black w/ opacity */
}
/* Modal Content */
.modal-content {
position: relative;
background-color: #fefefe;
margin: auto;
padding: 0;
border: 1px solid #888;
width: 750px; /* 80%; */
box-shadow: 0 4px 8px 0 rgba(0,0,0,0.2),0 6px 20px 0 rgba(0,0,0,0.19);
/*border-radius: 10px;
border: 2px solid #FFFFFF; */
}
/* Modal Header */
.modal-header {
padding: 2px 16px;
background-color: rgba(0,0,0,0.4);
color: white;
font-size: 1.5rem;
}
/* Modal Body */
.modal-body {
padding: 2px 16px;
}
/* Modal Footer */
.modal-footer {
padding: 2px 16px;
background-color: rgba(0,0,0,0.4);
color: white;
}
/* The Close Button */
.close {
color: white;
float: right;
font-size: 28px;
font-weight: bold;
}
.close:hover, .close:focus {
color: black;
text-decoration: none;
cursor: pointer;
}
/* moet nog preciezer, want is enkel voor de table in de modal */
table {
width: 95%;
margin-top : 10px;
font-size: 12px;
}
table, th, td {
border: 1px solid black;
border-collapse: collapse;
}
</style>
</head>
<body onload="onBodyLoad()">
<div id="container">
<video muted id="myVideo" poster="" title="">
<source src="https://mediacdn.rouvy.com/routes/2675/video/2675_desktop.mp4" type="video/mp4">
Your browser does not support HTML5 video.
</video>
<div class="graphicsOverlay">
<!--- <div class="flex-container"> -->
<div class="grid-container">
<!-- <div style="flex:1;"> -->
<!-- style="display:none" -->
<div class="data-left">
<p class="dataitem">
<span id="data-pow" class="datavalue">-</span><span> W</span>
<span id="data-balance">--/--</span><br>
<span id="data-avpow" class="averagevalue">-</span><span class="averagevalue"> W</span>
<span id="data-avbalance" class="averagevalue">--/--</span>
</p>
<p class="dataitem">
<span id="data-rpm" class="datavalue">-</span><span> rpm </span><br>
<span id="data-avrpm" class="averagevalue">-</span><span class="averagevalue"> rpm</span>
</p>
<p id="bubble-hrm" class="dataitem"> <!-- id for showing/hiding the bubble -->
<span id="data-bpm" class="datavalue">-</span><span> ♥</span><br>
</p>
<p class="dataitem">
<span id="data-spd" class="datavalue">0.00 </span> km/h<br>
<span id="data-avspd" class="averagevalue">0.00</span><span class="averagevalue"> km/h</span>
</p>
</div>
<div class="data-right">
<p class="dataitem">
<span id="data-time" class="datavalue">--</span><br>
<span id="data-dist">--</span>
</p>
<p id='bubble-allclimbs' class="dataitem">
<span id="data-allclimbs" class="climbdata"></span>
</p>
<p class="dataitem">
<span class="datavalue">▲ </span>
<span id="data-grad" class="datavalue">-</span>
<span id="data-avgrad" class="averagevalue"></span><br>
<span id="data-ascent"></span> <br>
<span id="data-climb"></span>
</p>
<p class="dataitem">
<span id="data-ghost-pow"class="datavalue">0</span> W<br>
<span id="data-ghost-pos">no ghost</span><br>
</p>
</div>
<div class="footer">
<div class="flex-container">
<div style="flex:1;">
<canvas id="cvsGradient" width="500" height="15">Your browser does not support the HTML5 canvas tag.</canvas>
<div class="break"></div>
<div style="padding:5px">
<!-- Trigger/Open The Modal -->
<button id="buttonMenu" title="choose your ride">Menu</button>
<button id="buttonRide" title="start your session">Start</button>
<span id="debugTxt"></span>
</div>
</div>
<!-- not sure why but this canvas needs to be outside of the next div in order to align with the other canvases-->
<canvas id="myRadarChart" width="100" height="100"></canvas>
<div>
<canvas id="cvsProfile" width="400" height="100"></canvas>
<canvas id="cvsMap" width="100" height="100"></canvas>
</div>
</div>
</div>
</div>
</div>
</div>
<div id="menu" class="modal">
<!-- Modal content -->
<div class="modal-content">
<div class="modal-header">
<span class="close">×</span>
Setup Menu
</div>
<div class="modal-body">
<h2>Ride Setup</h2>
<div>
<button id="buttonConnectTrainer" title="connect BLE trainer">Trainer</button>
<button id="buttonConnectHrm" title="connect BLE hear rate monitor">♥</button>
<button><a href="" id="buttonDownload" title="download your ride data">Download GPX</a></button>
<button><a href="/strava/authorize" target='_blank' title="authorize this app to upload your data to your strava account">Strava Login</a></button>
<button id="buttonUpload" title="upload your ride data to Strava">Upload to Strava</button>
<button id="buttonFileVideo" title="choose a video file from your PC" onclick="document.getElementById('fileVideo').click()">video!</button>
<input type="file" id="fileVideo" style="display:none;" accept="video/*"/>
<!-- <button id="buttonFileTrack" title= "choose a track file from your PC" onclick="document.getElementById('fileTrack').click()">track!</button> -->
<button id="buttonFileTrack" title= "choose a track file from your PC" onclick="document.getElementById('fileTrack').click()">ghost!</button>
<input type="file" id="fileTrack" style="display:none;" accept=".gpx,.xml" />
</div>
<div style="height:250px;overflow:auto;margin:5px">
<table id="tableTheRides">
<tr>
<th></th>
<th>The Ride</th>
<th>What to expect!</th>
</tr>
</table>
</div>
<h2>User Settings <button id="buttonSaveSettings" title="Save settings in a client cookie">Save Settings</button></h2>
<div>
<p>Rider Weight :
<input type="number" step= "0.1" id="settingRiderWeight" value="75" maxlength="5" title="no cheating!">
Trainer Difficulty (%) :
<input type="number" step= "5" id="settingTrainerDifficulty" value="100" min= "0" max="100" title="trainer difficulty in %">
</p>
</div>
</div>
<!-- <div class="modal-footer">
</div> -->
</div>
</body>
</html>