-
-
Notifications
You must be signed in to change notification settings - Fork 33
/
hrtowatts.html
126 lines (113 loc) · 4.47 KB
/
hrtowatts.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
<!DOCTYPE html>
<html>
<head>
<style type="text/css">
html {
background-color: #03245c;
}
</style>
<title>SmartSpin2K Web Server</title>
<meta name="viewport" content="width=device-width, initial-scale=1">
</head>
<body>
<fieldset>
<legend><a href="http://github.com/doudar/SmartSpin2k">http://github.com/doudar/SmartSpin2k</a></legend>
<p style="text-align: left;"><strong><a href="index.html">Main Index</a></strong></p>
<h1>
<div class="watermark" id="loadingWatermark">Loading</div>
</h1>
<h1><strong>Physical Working Capacity</strong></h1>
<h2>
<p>For the most accurate power estimation when not using a power meter, please submit the following information.
<br>Note: You can get estimated watts from any outdoor ride recorded in Strava with heart rate information.
</p>
<form action="/send_settings">
<table class="center" height="182" cellspacing="1">
<tbody>
<tr>
<td>
<p class="tooltip">Easy Session Average HR<span class="tooltiptext">Session 1 HR<br><br>Average
Heartrate over an easy 1 Hour course.</span></p>
</td>
<td><input type="number" id="session1HR" name="session1HR" value="0" /></td>
</tr>
<tr>
<td>
<p class="tooltip">Easy Session Average Power<span class="tooltiptext">Average Power over an easy 1 hour
course in watts.</span></p>
</td>
<td><input type="number" id="session1Pwr" name="session1Pwr" value="0" />
</td>
</tr>
<tr>
<td>
<p class="tooltip">Hard Session Average HR<span class="tooltiptext">Average HR over a hard 1 hour
course.</span></p>
</td>
<td><input type="number" id="session2HR" name="session2HR" value="0" />
</td>
<tr>
<td>
<p class="tooltip">Hard Session Average Power<span class="tooltiptext">Average Power over a hard 1 hour
course in watts.</span></p>
</td>
<td><input type="number" id="session2Pwr" name="session2Pwr" value="0" />
</td>
</tr>
<tr>
<td>
<p class="tooltip">HR->PWR<span class="tooltiptext">Automatically calculate watts using
heart rate when power meter not connected</span></p>
</td>
<td><label class="switch"><input type="checkbox" name="hr2Pwr" id="hr2Pwr"><span
class="slider"></span></label>
</td>
</tr>
</tbody>
</table><br>
<input type="submit" value="Submit" />
<p><a href="https://github.com/doudar/SmartSpin2k/wiki/Riding-SmartSpin2k-With-Heart-Rate-Derived-Power">Page Help</a></p>
</form>
</h2>
</body>
<script>
//Update values on specified interval loading late because this tiny webserver hates frequent requests
setInterval(function () {
if (document.getElementById("session1HR").value == "0") {
requestConfigValues();
}
}, 1000);
function requestConfigValues() {
var xhttp = new XMLHttpRequest();
xhttp.onreadystatechange = function () {
if (this.readyState == 4 && this.status == 200) {
var obj = JSON.parse(this.responseText);
document.getElementById("session1HR").value = obj.session1HR;
document.getElementById("session1Pwr").value = obj.session1Pwr;
document.getElementById("session2HR").value = obj.session2HR;
document.getElementById("session2Pwr").value = obj.session2Pwr;
document.getElementById("hr2Pwr").checked = obj.hr2Pwr;
setTimeout(function () { document.getElementById("loadingWatermark").remove(); }, 1000);
}
};
xhttp.open("GET", "/PWCJSON", true);
xhttp.send();
}
//define function to load css
var loadCss = function () {
var cssLink = document.createElement('link');
cssLink.rel = 'stylesheet';
cssLink.href = 'style.css';
var head = document.getElementsByTagName('head')[0];
head.parentNode.insertBefore(cssLink, head);
};
//Delay loading css to not swamp webserver
window.addEventListener('load', function () {
setTimeout(loadCss, 100);
}, false);
function updateSlider(element, valueElement) {
var sliderValue = element.value;
valueElement.innerHTML = sliderValue;
}
</script>
</html>