diff --git a/app/public/assets/JS/fillPage.js b/app/public/assets/JS/fillPage.js index 0768480..efb7e85 100644 --- a/app/public/assets/JS/fillPage.js +++ b/app/public/assets/JS/fillPage.js @@ -1,19 +1,23 @@ var list = document.querySelector(".listExercises"); -var schedaButtons = document.querySelector("#schedeButtons"); list.innerHTML = ""; -schedaButtons.innerHTML = ""; +var schedaButtons = document.querySelector("#schedeButtons"); +if (schedaButtons.previousElementSibling !== null) { + schedaButtons.previousElementSibling.remove(); +} fillListWorkouts(); function fillPage(workout_id) { list.innerHTML = ""; - schedaButtons.innerHTML = ""; + if (schedaButtons.previousElementSibling !== null) { + schedaButtons.previousElementSibling.remove(); + } + setTimeout(() => { fetch("../workout/" + workout_id, { method: "GET", }) .then(function (response) { return response.json(); - // return response }) .then(function (json) { fillButtons(json); @@ -25,10 +29,11 @@ function fillPage(workout_id) { list.innerHTML = ""; let schedaName = event.target.textContent; fillScheda(json, schedaName); - // from modifySerie.js + // ─── From Modifyserie.js ───── modifySerie(); updateScheda(workout_id); sendUpdate.parentElement.removeAttribute("hidden"); + // ───────────────────────────── }; }); }); @@ -66,13 +71,14 @@ function fillExercise(name, serie) { function completeElement(name, num, carico, reps) { let nameToPlace = name.replace(/[^a-zA-Z0-9]+/g, ""); let exElement = - '
' + - '
' + - '' + + '
' + + '
' + + '' + - '
" + - '
'; + "
" + + '
'; return exElement; } function fillButtons(json) { + // ─── Create Button Group ───────────────────────────────────────────── + let new_buttons = document.createElement("div"); + new_buttons.className = "p-2"; + let new_btn_group = document.createElement("div"); + new_btn_group.className = "btn-group"; + new_btn_group.role = "group"; + + // ─── Add Buttons ───────────────────────────────────────────────────── json.schede.forEach((scheda) => { let name = scheda.name; let button = - '"; - schedaButtons.innerHTML += button; + new_btn_group.innerHTML += button; }); + + new_buttons.insertAdjacentElement("afterbegin", new_btn_group); + schedaButtons.insertAdjacentElement("beforebegin", new_buttons); } function fillListWorkouts() { @@ -110,7 +127,6 @@ function fillListWorkouts() { fetch("../workout") .then(function (response) { return response.json(); - // return response }) .then(function (array) { array.forEach((el) => { @@ -121,7 +137,8 @@ function fillListWorkouts() { list.innerHTML += button; }); - // from changeWorkout.js + // ─── From Changeworkout.js ─────────────────────────── changeWorkout(); + // ───────────────────────────────────────────────────── }); } diff --git a/app/public/assets/JS/go_top.js b/app/public/assets/JS/go_top.js deleted file mode 100644 index 3164d7b..0000000 --- a/app/public/assets/JS/go_top.js +++ /dev/null @@ -1,38 +0,0 @@ -// Set a variable for our button element. -const scrollToTopButton = document.getElementById("js-top"); - -// Let's set up a function that shows our scroll-to-top button if we scroll beyond the height of the initial window. -const scrollFunc = () => { - // Get the current scroll value - let y = window.scrollY; - - // If the scroll value is greater than the window height, let's add a class to the scroll-to-top button to show it! - if (y > 0) { - scrollToTopButton.className = "top-link show"; - } else { - scrollToTopButton.className = "top-link hide"; - } -}; - -window.addEventListener("scroll", scrollFunc); - -const scrollToTop = () => { - // Let's set a variable for the number of pixels we are from the top of the document. - const c = document.documentElement.scrollTop || document.body.scrollTop; - - // If that number is greater than 0, we'll scroll back to 0, or the top of the document. - // We'll also animate that scroll with requestAnimationFrame: - // https://developer.mozilla.org/en-US/docs/Web/API/window/requestAnimationFrame - if (c > 0) { - window.requestAnimationFrame(scrollToTop); - // ScrollTo takes an x and a y coordinate. - // Increase the '10' value to get a smoother/slower scroll! - window.scrollTo(0, c - c / 10); - } -}; - -// When the button is clicked, run our ScrolltoTop function above! -scrollToTopButton.onclick = function (e) { - e.preventDefault(); - scrollToTop(); -}; diff --git a/app/public/assets/JS/modifySerie.js b/app/public/assets/JS/modifySerie.js index e4be1f0..49f9597 100644 --- a/app/public/assets/JS/modifySerie.js +++ b/app/public/assets/JS/modifySerie.js @@ -10,8 +10,9 @@ function modifySerie() { elements.forEach((el) => { el.onclick = (event) => { weightMOD = - event.target.parentElement.firstElementChild.firstElementChild - .nextElementSibling.firstElementChild; + event.target.parentElement.parentElement.firstElementChild + .firstElementChild.firstElementChild.nextElementSibling + .firstElementChild; repsMOD = weightMOD.nextElementSibling; diff --git a/app/public/index.html b/app/public/index.html index 7d5528d..7b6536c 100644 --- a/app/public/index.html +++ b/app/public/index.html @@ -1,275 +1,313 @@ - + + + + + + myFitnessAPP - + + + + + + - - myFitnessAPP -
-
-

- - logo - - myFitnessAPP -

- -
+
+
+ -
-
- - - -
- -
-
+ + + -
-
-
-
- - - - - +
+
+
+ + + +
+
+
-
01:00
-
- -
-
-
-
-
00:00
-
+ -
-
-
    -
  • -
    Esercizio 1
    -
    - - -
    -
    - - -
    -
    - -
  • +
+ -
  • -
    Esercizio 2
    -
    - - -
    -
    - - -
    -
    - - +
    +
    + 00:00 +
    +
    + + + +
    +
    +
      +
    • +
      Esercizio 1
      +
      + + +
      +
      + + +
      +
      + + +
      +
    • + +
    • +
      Esercizio 2
      +
      + + +
      +
      + + +
      +
      + + +
      +
    • +
    +
    +
    + +
    +
    +
    +
    -
  • - -
    -
    +
    +
    -
    -
    - -
    - + + +
    +
    +

    + Made with + + + by Alessio Fiorentino +

    +
    + +
    + +