-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathindex.html
239 lines (220 loc) · 9.87 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
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<title>GainsCulator</title>
<link rel="preconnect" href="https://fonts.googleapis.com">
<link rel="preconnect" href="https://fonts.gstatic.com" crossorigin>
<link href="https://fonts.googleapis.com/css2?family=Roboto+Mono:ital,wght@0,100..700;1,100..700&family=Roboto:ital,wght@0,100;0,300;0,400;0,500;0,700&display=swap" rel="stylesheet">
<style>
body {
font-family: "Roboto Mono", sans-serif;
color: #333333;
background-color: #f8f8f8;
text-align: center;
padding: 20px;
margin: 0;
max-width: 1000px;
margin: 0 auto;
}
h1 {
font-size: 2.0em;
margin-bottom: 0.5em;
}
::selection {
background: #F9E400;
color: #7C00FE;
}
p {
font-size: 1.0em;
line-height: 1.8;
margin: 1em 0;
}
input, select {
width: 100%;
padding: 10px;
margin: 10px 0;
box-sizing: border-box;
font-family: "Roboto Mono", sans-serif;
}
button {
background-color: #F9E400;
color: #7C00FE;
border: none;
padding: 10px 20px;
border-radius: 20px;
cursor: pointer;
font-size: 1.2em;
}
button:hover {
background-color: #d8c800;
}
.toggle-switch {
width: 60px;
height: 30px;
background-color: grey;
border-radius: 30px;
position: relative;
margin: 10px auto;
display: flex;
align-items: center;
justify-content: space-between;
padding: 5px;
}
.toggle-switch.active {
background-color: #8BC34A;
}
.toggle-switch span {
font-size: 0.9em;
color: white;
}
.toggle-btn {
width: 30px;
height: 30px;
background-color: white;
border-radius: 50%;
position: absolute;
top: 0;
left: 0;
transition: 0.3s;
}
.toggle-switch.active .toggle-btn {
left: 30px;
}
.popup {
display: none;
position: fixed;
top: 50%;
left: 50%;
transform: translate(-50%, -50%);
background-color: white;
padding: 20px;
box-shadow: 0px 4px 10px rgba(0, 0, 0, 0.1);
border-radius: 10px;
z-index: 9999;
width: 80%;
max-width: 500px;
}
.popup .close-btn {
position: absolute;
top: 10px;
right: 10px;
cursor: pointer;
font-size: 1.5em;
}
.popup .bold {
font-size: 1.5em;
margin: 10px 0;
}
</style>
</head>
<body>
<h1>GainsCulator</h1>
<p>Use the GainsCulator to find out your strength levels based on your bodyweight and lifts! Input your bodyweight, squat, benchpress, and deadlift, and see how you measure up.</p>
<br>
<p>Put together by <a href="https://www.linkedin.com/in/phanosha/" target="_blank">Phanos Hadjikyriakou</a>.</p>
<br>
<form id="gainsForm">
<label for="gender">Gender:</label>
<select id="gender" name="gender">
<option value="male">Male</option>
<option value="female">Female</option>
</select>
<label for="bodyweight">Bodyweight (kg/lb):</label>
<input type="number" id="bodyweight" name="bodyweight" placeholder="Enter your bodyweight" required>
<label for="squat">Squat Max (kg/lb):</label>
<input type="number" id="squat" name="squat" placeholder="Enter your squat max" required>
<label for="bench">Benchpress Max (kg/lb):</label>
<input type="number" id="bench" name="bench" placeholder="Enter your benchpress max" required>
<label for="deadlift">Deadlift Max (kg/lb):</label>
<input type="number" id="deadlift" name="deadlift" placeholder="Enter your deadlift max" required>
<button type="button" id="calculateBtn">Face the Truth</button>
</form>
<div class="popup" id="resultsPopup">
<span class="close-btn" id="closePopup">×</span>
<p class="bold">Your Stats 👇</p>
<p id="squatResult"></p>
<p id="benchResult"></p>
<p id="deadliftResult"></p>
</div>
<script>
document.getElementById('calculateBtn').addEventListener('click', () => {
const bodyweight = parseFloat(document.getElementById('bodyweight').value);
const squatMax = parseFloat(document.getElementById('squat').value);
const benchMax = parseFloat(document.getElementById('bench').value);
const deadliftMax = parseFloat(document.getElementById('deadlift').value);
const gender = document.getElementById('gender').value;
const results = {
squat: getLevel('squat', gender, squatMax, bodyweight),
bench: getLevel('bench', gender, benchMax, bodyweight),
deadlift: getLevel('deadlift', gender, deadliftMax, bodyweight)
};
document.getElementById('squatResult').innerText = `Squat: ${results.squat}`;
document.getElementById('benchResult').innerText = `Bench: ${results.bench}`;
document.getElementById('deadliftResult').innerText = `Deadlift: ${results.deadlift}`;
document.getElementById('resultsPopup').style.display = 'block';
});
function getLevel(lift, gender, liftMax, bodyweight) {
let ratio = liftMax / bodyweight;
if (lift === 'squat') return getSquatLevel(ratio, gender);
if (lift === 'bench') return getBenchLevel(ratio, gender);
if (lift === 'deadlift') return getDeadliftLevel(ratio, gender);
}
function getSquatLevel(ratio, gender) {
if (gender === 'male') {
if (ratio < 1.25) return `${ratio.toFixed(2)}x BW (Noob)`;
else if (ratio === 1) return `${ratio.toFixed(2)}x BW (Beginner)`;
else if (ratio >= 1.25 && ratio < 1.75) return `${ratio.toFixed(2)}x BW (Intermediate)`;
else if (ratio >= 1.75 && ratio < 2.5) return `${ratio.toFixed(2)}x BW (Advanced)`;
else if (ratio >= 2.5 && ratio < 3) return `${ratio.toFixed(2)}x BW (Elite)`;
else if (ratio >= 3) return `${ratio.toFixed(2)}x BW (Freak)`;
} else {
if (ratio < 0.5) return `${ratio.toFixed(2)}x BW (Noob)`;
else if (ratio >= 0.5 && ratio < 1.0) return `${ratio.toFixed(2)}x BW (Beginner)`;
else if (ratio >= 1.0 && ratio < 1.5) return `${ratio.toFixed(2)}x BW (Intermediate)`;
else if (ratio >= 1.5 && ratio < 1.75) return `${ratio.toFixed(2)}x BW (Advanced)`;
else if (ratio >= 1.75 && ratio < 2.25) return `${ratio.toFixed(2)}x BW (Advanced)`;
else if (ratio >= 2.25) return `${ratio.toFixed(2)}x BW (Freak)`;
}
}
function getBenchLevel(ratio, gender) {
if (gender === 'male') {
if (ratio < 1) return `${ratio.toFixed(2)}x BW (Noob)`;
else if (ratio === 1) return `${ratio.toFixed(2)}x BW (Beginner)`;
else if (ratio > 1 && ratio < 1.5) return `${ratio.toFixed(2)}x BW (Intermediate)`;
else if (ratio >= 1.5 && ratio < 2) return `${ratio.toFixed(2)}x BW (Advanced)`;
else if (ratio >= 2 && ratio <= 2.25) return `${ratio.toFixed(2)}x BW (Elite)`;
else if (ratio > 2.25) return `${ratio.toFixed(2)}x BW (Freak)`;
} else {
if (ratio < 0.5) return `${ratio.toFixed(2)}x BW (Noob)`;
else if (ratio === 0.5) return `${ratio.toFixed(2)}x BW (Beginner)`;
else if (ratio >= 0.5 && ratio < 0.75) return `${ratio.toFixed(2)}x BW (Intermediate)`;
else if (ratio >= 0.75 && ratio < 1.0) return `${ratio.toFixed(2)}x BW (Advanced)`;
else if (ratio >= 1.0 && ratio < 1.25) return `${ratio.toFixed(2)}x BW (Elite)`;
else if (ratio >= 1.25) return `${ratio.toFixed(2)}x BW (Freak)`;
}
}
function getDeadliftLevel(ratio, gender) {
if (gender === 'male') {
if (ratio < 1.5) return `${ratio.toFixed(2)}x BW (Noob)`;
else if (ratio === 1.5) return `${ratio.toFixed(2)}x BW (Beginner)`;
else if (ratio >= 1.5 && ratio < 2.25) return `${ratio.toFixed(2)}x BW (Intermediate)`;
else if (ratio >= 2.25 && ratio < 3) return `${ratio.toFixed(2)}x BW (Advanced)`;
else if (ratio >= 3 && ratio < 3.5) return `${ratio.toFixed(2)}x BW (Elite)`;
else if (ratio >= 3.5) return `${ratio.toFixed(2)}x BW (Freak)`;
} else {
if (ratio < 0.5) return `${ratio.toFixed(2)}x BW (Noob)`;
else if (ratio >= 0.5 && ratio < 1.25) return `${ratio.toFixed(2)}x BW (Beginner)`;
else if (ratio >= 1.25 && ratio < 1.75) return `${ratio.toFixed(2)}x BW (Intermediate)`;
else if (ratio >= 1.75 && ratio < 2.25) return `${ratio.toFixed(2)}x BW (Advanced)`;
else if (ratio >= 2.25 && ratio < 3.0) return `${ratio.toFixed(2)}x BW (Elite)`;
else if (ratio >= 3.0) return `${ratio.toFixed(2)}x BW (Freak)`;
}
}
document.getElementById('closePopup').addEventListener('click', () => {
document.getElementById('resultsPopup').style.display = 'none';
});
</script>
</body>
</html>