-
Notifications
You must be signed in to change notification settings - Fork 1
/
index.html
269 lines (218 loc) · 7.2 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
<!doctype html>
<html lang="en">
<head>
<meta charset="utf-8">
<meta name="viewport" content="width=device-width, initial-scale=1, shrink-to-fit=no">
<title>James Lewis' Muscle Math</title>
<meta name="description" content="James Lewis' Muscle Math">
<meta name="author" content="Chris and James in America INC">
<link rel="stylesheet" href="https://stackpath.bootstrapcdn.com/bootstrap/4.5.2/css/bootstrap.min.css"
integrity="sha384-JcKb8q3iqJ61gNV9KGb8thSsNjpSL0n8PARn9HuZOnIxN0hoP+VmmDGMN5t9UJ0Z" crossorigin="anonymous">
<style>
.wobbleText {
margin: 0;
font-size: 8em;
padding: 0;
color: white;
text-shadow: 0 0.1em 20px rgba(0, 0, 0, 1), 0.05em -0.03em 0 rgba(0, 0, 0, 1),
0.05em 0.005em 0 rgba(0, 0, 0, 1), 0em 0.08em 0 rgba(0, 0, 0, 1),
0.05em 0.08em 0 rgba(0, 0, 0, 1), 0px -0.03em 0 rgba(0, 0, 0, 1),
-0.03em -0.03em 0 rgba(0, 0, 0, 1), -0.03em 0.08em 0 rgba(0, 0, 0, 1), -0.03em 0 0 rgba(0, 0, 0, 1);
}
.wobbleText span {
transform: scale(0.9);
display: inline-block;
}
.wobbleText span:first-child {
animation: bop 1s cubic-bezier(0.175, 0.885, 0.32, 1.275) forwards infinite alternate;
}
.wobbleText span:last-child {
animation: bopB 1s 0.2s cubic-bezier(0.175, 0.885, 0.32, 1.275) forwards infinite alternate;
}
@keyframes bop {
0% {
transform: scale(0.9);
}
50%,
100% {
transform: scale(1);
}
}
@keyframes bopB {
0% {
transform: scale(0.9);
}
80%,
100% {
transform: scale(1) rotateZ(-3deg);
}
}
body {
padding-top: 30px;
background-color: #0ad5f5;
}
.MMTitle {
font-size: 12vw;
}
@media screen and (min-width: 1000px) {
.MMTitle {
font-size: 7.8em;
}
}
#backgroundContainer {
z-index: 1;
}
#backgroundContainer:before {
content: "";
position: absolute;
z-index: -1;
top: 0;
bottom: 0;
left: 0;
right: 0;
background-image: url("images/face/face10.png");
background-repeat: no-repeat;
background-size: 100%;
opacity: 0.4;
filter: alpha(opacity=40);
height: 100%;
width: 100%;
}
.main {
height: 100%;
width: 100%;
margin: auto;
z-index: -1;
opacity: 1;
filter: alpha(opacity=100);
}
input:focus::placeholder {
color: transparent;
}
.weightContainer {
position: relative;
text-align: center;
color: white;
display: inline-block;
}
.weightContainer img {
float: left;
}
.bottom-left {
position: absolute;
bottom: 4px;
left: 6px;
color: white;
-webkit-text-stroke: 2px black;
font-weight: 800;
font-size: 28px;
}
</style>
</head>
<body>
<div id="backgroundContainer">
<div class="main">
<div class="container-fluid text-center">
<h1>James Lewis'</h1>
<h1 class="MMTitle wobbleText"><span>MUSCLE</span><br><span>MATH</span></h1>
<div class="row">
<div id="title" class="col-md-8 offset-md-2">
<!-- a bootstrap form -->
<form onsubmit="return calcWeights()">
<div class="form-group" id="weightCalcForm">
<label for=" goalWeight"></label>
<input type="number" step="1" class="form-control" id="goalWeight"
aria-describedby="weightHelp" required="true" placeholder="0">
<small id="weightHelp" class="form-text text-muted">How many LBS u gonna lift
BRAH?</small>
</div>
<button type="submit" class="btn btn-primary">Calculate</button>
</form>
<br><br>
<h3 id="resultInfo"></h3>
<h3 id="weightGraphics"></h3>
</div>
</div>
</div>
<!-- an empty div with id resultInfo. ready to be populated with the results of the calculations-->
</div>
</div>
<script>
// The weight of the bar
const barWeight = 45
// An array containing the weights available at your gym. Smallest to largest.
const gymWeights = [{ lbs: 2.5, icon: "images/plate/2_5p.png", size: 55 },
{ lbs: 5, icon: "images/plate/5lbs_b.png", size: 60 },
{ lbs: 10, icon: "images/plate/10lbs_g.png", size: 65 },
{ lbs: 25, icon: "images/plate/25lbs_y.png", size: 70 },
{ lbs: 35, icon: "images/plate/35lbs_o.png", size: 75 },
{ lbs: 45, icon: "images/plate/45lbs_r.png", size: 80 }]
// This function gets called when the submit button is clicked
function calcWeights() {
// an array containing the weights the app will suggest that you use
var myWeights = [];
// gets the value from
var goalWeight = document.getElementById("goalWeight").value;
// Validation TOO HEAVY
if (goalWeight > 10000) {
document.getElementById("resultInfo").innerText = "Error: Nobody can lift more than James";
document.getElementById("weightGraphics").innerHTML = ""
// Since the input is bad.. dont do anything else.. we are DONE HERE!
return false;
}
// This is debug code, hit F12 in your browser and view the console to see this output
console.log(goalWeight);
// temp variable to hold the current weight
var currentWeight = barWeight;
// Do the math
// start with heaviest weight and work down the list
for (i = gymWeights.length - 1; i >= 0; i--) {
//add as many of this weight as you can
while ((currentWeight + (gymWeights[i].lbs * 2)) <= goalWeight) {
// add it to your weights array, and keep track of the new current weight
myWeights.push(gymWeights[i]);
currentWeight += (gymWeights[i].lbs * 2)
}
}
var nicelyFormattedText = "Place these weights on each side of the " + barWeight + "lb bar, in order to achieve a weight of: " + currentWeight;
// put the nicely formatted string into the DOM
document.getElementById("resultInfo").innerText = nicelyFormattedText;
// Clear it out first.
document.getElementById("weightGraphics").innerHTML = ""
// Validation Not enough weight to put anything on the bar
if (goalWeight < barWeight + (gymWeights[0].lbs * 2)) {
document.getElementById("weightGraphics").innerText = "(No weights needed)"
}
else {
for (i = 0; i < myWeights.length; i++) {
// add image
var container = document.createElement("div")
container.setAttribute("class", "weightContainer")
var elem = document.createElement("img")
elem.setAttribute("src", myWeights[i].icon)
elem.setAttribute("height", myWeights[i].size)
elem.setAttribute("width", myWeights[i].size)
elem.setAttribute("alt", myWeights[i].lbs)
container.appendChild(elem)
var text = document.createElement("div")
text.setAttribute("class", "bottom-left")
text.innerText = myWeights[i].lbs
container.appendChild(text)
document.getElementById("weightGraphics").appendChild(container)
}
}
console.log(myWeights)
return false;
}
</script>
<script src="https://code.jquery.com/jquery-3.5.1.slim.min.js"
integrity="sha384-DfXdz2htPH0lsSSs5nCTpuj/zy4C+OGpamoFVy38MVBnE+IbbVYUew+OrCXaRkfj"
crossorigin="anonymous"></script>
<script src="https://cdn.jsdelivr.net/npm/[email protected]/dist/umd/popper.min.js"
integrity="sha384-9/reFTGAW83EW2RDu2S0VKaIzap3H66lZH81PoYlFhbGU+6BZp6G7niu735Sk7lN"
crossorigin="anonymous"></script>
<script src="https://stackpath.bootstrapcdn.com/bootstrap/4.5.2/js/bootstrap.min.js"
integrity="sha384-B4gt1jrGC7Jh4AgTPSdUtOBvfO8shuf57BaghqFfPlYxofvL8/KUEfYiJOMMV+rV"
crossorigin="anonymous"></script>
</body>
</html>