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 = - '