Compare commits

...

12 Commits

Author SHA1 Message Date
Jesko Dujmovic
f442b8af1e yoyoyo 2022-10-18 20:23:59 +02:00
Jesko Dujmovic
ee3f32b6cb it just can't stop improving
All checks were successful
continuous-integration/drone/push Build is passing
2021-11-03 22:45:52 +01:00
Jesko Dujmovic
e75ffc06e5 change
All checks were successful
continuous-integration/drone/push Build is passing
2021-10-29 09:56:50 +02:00
Jesko Dujmovic
3e264237b8 Merge branch 'main' of git.leafbla.de:Jesko/workout-basic into main
All checks were successful
continuous-integration/drone/push Build is passing
2021-10-25 20:31:53 +02:00
Jesko Dujmovic
164c03102f trying to fix mobile button 2021-10-25 20:31:50 +02:00
Jesko Dujmovic
f380302a32 add other
All checks were successful
continuous-integration/drone/push Build is passing
2021-10-23 20:31:18 +02:00
Jesko Dujmovic
8c60c6e390 exercise modifications
All checks were successful
continuous-integration/drone/push Build is passing
2021-10-23 20:28:37 +02:00
Jesko Dujmovic
4da5ca8dbf change
All checks were successful
continuous-integration/drone/push Build is passing
2021-10-22 19:04:56 +02:00
Jesko Dujmovic
3ad6e29407 fix hammer curl
All checks were successful
continuous-integration/drone/push Build is passing
2021-10-22 19:02:14 +02:00
Jesko Dujmovic
118595a072 change
All checks were successful
continuous-integration/drone/push Build is passing
2021-10-22 18:54:48 +02:00
Jesko Dujmovic
b46ae02bdf grouping exercises
All checks were successful
continuous-integration/drone/push Build is passing
2021-10-21 19:29:12 +02:00
Jesko Dujmovic
db4b93ba6f Change predefine selection
All checks were successful
continuous-integration/drone/push Build is passing
2021-10-21 18:59:20 +02:00
4 changed files with 122 additions and 103 deletions

View File

