Compare commits

...

16 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
Jesko Dujmovic
82ef901b9d Merge branch 'main' of https://git.leafbla.de/Jesko/workout-basic into main
All checks were successful
continuous-integration/drone/push Build is passing
2021-10-20 09:10:44 +02:00
Jesko Dujmovic
e69b7df319 Fix empty days & add workouts 2021-10-20 09:10:41 +02:00
5517048cd0
Fix pipeline also adding .git folder
All checks were successful
continuous-integration/drone/push Build is passing
2021-10-19 22:56:17 +02:00
ebfd52308d
Add drone config
All checks were successful
continuous-integration/drone/push Build is passing
2021-10-19 22:52:42 +02:00
5 changed files with 142 additions and 85 deletions

14
.drone.yml Normal file
View File

@ -0,0 +1,14 @@
kind: pipeline
name: default
steps:
- name: deploy-oreburgh
image: registry.eterna.leafbla.de/pelipper
settings:
ssh_key:
from_secret: rsync_key
source: "--exclude .git --exclude .drone.yml ."
destination: pelipper@oreburgh.leafbla.de:/srv/docker/nginx/html/gains/
image_pull_secrets:
- dockerconfig

View File

@ -1,34 +1,48 @@
var exerciseTypes = [
{ name: "One Arm Dumbbell Row", tags: ["back"] },
{ name: "Lat Pulldown Wide", tags: ["back"] },
{ name: "Lat Pulldown Narrow", tags: ["back"] },
{ name: "Row w/ One Arm Dumbbell", 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: "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: "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: "Hammer Curl", tags: ["biceps"] },
{ name: "Military Press", tags: [] },
{ 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: "Supported Biceps Curl", tags: ["biceps"] },
{ name: "Deadlift", tags: [] },
{ name: "Standing Calf Raises", tags: [] },
{ name: "Face Pull", tags: [] },
{ name: "Machine Shoulder Press", tags: [] },
{ name: "Dumbbell Shoulder Press", tags: [] },
{ name: "Machine Bench Press", tags: [] },
{ name: "21s", tags: [] }
{ name: "Standing Calf Raises", tags: ["leg"] },
{ name: "Hamstring Curl", tags: ["leg"] },
{ name: "Leg Press", tags: ["leg"] },
{ name: "Squat", tags: ["leg"] },
{ name: "Leg Curl", tags: ["leg"] },
{ name: "Leg Extension", tags: ["leg"] },
{ name: "Other", tags: [] },
];

View File

@ -9,25 +9,16 @@
<body>
<script src="exerciseTypes.js"></script>
<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="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">
<li> Exercise:
<select name="exercise-type" id="exercise-type-1">
@ -40,14 +31,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>

115
main.js
View File

