Change predefine selection
All checks were successful
continuous-integration/drone/push Build is passing
All checks were successful
continuous-integration/drone/push Build is passing
This commit is contained in:
parent
82ef901b9d
commit
db4b93ba6f
29
index.html
29
index.html
@ -11,24 +11,16 @@
|
||||
<script src="repTypes.js"></script>
|
||||
<link href="style.css" rel="stylesheet" type="text/css">
|
||||
<h1>Workout</h1>
|
||||
<p>
|
||||
Today's workout muscle group:
|
||||
<select id="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 id="workout-type">
|
||||
<option value="strength">Strength</option>
|
||||
<option value="strength-endurance">Strength-Endurance</option>
|
||||
</select>
|
||||
</p>
|
||||
|
||||
<p>
|
||||
Today's exercises:
|
||||
<div id="workout-selection-area">
|
||||
<h2>Load Predefined Workout</h2>
|
||||
<button class="loadPredefinedWorkout" id="load-leg-strength">Legs Strength</button>
|
||||
<button class="loadPredefinedWorkout" id="load-body-strength">Upper Body Strength</button>
|
||||
<button class="loadPredefinedWorkout" id="load-leg-hyp">Legs Hypertrophy</button>
|
||||
<button class="loadPredefinedWorkout" id="load-chest-hyp">Chest-Triceps Hypertrophy</button>
|
||||
<button class="loadPredefinedWorkout" id="load-back-hyp">Back-Biceps Hypertrophy</button>
|
||||
</div>
|
||||
<h2>Today's Workout</h2>
|
||||
<ul id="exercise-list">
|
||||
<li> Exercise:
|
||||
<select name="exercise-type" id="exercise-type-1">
|
||||
@ -41,14 +33,13 @@
|
||||
<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>
|
||||
<option value="tripledrop5-8">Triple 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>
|
||||
|
||||
|
38
main.js
38
main.js
@ -21,6 +21,10 @@ function updateExercises() {
|
||||
weight: element.childNodes[8].value
|
||||
});
|
||||
}
|
||||
if (exercisesEdited(exercises[t])) {
|
||||
var workoutSelectionArea = document.getElementById("workout-selection-area");
|
||||
workoutSelectionArea.innerHTML = '';
|
||||
}
|
||||
localStorage.setItem("exercises", JSON.stringify(exercises));
|
||||
}
|
||||
|
||||
@ -122,22 +126,17 @@ addExerciseButton.onclick = () => {
|
||||
setExercises(exercises);
|
||||
}
|
||||
|
||||
var muscleGroupSelector = document.getElementById("workout-muscle");
|
||||
muscleGroupSelector.onchange = loadPredefinedWorkouts;
|
||||
var workoutTypeSelector = document.getElementById("workout-type");
|
||||
workoutTypeSelector.onchange = loadPredefinedWorkouts;
|
||||
|
||||
function loadPredefinedWorkouts() {
|
||||
function loadPredefinedWorkouts(workoutType) {
|
||||
if (!exercisesEdited(exercises[t])) {
|
||||
switch ((muscleGroupSelector.value, workoutTypeSelector.value)) {
|
||||
case ("leg", "strength"):
|
||||
switch (workoutType) {
|
||||
case ("load-leg-strength"):
|
||||
exercises[t] = [
|
||||
{ exerciseType: "Squat", repetitionType: "2-4", reps: "", weight: "" },
|
||||
{ exerciseType: "Leg Press", repetitionType: "2-4", reps: "", weight: "" },
|
||||
{ exerciseType: "Deadlift", repetitionType: "2-4", reps: "", weight: "" }
|
||||
];
|
||||
break;
|
||||
case ("back-biceps", "strength-endurance"):
|
||||
case ("load-back-hyp"):
|
||||
exercises[t] = [
|
||||
{ exerciseType: "One Arm Dumbbell Row", repetitionType: "3-5", reps: "", weight: "" },
|
||||
{ exerciseType: "Lat Pulldown Wide", repetitionType: "2-4", reps: "", weight: "" },
|
||||
@ -147,7 +146,17 @@ function loadPredefinedWorkouts() {
|
||||
{ exerciseType: "Biceps Curl", repetitionType: "pyramid", reps: "", weight: "" }
|
||||
];
|
||||
break;
|
||||
case ("leg", "strength-endurance"):
|
||||
case ("load-body-strength"):
|
||||
exercises[t] = [
|
||||
{ exerciseType: "Bench Press", repetitionType: "2-4", reps: "", weight: "" },
|
||||
{ exerciseType: "Cable Row w/ Over Grip", repetitionType: "2-4", reps: "", weight: "" },
|
||||
{ exerciseType: "Dips", repetitionType: "3-5", reps: "", weight: "" },
|
||||
{ exerciseType: "Under Grip Pull Up", repetitionType: "3-5", reps: "", weight: "" },
|
||||
{ exerciseType: "Hammer Curls", repetitionType: "3-5", reps: "", weight: "" },
|
||||
{ exerciseType: "Supported Biceps Curl", repetitionType: "3-5", reps: "", weight: "" }
|
||||
];
|
||||
break;
|
||||
case ("load-leg-hyp"):
|
||||
exercises[t] = [
|
||||
{ exerciseType: "Leg Press", repetitionType: "5-8", reps: "", weight: "" },
|
||||
{ exerciseType: "Squat", repetitionType: "8-12", reps: "", weight: "" },
|
||||
@ -156,7 +165,7 @@ function loadPredefinedWorkouts() {
|
||||
{ exerciseType: "Standing Calf Raises", repetitionType: "8-12", reps: "", weight: "" }
|
||||
];
|
||||
break;
|
||||
case ("chest-triceps", "strength-endurance"):
|
||||
case ("load-chest-hyp"):
|
||||
exercises[t] = [
|
||||
{ exerciseType: "Bench Press", repetitionType: "3-5", reps: "", weight: "" },
|
||||
{ exerciseType: "Incline Bench Press", repetitionType: "5-8", reps: "", weight: "" },
|
||||
@ -174,13 +183,18 @@ function loadPredefinedWorkouts() {
|
||||
}
|
||||
}
|
||||
|
||||
var predefinedWorkoutButtons = document.querySelectorAll("button.loadPredefinedWorkout");
|
||||
for (let button of predefinedWorkoutButtons) {
|
||||
button.onclick = () => { loadPredefinedWorkouts(button.id); }
|
||||
}
|
||||
|
||||
setExercises(exercises[t]);
|
||||
|
||||
var body = document.querySelector("body");
|
||||
var pre = document.createElement("pre");
|
||||
const jsn = JSON.parse(localStorage.getItem("exercises"));
|
||||
var s = "";
|
||||
for (let [date, value] of Object.entries(jsn)) {
|
||||
for (let [date, value] of Object.entries(jsn).sort().reverse()) {
|
||||
s += date + "\n";
|
||||
for (let exercise of value) {
|
||||
s += " " + exercise.exerciseType + ": " + exercise.weight + "kg x " + exercise.reps + " of " + exercise.repetitionType + "\n";
|
||||
|
Loading…
Reference in New Issue
Block a user