initial commit

This commit is contained in:
Jesko Dujmovic 2021-10-18 21:26:39 +02:00
commit 3dd31e4b35
4 changed files with 154 additions and 0 deletions

36
exerciseTypes.js Normal file
View File

@ -0,0 +1,36 @@
var exerciseTypes = [
{ name: "One Arm Dumbbell Row", tags: ["back"] },
{ name: "Lat Pulldown Wide", tags: ["back"] },
{ name: "Lat Pulldown Narrow", tags: ["back"] },
{ name: "Cable Row w/ Wide Neutral Grip", tags: ["back"] },
{ name: "Cable Row w/ Neutral Grip", tags: ["back"] },
{ name: "Cable Row w/ Over Grip", tags: ["back"] },
{ name: "Rear Deltoid Machine", tags: ["back"] },
{ name: "Biceps Curl", tags: ["biceps"] },
{ name: "Hammer Curl", tags: ["biceps"] },
{ name: "Military Press", tags: [] },
{ name: "Bench Press", tags: [] },
{ name: "Bench Press Dumbbell", tags: [] },
{ name: "Butterfly", tags: [] },
/*
"Incline Bench Press",
"Incline Bench Press Dumbbell",
"Leg Press",
"Squat",
"Leg Curl",
"Leg Extension",
"Dips",
"Under Grip Pull Up",
"Over Grip Pull Up",
"Cable Biceps Curl",
"Supported Biceps Curl",
"Cable Triceps",
"Deadlift",
"Standing Calf Raises",
"Face Pull",
"Machine Shoulder Press",
"Dumbbell Shoulder Press",
"Machine Bench Press",
"21s"
*/
];

56
index.html Normal file
View File

@ -0,0 +1,56 @@
<!DOCTYPE html>
<html>
<head>
<meta content="text/html;charset=utf-8" http-equiv="Content-Type">
<meta content="utf-8" http-equiv="encoding">
</head>
<body>
<script src="exerciseTypes.js"></script>
<script src="repTypes.js"></script>
<h1>Workout</h1>
<p>
Today's workout muscle group:
<select name="workout-muscle">
<option value="chest-triceps">Chest, Triceps</option>
<option value="back-biceps">Back, Biceps</option>
<option value="leg">Leg</option>
</select>
</p>
<p>
Today's workout type:
<select name="workout-type">
<option value="strength">Strength</option>
<option value="strengthen-durance">Strength-Endurance</option>
</select>
</p>
<p>
Today's exercises:
<ul id="exercise-list">
<li> Exercise:
<select name="exercise-type" id="exercise-type-1">
</select>
<select name="repetition-type" id="repetition-type-1">
<option value="2-4">2-4</option>
<option value="3-5">3-5</option>
<option value="5-8">5-8</option>
<option value="8-12">8-12</option>
<option value="12-15">12-15</option>
<option value="15-20">15-20</option>
<option value="pyramid">Pyramid</option>
<option value="drop5-8">Drop Set 5-8</option>
</select>
Reps done: <input type="number" name="repetitions-done" id="repetitions-done-1" min="0" max="100">
Weight done: <input type="number" name="weight-done" id="weight-done-1" min="0" max="2000">
</li>
</ul>
<button id="add-exercise">Add exercise</button>
</p>
<script src="main.js"></script>
</body>
</html>

52
main.js Normal file
View File

@ -0,0 +1,52 @@
exercises = [
{ exerciseType: exerciseTypes[0], repetitionType: "2-4", reps: "", weight: "2" },
{ exerciseType: exerciseTypes[0], repetitionType: "2-4", reps: "3", weight: "" }
]
var exerciseList = document.getElementById("exercise-list");
function setExercises(exercises) {
exerciseList.innerHTML = ''
exercises.forEach(element => {
var li = document.createElement("li");
li.appendChild(document.createTextNode("Exercise "));
var exType = document.createElement("select");
exerciseTypes.forEach(exercise => {
exType.add(new Option(exercise.name, exercise.name));
});
li.appendChild(exType);
var repType = document.createElement("select");
repetitionTypes.forEach(repetitionType => {
repType.add(new Option(repetitionType, repetitionType));
});
li.appendChild(repType);
li.appendChild(document.createTextNode("Reps done: "));
var reps = document.createElement("input");
reps.setAttribute("type", "number");
reps.value = element.reps;
li.appendChild(reps);
li.appendChild(document.createTextNode("Weight done: "));
var weight = document.createElement("input");
weight.setAttribute("type", "number");
weight.value = element.weight;
li.appendChild(weight);
exerciseList.appendChild(li);
});
}
function exercisesEdited() {
document.querySelectorAll("#exercise-list > li > input").forEach(element => {
if (element.value != "" && element.value != null) {
console.log("b");
}
});
return false;
}
var addExerciseButton = document.getElementById("add-exercise");
addExerciseButton.onclick = () => {
exercises.push({ exerciseType: "", repetitionType: "", reps: "", weight: "" });
setExercises(exercises);
}
setExercises(exercises);
console.log(exercisesEdited());

10
repTypes.js Normal file
View File

@ -0,0 +1,10 @@
repetitionTypes = [
"2-4",
"3-5",
"5-8",
"8-12",
"12-15",
"15-20",
"Pyramid",
"Drop Set 5-8"
]