@ -5,7 +5,7 @@ const exercisesString = localStorage.getItem("exercises");
if (exercisesString != null) {
exercises = JSON.parse(exercisesString);
}
if (exercises[t] != null) {
if (exercises[t] == null) {
exercises[t] = [];
}
@ -15,13 +15,19 @@ function updateExercises() {
exercises[t] = [];
for (const element of exerciseList) {
exercises[t].push({
exerciseType: element.childNodes[3].value,
repetitionType: element.childNodes[4].value,
reps: element.childNodes[6].value,
weight: element.childNodes[8].value
exerciseType: element.childNodes[1].childNodes[1].value,
repetitionType: element.childNodes[1].childNodes[2].value,
reps: element.childNodes[2].childNodes[1].value,
weight: element.childNodes[3].childNodes[1].value
});
}
localStorage.setItem("exercises", JSON.stringify(exercises));
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));
}
}
function swap_right(i) {
@ -36,6 +42,7 @@ function setExercises() {
exerciseList.innerHTML = ''
for (let i = 0; i < exercises[t].length; i++) {
var li = document.createElement("li");
var upDownDiv = document.createElement("div");
// Up Button
var upButton = document.createElement("button");
upButton.textContent = "▲"
@ -45,7 +52,7 @@ function setExercises() {
setExercises(exercises[t]);
localStorage.setItem("exercises", JSON.stringify(exercises));
};
li.appendChild(upButton);
upDownDiv.appendChild(upButton);
// Down Button
var downButton = document.createElement("button");
downButton.textContent = "▼"
@ -55,8 +62,10 @@ function setExercises() {
setExercises(exercises[t]);
localStorage.setItem("exercises", JSON.stringify(exercises));
};
li.appendChild(downButton);
li.appendChild(document.createTextNode("Exercise "));
upDownDiv.appendChild(downButton);
li.appendChild(upDownDiv);
var exerciseSelectorDiv = document.createElement("div");
exerciseSelectorDiv.appendChild(document.createTextNode("Exercise "));
// Select Exercise Type
var exType = document.createElement("select");
exType.onchange = updateExercises;
@ -64,7 +73,7 @@ function setExercises() {
exType.add(new Option(exercise.name, exercise.name));
});
exType.value = exercises[t][i].exerciseType
li.appendChild(exType);
exerciseSelectorDiv.appendChild(exType);
// Select Repetition Type
var repType = document.createElement("select");
repetitionTypes.forEach(repetitionType => {
@ -72,19 +81,24 @@ function setExercises() {
});
repType.onchange = updateExercises;
repType.value = exercises[t][i].repetitionType
li.appendChild(repType);
li.appendChild(document.createTextNode("Reps done: "));
exerciseSelectorDiv.appendChild(repType);
li.appendChild(exerciseSelectorDiv);
var repDiv = document.createElement("div");
repDiv.appendChild(document.createTextNode("Reps done: "));
var reps = document.createElement("input");
reps.setAttribute("type", "number");
reps.value = exercises[t][i].reps;
reps.onchange = updateExercises;
li.appendChild(reps);
li.appendChild(document.createTextNode("Weight done: "));
repDiv.appendChild(reps);
li.appendChild(repDiv);
var weightDiv = document.createElement("div");
weightDiv.appendChild(document.createTextNode("Weight done: "));
var weight = document.createElement("input");
weight.setAttribute("type", "number");
weight.value = exercises[t][i].weight;
weight.onchange = updateExercises;
li.appendChild(weight);
weightDiv.appendChild(weight);
li.appendChild(weightDiv);
// Delete Button
var deleteButton = document.createElement("button");
deleteButton.textContent = "Delete"
@ -122,29 +136,39 @@ 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 ("monday"):
exercises[t] = [
{ exerciseType: "Squat", repetitionType: "2-4", reps: "", weight: "" },
{ exerciseType: "Leg Press", repetitionType: "2-4", reps: "", weight: "" },
{ exerciseType: "Deadlift", repetitionType: "2-4", reps: "", weight: "" }
{ exerciseType: "Squat", repetitionType: "3-5", reps: "", weight: "" },
{ exerciseType: "Military Press", repetitionType: "5-8", 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;
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: "" }
{ exerciseType: "Bench Press", repetitionType: "3-5", reps: "", weight: "" },
{ exerciseType: "Cable Row w/ Neutral Grip", repetitionType: "5-8", reps: "", weight: "" },
{ exerciseType: "Leg Press", repetitionType: "8-12", reps: "", weight: "" },
{ exerciseType: "Shoulder Press Machine", repetitionType: "5-8", reps: "", weight: "" },
{ exerciseType: "Lat Pulldown Wide", repetitionType: "8-12", 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;
default:
@ -155,17 +179,26 @@ 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)) {
s += date + "\n";
for (let exercise of value) {
s += " " + exercise.exerciseType + ": " + exercise.weight + "kg x " + exercise.reps + " of " + exercise.repetitionType + "\n";
if (jsn != null) {
var s = "";
for (let [date, value] of Object.entries(jsn).sort().reverse()) {
s += date + "\n";
for (let exercise of value) {
if (exercise.reps != "" || exercise.weight != "") {
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);
}

6
style.css Normal file
View File

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