Compare commits

..

No commits in common. "main" and "dfdb88ec5433e48dd03f36eaa5b9f3e844cb9d67" have entirely different histories.

5 changed files with 85 additions and 142 deletions

View File

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

View File

@ -9,16 +9,25 @@
<body> <body>
<script src="exerciseTypes.js"></script> <script src="exerciseTypes.js"></script>
<script src="repTypes.js"></script> <script src="repTypes.js"></script>
<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>
<div id="workout-selection-area"> <p>
<h2>Load Predefined Workout</h2> Today's exercises:
<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">
@ -31,13 +40,14 @@
<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="tripledrop5-8">Triple Drop Set 5-8</option> <option value="drop5-8">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>

105
main.js
View File

@ -5,7 +5,7 @@ const exercisesString = localStorage.getItem("exercises");
if (exercisesString != null) { if (exercisesString != null) {
exercises = JSON.parse(exercisesString); exercises = JSON.parse(exercisesString);
} }
if (exercises[t] == null) { if (exercises[t] != null) {
exercises[t] = []; exercises[t] = [];
} }
@ -15,19 +15,13 @@ 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[1].childNodes[1].value, exerciseType: element.childNodes[3].value,
repetitionType: element.childNodes[1].childNodes[2].value, repetitionType: element.childNodes[4].value,
reps: element.childNodes[2].childNodes[1].value, reps: element.childNodes[6].value,
weight: element.childNodes[3].childNodes[1].value weight: element.childNodes[8].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) {
@ -42,7 +36,6 @@ 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 = "▲"
@ -52,7 +45,7 @@ function setExercises() {
setExercises(exercises[t]); setExercises(exercises[t]);
localStorage.setItem("exercises", JSON.stringify(exercises)); localStorage.setItem("exercises", JSON.stringify(exercises));
}; };
upDownDiv.appendChild(upButton); li.appendChild(upButton);
// Down Button // Down Button
var downButton = document.createElement("button"); var downButton = document.createElement("button");
downButton.textContent = "▼" downButton.textContent = "▼"
@ -62,10 +55,8 @@ function setExercises() {
setExercises(exercises[t]); setExercises(exercises[t]);
localStorage.setItem("exercises", JSON.stringify(exercises)); localStorage.setItem("exercises", JSON.stringify(exercises));
}; };
upDownDiv.appendChild(downButton); li.appendChild(downButton);
li.appendChild(upDownDiv); li.appendChild(document.createTextNode("Exercise "));
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;
@ -73,7 +64,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
exerciseSelectorDiv.appendChild(exType); li.appendChild(exType);
// Select Repetition Type // Select Repetition Type
var repType = document.createElement("select"); var repType = document.createElement("select");
repetitionTypes.forEach(repetitionType => { repetitionTypes.forEach(repetitionType => {
@ -81,24 +72,19 @@ function setExercises() {
}); });
repType.onchange = updateExercises; repType.onchange = updateExercises;
repType.value = exercises[t][i].repetitionType repType.value = exercises[t][i].repetitionType
exerciseSelectorDiv.appendChild(repType); li.appendChild(repType);
li.appendChild(exerciseSelectorDiv); li.appendChild(document.createTextNode("Reps done: "));
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;
repDiv.appendChild(reps); li.appendChild(reps);
li.appendChild(repDiv); li.appendChild(document.createTextNode("Weight done: "));
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;
weightDiv.appendChild(weight); li.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"
@ -136,39 +122,29 @@ addExerciseButton.onclick = () => {
setExercises(exercises); setExercises(exercises);
} }
function loadPredefinedWorkouts(workoutType) { var muscleGroupSelector = document.getElementById("workout-muscle");
muscleGroupSelector.onchange = loadPredefinedWorkouts;
var workoutTypeSelector = document.getElementById("workout-type");
workoutTypeSelector.onchange = loadPredefinedWorkouts;
function loadPredefinedWorkouts() {
if (!exercisesEdited(exercises[t])) { if (!exercisesEdited(exercises[t])) {
switch (workoutType) { switch ((muscleGroupSelector.value, workoutTypeSelector.value)) {
case ("monday"): case ("leg", "strength"):
exercises[t] = [ exercises[t] = [
{ exerciseType: "Squat", repetitionType: "3-5", reps: "", weight: "" }, { exerciseType: "Squat", repetitionType: "2-4", reps: "", weight: "" },
{ exerciseType: "Military Press", repetitionType: "5-8", reps: "", weight: "" }, { exerciseType: "Leg Press", repetitionType: "2-4", reps: "", weight: "" },
{ exerciseType: "Pull Up Under Grip", repetitionType: "8-12", reps: "", weight: "" }, { exerciseType: "Deadlift", repetitionType: "2-4", 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 ("wednesday"): case ("back-biceps", "strength-endurance"):
exercises[t] = [ exercises[t] = [
{ exerciseType: "Bench Press", repetitionType: "3-5", reps: "", weight: "" }, { exerciseType: "One Arm Dumbbell Row", repetitionType: "3-5", reps: "", weight: "" },
{ exerciseType: "Cable Row w/ Neutral Grip", repetitionType: "5-8", reps: "", weight: "" }, { exerciseType: "Lat Pulldown Wide", repetitionType: "2-4", reps: "", weight: "" },
{ exerciseType: "Leg Press", repetitionType: "8-12", reps: "", weight: "" }, { exerciseType: "Lat Pulldown Narrow", repetitionType: "2-4", reps: "", weight: "" },
{ exerciseType: "Shoulder Press Machine", repetitionType: "5-8", reps: "", weight: "" }, { exerciseType: "Cable Row w/ Wide Neutral Grip", repetitionType: "2-4", reps: "", weight: "" },
{ exerciseType: "Lat Pulldown Wide", repetitionType: "8-12", reps: "", weight: "" }, { exerciseType: "Rear Deltoid Machine", repetitionType: "2-4", reps: "", weight: "" },
{ exerciseType: "Side Raise", repetitionType: "8-12", reps: "", weight: "" } { exerciseType: "Biceps Curl", repetitionType: "pyramid", 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:
@ -179,26 +155,17 @@ function loadPredefinedWorkouts(workoutType) {
} }
} }
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"));
if (jsn != null) { var s = "";
var s = ""; for (let [date, value] of Object.entries(jsn)) {
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,6 +0,0 @@
body {
font-size: larger;
}
div {
display: inline-block;
}