@@ -1,35 +1,48 @@
var exerciseTypes = [ var exerciseTypes = [
{ name: "One Arm Dumbbell Row", tags: ["back"] }, { name: "Row w/ One Arm Dumbbell", 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/ Wide Neutral Grip", tags: ["back"] },
{ name: "Cable Row w/ Neutral Grip", tags: ["back"] }, { name: "Cable Row w/ Neutral Grip", tags: ["back"] },
{ name: "Cable Row w/ Over Grip", tags: ["back"] }, { name: "Cable Row w/ Over Grip", tags: ["back"] },
{ name: "Machine Row w/ Over Grip", tags: ["back"] },
{ name: "Machine Row w/ Neutral Grip", tags: ["back"] },
{ name: "Machine Row w/ Under Grip", tags: ["back"] },
{ name: "Lat Pulldown Wide", tags: ["back"] },
{ name: "Lat Pulldown Narrow", tags: ["back"] },
{ name: "Lat Pulldown Chinese", tags: ["back"] },
{ name: "Rear Deltoid Machine", tags: ["back"] }, { name: "Rear Deltoid Machine", tags: ["back"] },
{ name: "Face Pull", tags: ["back"] },
{ name: "Pull Up Over Grip", tags: [] },
{ name: "Pull Up Under Grip", tags: [] },
{ name: "Side Raise", tags: ["shoulder"] },
{ name: "Military Press", tags: ["shoulder", "triceps"] },
{ name: "Shoulder Press Machine", tags: ["shoulder", "triceps"] },
{ name: "Shoulder Press Dumbbell", tags: ["shoulder", "triceps"] },
{ name: "Incline Bench Press", tags: ["chest", "triceps"] },
{ name: "Incline Bench Press Dumbbell", tags: ["chest", "triceps"] },
{ name: "Bench Press", tags: ["chest", "triceps"] },
{ name: "Bench Press Dumbbell", tags: ["chest", "triceps"] },
{ name: "Bench Press Machine", tags: ["chest"] },
{ name: "Butterfly", tags: ["chest"] },
{ name: "Reverse Butterfly", tags: ["back"] },
{ name: "Dips", tags: ["chest", "triceps"] },
{ name: "Triceps Cable Over Head Rope", tags: ["triceps"] },
{ name: "Triceps Cable Over Head Bar", tags: ["triceps"] },
{ name: "Triceps Extension Cable Rope Triceps", tags: ["triceps"] },
{ name: "Triceps Extension Cable Bar Triceps", tags: ["triceps"] },
{ name: "Triceps Machine", tags: ["triceps"] },
{ name: "Side Lateral Raise", tags: [] },
{ name: "Biceps Curl Cable", tags: ["biceps"] },
{ name: "Biceps Machine", tags: ["biceps"] },
{ name: "21s", tags: ["biceps"] },
{ name: "Biceps Curl", tags: ["biceps"] }, { name: "Biceps Curl", tags: ["biceps"] },
{ name: "Hammer Curl", tags: ["biceps"] }, { name: "Hammer Curl", tags: ["biceps"] },
{ name: "Military Press", tags: [] }, { name: "Supported Biceps Curl", tags: ["biceps"] },
{ name: "Bench Press", tags: [] },
{ name: "Bench Press Dumbbell", tags: [] },
{ name: "Butterfly", tags: [] },
{ name: "Incline Bench Press", tags: [] },
{ name: "Incline Bench Press Dumbbell", tags: [] },
{ name: "Leg Press", tags: [] },
{ name: "Squat", tags: [] },
{ name: "Leg Curl", tags: [] },
{ name: "Leg Extension", tags: [] },
{ name: "Dips", tags: [] },
{ name: "Under Grip Pull Up", tags: [] },
{ name: "Over Grip Pull Up", tags: [] },
{ name: "Cable Biceps Curl", tags: [] },
{ name: "Supported Biceps Curl", tags: [] },
{ name: "Cable Triceps", tags: [] },
{ name: "Deadlift", tags: [] }, { name: "Deadlift", tags: [] },
{ name: "Standing Calf Raises", tags: [] }, { name: "Standing Calf Raises", tags: ["leg"] },
{ name: "Face Pull", tags: [] }, { name: "Hamstring Curl", tags: ["leg"] },
{ name: "Machine Shoulder Press", tags: [] }, { name: "Leg Press", tags: ["leg"] },
{ name: "Dumbbell Shoulder Press", tags: [] }, { name: "Squat", tags: ["leg"] },
{ name: "Side Lateral Raise", tags: [] }, { name: "Leg Curl", tags: ["leg"] },
{ name: "Machine Bench Press", tags: [] }, { name: "Leg Extension", tags: ["leg"] },
{ name: "21s", tags: [] } { name: "Other", tags: [] },
]; ];

View File

@@ -11,24 +11,14 @@
<script src="repTypes.js"></script> <script src="repTypes.js"></script>
<link href="style.css" rel="stylesheet" type="text/css"> <link href="style.css" rel="stylesheet" type="text/css">
<h1>Workout</h1> <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> <div id="workout-selection-area">
Today's exercises: <h2>Load Predefined Workout</h2>
<button class="loadPredefinedWorkout" id="monday">Monday</button>
<button class="loadPredefinedWorkout" id="wednesday">Wednesday</button>
<button class="loadPredefinedWorkout" id="friday">Friday</button>
</div>
<h2>Today's Workout</h2>
<ul id="exercise-list"> <ul id="exercise-list">
<li> Exercise: <li> Exercise:
<select name="exercise-type" id="exercise-type-1"> <select name="exercise-type" id="exercise-type-1">
@@ -41,14 +31,13 @@
<option value="12-15">12-15</option> <option value="12-15">12-15</option>
<option value="15-20">15-20</option> <option value="15-20">15-20</option>
<option value="pyramid">Pyramid</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> </select>
Reps done: <input type="number" name="repetitions-done" id="repetitions-done-1" min="0" max="100"> 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"> Weight done: <input type="number" name="weight-done" id="weight-done-1" min="0" max="2000">
</li> </li>
</ul> </ul>
<button id="add-exercise">Add exercise</button> <button id="add-exercise">Add exercise</button>
</p>
<script src="main.js"></script> <script src="main.js"></script>

120
main.js
View File

@@ -15,13 +15,19 @@ function updateExercises() {
exercises[t] = []; exercises[t] = [];
for (const element of exerciseList) { for (const element of exerciseList) {
exercises[t].push({ exercises[t].push({
exerciseType: element.childNodes[3].value, exerciseType: element.childNodes[1].childNodes[1].value,
repetitionType: element.childNodes[4].value, repetitionType: element.childNodes[1].childNodes[2].value,
reps: element.childNodes[6].value, reps: element.childNodes[2].childNodes[1].value,
weight: element.childNodes[8].value weight: element.childNodes[3].childNodes[1].value
}); });
} }
if (exercisesEdited(exercises[t])) {
var workoutSelectionArea = document.getElementById("workout-selection-area");
workoutSelectionArea.innerHTML = '';
}
if (exercises[t] != null && exercises[t] != {}) {
localStorage.setItem("exercises", JSON.stringify(exercises)); localStorage.setItem("exercises", JSON.stringify(exercises));
}
} }
function swap_right(i) { function swap_right(i) {
@@ -36,6 +42,7 @@ function setExercises() {
exerciseList.innerHTML = '' exerciseList.innerHTML = ''
for (let i = 0; i < exercises[t].length; i++) { for (let i = 0; i < exercises[t].length; i++) {
var li = document.createElement("li"); var li = document.createElement("li");
var upDownDiv = document.createElement("div");
// Up Button // Up Button
var upButton = document.createElement("button"); var upButton = document.createElement("button");
upButton.textContent = "▲" upButton.textContent = "▲"
@@ -45,7 +52,7 @@ function setExercises() {
setExercises(exercises[t]); setExercises(exercises[t]);
localStorage.setItem("exercises", JSON.stringify(exercises)); localStorage.setItem("exercises", JSON.stringify(exercises));
}; };
li.appendChild(upButton); upDownDiv.appendChild(upButton);
// Down Button // Down Button
var downButton = document.createElement("button"); var downButton = document.createElement("button");
downButton.textContent = "▼" downButton.textContent = "▼"
@@ -55,8 +62,10 @@ function setExercises() {
setExercises(exercises[t]); setExercises(exercises[t]);
localStorage.setItem("exercises", JSON.stringify(exercises)); localStorage.setItem("exercises", JSON.stringify(exercises));
}; };
li.appendChild(downButton); upDownDiv.appendChild(downButton);
li.appendChild(document.createTextNode("Exercise ")); li.appendChild(upDownDiv);
var exerciseSelectorDiv = document.createElement("div");
exerciseSelectorDiv.appendChild(document.createTextNode("Exercise "));
// Select Exercise Type // Select Exercise Type
var exType = document.createElement("select"); var exType = document.createElement("select");
exType.onchange = updateExercises; exType.onchange = updateExercises;
@@ -64,7 +73,7 @@ function setExercises() {
exType.add(new Option(exercise.name, exercise.name)); exType.add(new Option(exercise.name, exercise.name));
}); });
exType.value = exercises[t][i].exerciseType exType.value = exercises[t][i].exerciseType
li.appendChild(exType); exerciseSelectorDiv.appendChild(exType);
// Select Repetition Type // Select Repetition Type
var repType = document.createElement("select"); var repType = document.createElement("select");
repetitionTypes.forEach(repetitionType => { repetitionTypes.forEach(repetitionType => {
@@ -72,19 +81,24 @@ function setExercises() {
}); });
repType.onchange = updateExercises; repType.onchange = updateExercises;
repType.value = exercises[t][i].repetitionType repType.value = exercises[t][i].repetitionType
li.appendChild(repType); exerciseSelectorDiv.appendChild(repType);
li.appendChild(document.createTextNode("Reps done: ")); li.appendChild(exerciseSelectorDiv);
var repDiv = document.createElement("div");
repDiv.appendChild(document.createTextNode("Reps done: "));
var reps = document.createElement("input"); var reps = document.createElement("input");
reps.setAttribute("type", "number"); reps.setAttribute("type", "number");
reps.value = exercises[t][i].reps; reps.value = exercises[t][i].reps;
reps.onchange = updateExercises; reps.onchange = updateExercises;
li.appendChild(reps); repDiv.appendChild(reps);
li.appendChild(document.createTextNode("Weight done: ")); li.appendChild(repDiv);
var weightDiv = document.createElement("div");
weightDiv.appendChild(document.createTextNode("Weight done: "));
var weight = document.createElement("input"); var weight = document.createElement("input");
weight.setAttribute("type", "number"); weight.setAttribute("type", "number");
weight.value = exercises[t][i].weight; weight.value = exercises[t][i].weight;
weight.onchange = updateExercises; weight.onchange = updateExercises;
li.appendChild(weight); weightDiv.appendChild(weight);
li.appendChild(weightDiv);
// Delete Button // Delete Button
var deleteButton = document.createElement("button"); var deleteButton = document.createElement("button");
deleteButton.textContent = "Delete" deleteButton.textContent = "Delete"
@@ -122,48 +136,39 @@ addExerciseButton.onclick = () => {
setExercises(exercises); setExercises(exercises);
} }
var muscleGroupSelector = document.getElementById("workout-muscle"); function loadPredefinedWorkouts(workoutType) {
muscleGroupSelector.onchange = loadPredefinedWorkouts;
var workoutTypeSelector = document.getElementById("workout-type");
workoutTypeSelector.onchange = loadPredefinedWorkouts;
function loadPredefinedWorkouts() {
if (!exercisesEdited(exercises[t])) { if (!exercisesEdited(exercises[t])) {
switch ((muscleGroupSelector.value, workoutTypeSelector.value)) { switch (workoutType) {
case ("leg", "strength"): case ("monday"):
exercises[t] = [ exercises[t] = [
{ exerciseType: "Squat", repetitionType: "2-4", reps: "", weight: "" }, { exerciseType: "Squat", repetitionType: "3-5", reps: "", weight: "" },
{ exerciseType: "Leg Press", repetitionType: "2-4", reps: "", weight: "" }, { exerciseType: "Military Press", repetitionType: "5-8", reps: "", weight: "" },
{ exerciseType: "Deadlift", repetitionType: "2-4", reps: "", weight: "" } { exerciseType: "Pull Up Under Grip", repetitionType: "8-12", reps: "", weight: "" },
{ exerciseType: "Butterfly", repetitionType: "8-12", reps: "", weight: "" },
{ exerciseType: "Pull Up Under Grip", repetitionType: "8-12", reps: "", weight: "" },
{ exerciseType: "Reverse Butterfly", repetitionType: "8-12", reps: "", weight: "" },
{ exerciseType: "Triceps Machine", repetitionType: "5-8", reps: "", weight: "" },
]; ];
break; break;
case ("back-biceps", "strength-endurance"): case ("wednesday"):
exercises[t] = [
{ exerciseType: "One Arm Dumbbell Row", repetitionType: "3-5", reps: "", weight: "" },
{ exerciseType: "Lat Pulldown Wide", repetitionType: "2-4", reps: "", weight: "" },
{ exerciseType: "Lat Pulldown Narrow", repetitionType: "2-4", reps: "", weight: "" },
{ exerciseType: "Cable Row w/ Wide Neutral Grip", repetitionType: "2-4", reps: "", weight: "" },
{ exerciseType: "Rear Deltoid Machine", repetitionType: "2-4", reps: "", weight: "" },
{ exerciseType: "Biceps Curl", repetitionType: "pyramid", reps: "", weight: "" }
];
break;
case ("leg", "strength-endurance"):
exercises[t] = [
{ exerciseType: "Leg Press", repetitionType: "5-8", reps: "", weight: "" },
{ exerciseType: "Squat", repetitionType: "8-12", reps: "", weight: "" },
{ exerciseType: "Leg Extension", repetitionType: "12-15", reps: "", weight: "" },
{ exerciseType: "Leg Curl", repetitionType: "15-20", reps: "", weight: "" },
{ exerciseType: "Standing Calf Raises", repetitionType: "8-12", reps: "", weight: "" }
];
break;
case ("chest-triceps", "strength-endurance"):
exercises[t] = [ exercises[t] = [
{ exerciseType: "Bench Press", repetitionType: "3-5", reps: "", weight: "" }, { exerciseType: "Bench Press", repetitionType: "3-5", reps: "", weight: "" },
{ exerciseType: "Incline Bench Press", repetitionType: "5-8", reps: "", weight: "" }, { exerciseType: "Cable Row w/ Neutral Grip", repetitionType: "5-8", reps: "", weight: "" },
{ exerciseType: "Machine Shoulder Press", repetitionType: "8-12", reps: "", weight: "" }, { exerciseType: "Leg Press", repetitionType: "8-12", reps: "", weight: "" },
{ exerciseType: "Butterfly", repetitionType: "12-15", reps: "", weight: "" }, { exerciseType: "Shoulder Press Machine", repetitionType: "5-8", reps: "", weight: "" },
{ exerciseType: "Side Lateral Raise", repetitionType: "5-8", reps: "", weight: "" }, { exerciseType: "Lat Pulldown Wide", repetitionType: "8-12", reps: "", weight: "" },
{ exerciseType: "Cable Triceps", repetitionType: "3-5", reps: "", weight: "" } { exerciseType: "Side Raise", repetitionType: "8-12", reps: "", weight: "" }
];
break;
case ("friday"):
exercises[t] = [
{ exerciseType: "Deadlift", repetitionType: "3-5", reps: "", weight: "" },
{ exerciseType: "Incline Bench Press Dumbbell", repetitionType: "5-8", reps: "", weight: "" },
{ exerciseType: "Pull Up Over Grip", repetitionType: "8-12", reps: "", weight: "" },
{ exerciseType: "Dips", repetitionType: "8-12", reps: "", weight: "" },
{ exerciseType: "Machine Row w/ Neutral Grip", repetitionType: "5-8", reps: "", weight: "" },
{ exerciseType: "Face Pull", repetitionType: "8-12", reps: "", weight: "" },
{ exerciseType: "Biceps Curl", repetitionType: "5-8", reps: "", weight: "" }
]; ];
break; break;
default: default:
@@ -174,17 +179,26 @@ function loadPredefinedWorkouts() {
} }
} }
var predefinedWorkoutButtons = document.querySelectorAll("button.loadPredefinedWorkout");
for (let button of predefinedWorkoutButtons) {
button.onclick = () => { loadPredefinedWorkouts(button.id); }
}
setExercises(exercises[t]); setExercises(exercises[t]);
var body = document.querySelector("body"); var body = document.querySelector("body");
var pre = document.createElement("pre"); var pre = document.createElement("pre");
const jsn = JSON.parse(localStorage.getItem("exercises")); const jsn = JSON.parse(localStorage.getItem("exercises"));
var s = ""; if (jsn != null) {
for (let [date, value] of Object.entries(jsn)) { var s = "";
for (let [date, value] of Object.entries(jsn).sort().reverse()) {
s += date + "\n"; s += date + "\n";
for (let exercise of value) { for (let exercise of value) {
if (exercise.reps != "" || exercise.weight != "") {
s += " " + exercise.exerciseType + ": " + exercise.weight + "kg x " + exercise.reps + " of " + exercise.repetitionType + "\n"; s += " " + exercise.exerciseType + ": " + exercise.weight + "kg x " + exercise.reps + " of " + exercise.repetitionType + "\n";
} }
}
}
pre.textContent = s;
body.appendChild(pre);
} }
pre.textContent = s;
body.appendChild(pre);

View File

@@ -1,3 +1,6 @@
body { body {
font-size: larger; font-size: larger;
} }
div {
display: inline-block;
}