diff --git a/assets/add-to-favorites-5dd64793.js.map b/assets/add-to-favorites-5dd64793.js.map deleted file mode 100644 index 5cafcc8..0000000 --- a/assets/add-to-favorites-5dd64793.js.map +++ /dev/null @@ -1 +0,0 @@ -{"version":3,"file":"add-to-favorites-5dd64793.js","sources":["../../src/js/burger-menu.js","../../src/js/helper/get-access.js","../../src/js/quote.js","../../src/js/helper/helpers.js","../../src/img/icons/sprite.svg","../../src/js/favorities.js","../../src/js/modal-window.js","../../src/js/add-to-favorites.js"],"sourcesContent":["(() => {\n const refs = {\n openModalBtn: document.querySelector('.burger-menu-open'),\n closeModalBtn: document.querySelector('.burger-closed'),\n modal: document.querySelector('.backdrop'),\n backdrop: document.querySelector('.background-menu'),\n };\n\n refs.modal.classList.add('is-hidden');\n\n refs.openModalBtn.addEventListener('click', function () {\n toggleModal();\n disableScroll();\n\n //Для активної лінки\n const homeButtons = document.getElementsByClassName('js-main-link-home');\n const favoritesButtons = document.getElementsByClassName('js-main-link-favorites');\n const currentPath = window.location.pathname;\n const targetPage = 'favorites.html';\n\n if (currentPath.endsWith(targetPage)) {\n console.log('FAVORITES')\n Array.from(favoritesButtons).forEach(button => button.classList.add('active-link'));\n Array.from(homeButtons).forEach(button => button.classList.remove('active-link'));\n } else {\n console.log('HOME')\n Array.from(homeButtons).forEach(button => button.classList.add('active-link'));\n Array.from(favoritesButtons).forEach(button => button.classList.remove('active-link'));\n }\n\n });\n\n refs.closeModalBtn.addEventListener('click', function () {\n toggleModal();\n enableScroll();\n });\n\n refs.backdrop.addEventListener('click', function (event) {\n if (event.target === refs.backdrop) {\n toggleModal();\n enableScroll();\n }\n });\n\n function toggleModal() {\n refs.modal.classList.toggle('is-hidden');\n refs.backdrop.classList.toggle('hidden');\n }\n\n // Функція для заборони прокручування\n function disableScroll() {\n document.body.style.overflow = 'hidden';\n }\n\n // Функція для дозволу прокручування\n function enableScroll() {\n document.body.style.overflow = '';\n }\n})();\n\n\nconst favoritesButton = document.querySelector('.link-favorites');\nconst homeButton = document.querySelector('.link-home');\n\nwindow.addEventListener('load', () => {\n if (window.location.pathname.endsWith('favorites.html')) {\n favoritesButton.classList.add('active-link');\n homeButton.classList.remove('active-link');\n } else {\n homeButton.classList.add('active-link');\n favoritesButton.classList.remove('active-link');\n }\n});\n","import axios from 'axios';\n\nexport { getAccess, postAccess };\n\n/**\n * Виконує GET-запит до сервера за вказаною URL з вказаними параметрами.\n * @param {Object} options - Об'єкт з параметрами.\n * @param {string} options.filter - Фільтр для запиту.\n * @param {number} [options.page=1] - Номер сторінки (за замовчуванням 1).\n * @param {number} [options.limit] - Ліміт результатів на сторінці.\n * @param {string} options.typeFilter - Тип фільтра, який використовується у URL.\n * @returns {Promise} Об'єкт Promise, який розрішується у відповідь від сервера.\n */\nasync function getAccess({ filter, limit, page = 1, typeFilter, id = null }) {\n try {\n const url = id\n ? `https://energyflow.b.goit.study/api/${typeFilter}/${id}`\n : `https://energyflow.b.goit.study/api/${typeFilter}`;\n\n const response = await axios.get(url, {\n params: {\n filter,\n page,\n limit,\n id,\n },\n });\n return response;\n } catch (error) {\n console.error(error.message);\n }\n}\n\n/**\n * Виконує POST-запит до сервера за вказаною URL з вказаними даними.\n * @param {Object} options - Об'єкт з параметрами\n * @param {Object} options.userEmail - Дані, які відправляються у POST-запиті (відправляються у форматі JSON)\n * @param {string} options.typeFilter - Тип фільтра, який використовується у URL (в данному випадку потрібно вказувати subscription)\n * @returns {Promise} Об'єкт Promise, який розрішується у відповідь від сервера.\n */\nasync function postAccess({ userEmail, typeFilter }) {\n try {\n const response = await axios.post(\n `https://energyflow.b.goit.study/api/${typeFilter}`,\n userEmail\n );\n return response;\n } catch (error) {\n console.error(error.message);\n }\n}\n","import { getAccess } from \"./helper/get-access\";\nimport { format } from 'date-fns';\n\nconst quoteOfTheDayHelps = {\n author: `Bruce Lee`,\n quote: `It doesn't matter how slowly you progress. The main thing is that you don't stop.`,\n}\nconst refs = {\n quotePage: document.querySelector('.js-quote'),\n authorPage: document.querySelector('.js-author'),\n getDate: localStorage.getItem('dateNow'),\n storedQuote: JSON.parse(localStorage.getItem('quoteDay')),\n}\n\nfunction getQuote() {\n const date = new Date();\n const formattedDate = format(date, 'dd.MM.yyyy');\n\n setTimeout(() => {\n if (refs.getDate === formattedDate) {\n const localInfo = JSON.parse(localStorage.getItem('quoteDay'))\n const { author, quote } = localInfo;\n refs.quotePage.textContent = quote;\n refs.authorPage.textContent = author;\n }\n }, 500)\n\n if (!refs.getDate || refs.getDate !== formattedDate || !!refs.storedQuote) {\n localStorage.setItem('dateNow', formattedDate);\n\n try {\n getAccess({\n typeFilter: 'quote',\n })\n .then(({ data }) => {\n const { author, quote } = data;\n\n const quoteOfTheDay = {\n author: author,\n quote: quote\n };\n localStorage.setItem('quoteDay', JSON.stringify(quoteOfTheDay));\n\n refs.quotePage.textContent = quote;\n refs.authorPage.textContent = author;\n })\n .catch((err) => {\n console.error(\"Помилка при отриманні цитати:\", err);\n\n refs.quotePage.textContent = quoteOfTheDayHelps.quote;\n refs.authorPage.textContent = quoteOfTheDayHelps.author;\n localStorage.setItem('quoteDay', JSON.stringify(quoteOfTheDayHelps));\n })\n } catch (error) {\n console.error(\"Помилка при виконанні запиту:\", error);\n }\n }\n\n}\n\ngetQuote();","import iziToast from \"izitoast\";\nimport 'izitoast/dist/css/iziToast.min.css'\n\nconst iziToastFunctions = {\n getInfo(messageInfo) {\n iziToast.info({\n title: 'Hello',\n message: messageInfo,\n });\n },\n\n getErrorInfo(messageInfo) {\n iziToast.error({\n title: 'Error',\n message: messageInfo,\n });\n },\n\n getSuccessInfo(messageInfo) {\n iziToast.success({\n title: 'OK',\n message: messageInfo,\n });\n },\n};\n\nfunction createMarkupFilter(filter, galleryContainer) {\n const markup = filter\n .map(\n ({ filter, imgUrl, name }) => `\n
  • \n \"${name}\"class=\"pic\"\n
    \n

    ${name}

    \n

    ${filter}

    \n
    \n
  • `\n )\n .join('');\n\n galleryContainer.insertAdjacentHTML('beforeend', markup);\n return markup;\n}\n\nexport { iziToastFunctions };\nexport { createMarkupFilter };","export default \"__VITE_ASSET__d61b4e3a__\"","import { getAccess } from './helper/get-access.js';\nimport { iziToastFunctions } from './helper/helpers.js';\nimport icons from '../img/icons/sprite.svg';\n\nconst refs = {\n favoritesCard: document.getElementById('favorites-container'),\n removeCards: document.querySelector(\".container-remove-favorites\"),\n deleteButtons: document.querySelectorAll('.button-remove'),\n galleryWindow: document.querySelector('.js-gallery'),\n}\n\nfunction savedCardsStorage() {\n try {\n const savedCards = JSON.parse(localStorage.getItem('addKeyID')) || [];\n displayFavoriteCards(savedCards);\n }\n catch (err) {\n console.log(err)\n iziToastFunctions.getErrorInfo('Wrong operation!!!');\n }\n}\n\nfunction displayFavoriteCards(savedCards) {\n if (!savedCards || savedCards.length === 0) {\n showRemoveCards();\n } else {\n createCardFavorites(savedCards)\n hideRemoveCards();\n smoothScrollToNextGroup();\n }\n checkContainerHeight();\n\n}\n\nrefs.galleryWindow.addEventListener('click', deleteFavorites);\n\nfunction deleteFavorites(e) {\n if (e.target.classList.contains('js-remove-favorites')) {\n const card = e.target.closest('.list-favorites-item');\n\n card.classList.add('animation-items-remove'); // Додаємо клас для анімації видалення\n\n setTimeout(() => {\n const cardId = card.dataset.id;\n removeFavoriteCard(cardId);\n card.remove();\n\n const savedCards = JSON.parse(localStorage.getItem('addKeyID')) || [];\n if (savedCards.length === 0) {\n showRemoveCards();\n }\n }, 500); // Час, необхідний для виконання анімації\n }\n}\n\nfunction removeFavoriteCard(id) {\n let savedCards = JSON.parse(localStorage.getItem('addKeyID')) || [];\n savedCards = savedCards.filter(card => card !== id);\n localStorage.setItem('addKeyID', JSON.stringify(savedCards));\n}\n\nfunction showRemoveCards() {\n refs.removeCards.classList.remove(\"is-hidden\");\n}\n\nfunction hideRemoveCards() {\n refs.removeCards.classList.add(\"is-hidden\");\n}\n\nfunction smoothScrollToNextGroup() {\n const favoritesItem = document.querySelector(\".scroll\");\n if (favoritesItem) {\n const galleryItemHeight = favoritesItem.getBoundingClientRect().height;\n window.scrollBy({\n top: 0,\n behavior: \"smooth\",\n });\n }\n}\n\nfunction checkContainerHeight() {\n const container = refs.favoritesCard;\n const extraSpace = 200; // Додатковий простір\n const content = container.querySelector(\".list-favorites\");\n const cardHeight = 165; // Висота однієї картки\n const rowsToShow = 4; // Кількість рядків, після яких з'явиться скролбар\n\n if (content) {\n const rowsCount = Math.ceil(content.children.length / 3); // Кількість рядків\n\n // Перевірка, чи кількість рядків перевищує задану кількість\n if (rowsCount > rowsToShow) {\n container.style.overflowY = \"scroll\";\n } else {\n container.style.overflowY = \"hidden\";\n }\n }\n}\n\nif (window.location.pathname.endsWith('/favorites.html')) {\n savedCardsStorage();\n}\n\nexport function createCardFavorites(arr) {\n Promise.all(arr.map(value =>\n getAccess({ typeFilter: 'exercises', id: value })\n ))\n .then(results => {\n const dataList = results.map(result => result.data);\n const markup = createMarkup(dataList)\n const favoritesCard = document.getElementById('favorites-container');\n\n // Перевіряємо, чи елемент favoritesCard існує\n if (favoritesCard) {\n favoritesCard.insertAdjacentHTML(\"beforeend\", markup);\n\n const filterCards = document.querySelectorAll('.js-animation');\n filterCards.forEach(card => {\n card.classList.add('animation-items');\n });\n const disappearance = setTimeout(() => {\n filterCards.forEach(card => {\n card.classList.remove('animation-items');\n });\n }, 500);\n\n checkContainerHeight();\n }\n })\n .catch(err => console.error(err));\n}\n\nfunction createMarkup(arr) {\n return arr.map(({ name, target, bodyPart, burnedCalories, _id }) =>\n `
  • \n\n
    \n
    \n
    Workout
    \n \n
    \n \n
    \n
    \n \n \n \n

    ${name.charAt(0).toUpperCase() + name.slice(1)\n }

    \n
    \n
    \n \n Burned calories:\n ${burnedCalories}/ 3 min\n \n \n Body part:\n ${bodyPart}\n \n \n Target: \n ${target}\n \n
    \n
  • `)\n .join('');\n}","import { getAccess } from './helper/get-access';\n\nconst refs = {\n backdrop: document.querySelector('.backdrop-thumb'),\n closeIcon: document.querySelector('.js-modal-window'),\n galleryWindow: document.querySelector('.js-gallery'),\n}\n\nconst raitings = document.querySelectorAll('.raiting')\n\nrefs.galleryWindow.addEventListener('click', openModal);\n\n// Відкриття модалки\nfunction openModal(e) {\n if (e.target.classList.contains('js-start')) {\n refs.backdrop.classList.remove('is-open');\n document.body.style.overflow = 'hidden';\n\n const liElement = e.target.closest('.js-id');\n\n if (liElement) {\n const id = liElement.dataset.id;\n getExercisesObject(id);\n }\n }\n}\n\n// Закриття модального вікна\nrefs.closeIcon.addEventListener('click', closeModal);\ndocument.addEventListener('keydown', closeModalByEsc);\n\nfunction closeModal(e) {\n refs.backdrop.classList.add('is-open');\n document.body.style.overflow = '';\n\n clearModalContent();\n}\n\nfunction closeModalByEsc(e) {\n if (e.code === 'Escape') {\n refs.backdrop.classList.add('is-open');\n document.body.style.overflow = '';\n clearModalContent();\n }\n}\nrefs.backdrop.addEventListener('click', function (event) {\n if (event.target === this) {\n closeModal();\n }\n});\n\n// Завантаження сторінки\nfunction getExercisesObject(id) {\n getAccess({ typeFilter: 'exercises', id: id })\n .then(({ data }) => {\n const {\n name,\n rating,\n target,\n bodyPart,\n equipment,\n popularity,\n burnedCalories,\n description,\n gifUrl,\n _id,\n } = data;\n\n const modalWindow = document.querySelector('.modal-window');\n modalWindow.setAttribute('data-modal-id', _id);\n\n\n const refs = {\n img: document.querySelector('.js-img'),\n title: document.querySelector('.js-title'),\n raiting: document.querySelector('.js-raiting'),\n targetValue: document.querySelector('.js-target'),\n bodyPartValue: document.querySelector('.js-body-part'),\n equipmentValue: document.querySelector('.js-equipment'),\n popularValue: document.querySelector('.js-popular'),\n caloriesValue: document.querySelector('.js-calories'),\n descriptionValue: document.querySelector('.js-description'),\n };\n\n refs.img.setAttribute('src', gifUrl || './img/picture/energyflow.png');\n refs.title.textContent = name.charAt(0).toUpperCase() + name.slice(1);\n refs.raiting.textContent = rating;\n refs.targetValue.textContent = target;\n refs.bodyPartValue.textContent = bodyPart;\n refs.equipmentValue.textContent = equipment;\n refs.popularValue.textContent = popularity;\n refs.caloriesValue.textContent = burnedCalories;\n refs.descriptionValue.textContent = description;\n\n if (raitings.length > 0) {\n initRatings();\n }\n })\n .catch(err => {\n console.error(err);\n const img = document.querySelector('.js-img');\n img.setAttribute('src', './img/picture/energyflow.png');\n });\n}\n\n// Очіщюємо вміст модалки після закриття\nfunction clearModalContent() {\n const refs = {\n img: document.querySelector('.js-img'),\n title: document.querySelector('.js-title'),\n raiting: document.querySelector('.js-raiting'),\n targetValue: document.querySelector('.js-target'),\n bodyPartValue: document.querySelector('.js-body-part'),\n equipmentValue: document.querySelector('.js-equipment'),\n popularValue: document.querySelector('.js-popular'),\n caloriesValue: document.querySelector('.js-calories'),\n descriptionValue: document.querySelector('.js-description'),\n };\n\n // Встановлюємо пусті значення для всіх елементів модального вікна\n refs.img.setAttribute('src', '');\n refs.title.textContent = '';\n refs.raiting.textContent = '';\n refs.targetValue.textContent = '';\n refs.bodyPartValue.textContent = '';\n refs.equipmentValue.textContent = '';\n refs.popularValue.textContent = '';\n refs.caloriesValue.textContent = '';\n refs.descriptionValue.textContent = '';\n\n // Очищаємо класи зірок рейтингу\n const stars = document.querySelectorAll('.raiting-item .icon-star');\n stars.forEach(star => {\n star.classList.add('non-activ');\n });\n}\n\n// Зірочки\n\nfunction initRatings() {\n let ratingActive, ratingValue;\n\n for (let i = 0; i < raitings.length; i++) {\n const rating = raitings[i];\n initRatings(rating);\n }\n\n function initRatings(rating) {\n initRatingVars(rating);\n\n setRatingActiveWidth();\n }\n\n function initRatingVars(rating) {\n ratingActive = rating.querySelector('.raiting-active');\n ratingValue = rating.getElementsByClassName('raiting-value')[0];\n }\n\n function setRatingActiveWidth(index = ratingValue.innerHTML) {\n const ratingActiveWidth = index / 0.05;\n ratingActive.style.width = `${ratingActiveWidth}%`\n }\n\n}","import { createCardFavorites } from \"./favorities\";\n\nconst storedArrayAdd = JSON.parse(localStorage.getItem('addKeyID')) || [];\nlet cardID;\n\nconst refs = {\n addToFavoritesBtn: document.querySelector('.add-to-favorities'),\n removeFromFavoritesBtn: document.querySelector('.js-remove'),\n idModul: document.querySelector('.js-gallery'),\n}\n\nrefs.idModul.addEventListener('click', getIDModul);\nfunction getIDModul(e) {\n const liElement = e.target.closest('.js-id');\n if (liElement) {\n cardID = liElement.dataset.id;\n\n if (updateLicalStorage().includes(cardID)) {\n refs.removeFromFavoritesBtn.classList.remove('hidden-btn');\n refs.addToFavoritesBtn.classList.add('hidden-btn');\n } else {\n refs.removeFromFavoritesBtn.classList.add('hidden-btn');\n refs.addToFavoritesBtn.classList.remove('hidden-btn');\n }\n }\n}\n\nif (!localStorage.getItem('addKeyID')) {\n const emptyArrayAdd = [];\n localStorage.setItem('addKeyID', JSON.stringify(emptyArrayAdd));\n}\n\nrefs.addToFavoritesBtn.addEventListener('click', () => getIdFavorites(cardID));\n\nfunction getIdFavorites(cardID) {\n refs.removeFromFavoritesBtn.classList.remove('hidden-btn');\n refs.addToFavoritesBtn.classList.add('hidden-btn');\n\n updateGallery(cardID);\n\n storedArrayAdd.push(cardID); // Оновлення масиву storedArrayAdd\n localStorage.setItem('addKeyID', JSON.stringify(storedArrayAdd));\n}\n\nrefs.removeFromFavoritesBtn.addEventListener('click', () => removeIdFavorites(cardID));\n\nfunction removeIdFavorites(cardID) {\n refs.removeFromFavoritesBtn.classList.add('hidden-btn');\n refs.addToFavoritesBtn.classList.remove('hidden-btn');\n updateGallery(cardID);\n\n const cardToRemove = document.querySelector(`.list-favorites-item[data-id=\"${cardID}\"]`);\n if (cardToRemove) {\n cardToRemove.classList.add('animation-items-remove'); // Додаємо клас для анімації видалення\n setTimeout(() => {\n cardToRemove.remove();\n }, 500); // Час, необхідний для виконання анімації\n }\n storedArrayAdd.splice(storedArrayAdd.indexOf(cardID), 1); // Оновлення масиву storedArrayAdd\n localStorage.setItem('addKeyID', JSON.stringify(storedArrayAdd));\n}\n\nfunction updateGallery(cardID) {\n const savedCards = storedArrayAdd.filter(card => card !== cardID);\n localStorage.setItem('addKeyID', JSON.stringify(savedCards));\n\n const cardToRemove = document.querySelector(`.list-favorites-item[data-id=\"${cardID}\"]`);\n if (!cardToRemove) {\n createCardFavorites([cardID])\n }\n}\n\nfunction updateLicalStorage() {\n return localStorage.getItem('addKeyID');\n}"],"names":["refs","toggleModal","disableScroll","homeButtons","favoritesButtons","currentPath","targetPage","button","enableScroll","event","favoritesButton","homeButton","getAccess","filter","limit","page","typeFilter","id","url","axios","error","quoteOfTheDayHelps","getQuote","formattedDate","format","localInfo","author","quote","data","quoteOfTheDay","err","iziToastFunctions","messageInfo","iziToast","icons","savedCardsStorage","savedCards","displayFavoriteCards","showRemoveCards","createCardFavorites","hideRemoveCards","smoothScrollToNextGroup","checkContainerHeight","deleteFavorites","card","cardId","removeFavoriteCard","favoritesItem","container","content","rowsToShow","arr","value","results","dataList","result","markup","createMarkup","favoritesCard","filterCards","name","target","bodyPart","burnedCalories","_id","raitings","openModal","liElement","getExercisesObject","closeModal","closeModalByEsc","clearModalContent","rating","equipment","popularity","description","gifUrl","initRatings","star","ratingActive","ratingValue","i","initRatingVars","setRatingActiveWidth","index","ratingActiveWidth","storedArrayAdd","cardID","getIDModul","updateLicalStorage","emptyArrayAdd","getIdFavorites","updateGallery","removeIdFavorites","cardToRemove"],"mappings":"8vBAAC,IAAM,CACL,MAAMA,EAAO,CACX,aAAc,SAAS,cAAc,mBAAmB,EACxD,cAAe,SAAS,cAAc,gBAAgB,EACtD,MAAO,SAAS,cAAc,WAAW,EACzC,SAAU,SAAS,cAAc,kBAAkB,CACvD,EAEEA,EAAK,MAAM,UAAU,IAAI,WAAW,EAEpCA,EAAK,aAAa,iBAAiB,QAAS,UAAY,CACtDC,IACAC,IAGA,MAAMC,EAAc,SAAS,uBAAuB,mBAAmB,EACjEC,EAAmB,SAAS,uBAAuB,wBAAwB,EAC3EC,EAAc,OAAO,SAAS,SAC9BC,EAAa,iBAEfD,EAAY,SAASC,CAAU,GACjC,QAAQ,IAAI,WAAW,EACvB,MAAM,KAAKF,CAAgB,EAAE,QAAQG,GAAUA,EAAO,UA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A,EAAK,kBAAkB,UAAU,OAAO,YAAY,EACpD4F,EAAcL,CAAM,EAEpB,MAAMO,EAAe,SAAS,cAAc,iCAAiCP,CAAM,IAAI,EACnFO,IACAA,EAAa,UAAU,IAAI,wBAAwB,EACnD,WAAW,IAAM,CACbA,EAAa,OAAM,CACtB,EAAE,GAAG,GAEVR,EAAe,OAAOA,EAAe,QAAQC,CAAM,EAAG,CAAC,EACvD,aAAa,QAAQ,WAAY,KAAK,UAAUD,CAAc,CAAC,CACnE,CAEA,SAASM,EAAcL,EAAQ,CAC3B,MAAMnD,EAAakD,EAAe,OAAO1C,GAAQA,IAAS2C,CAAM,EAChE,aAAa,QAAQ,WAAY,KAAK,UAAUnD,CAAU,CAAC,EAEtC,SAAS,cAAc,iCAAiCmD,CAAM,IAAI,GAEnFhD,EAAoB,CAACgD,CAAM,CAAC,CAEpC,CAEA,SAASE,GAAqB,CAC1B,OAAO,aAAa,QAAQ,UAAU,CAC1C"} \ No newline at end of file diff --git a/assets/add-to-favorites-5dd64793.js b/assets/modal-window-5ca35ebd.js similarity index 60% rename from assets/add-to-favorites-5dd64793.js rename to assets/modal-window-5ca35ebd.js index 78fed50..7bb028b 100644 --- a/assets/add-to-favorites-5dd64793.js +++ b/assets/modal-window-5ca35ebd.js @@ -1,4 +1,4 @@ -import{a as V,f as O,i as p}from"./vendor-0a7c832e.js";(function(){const t=document.createElement("link").relList;if(t&&t.supports&&t.supports("modulepreload"))return;for(const s of document.querySelectorAll('link[rel="modulepreload"]'))n(s);new MutationObserver(s=>{for(const o of s)if(o.type==="childList")for(const a of o.addedNodes)a.tagName==="LINK"&&a.rel==="modulepreload"&&n(a)}).observe(document,{childList:!0,subtree:!0});function r(s){const o={};return s.integrity&&(o.integrity=s.integrity),s.referrerPolicy&&(o.referrerPolicy=s.referrerPolicy),s.crossOrigin==="use-credentials"?o.credentials="include":s.crossOrigin==="anonymous"?o.credentials="omit":o.credentials="same-origin",o}function n(s){if(s.ep)return;s.ep=!0;const o=r(s);fetch(s.href,o)}})();(()=>{const e={openModalBtn:document.querySelector(".burger-menu-open"),closeModalBtn:document.querySelector(".burger-closed"),modal:document.querySelector(".backdrop"),backdrop:document.querySelector(".background-menu")};e.modal.classList.add("is-hidden"),e.openModalBtn.addEventListener("click",function(){t(),r();const s=document.getElementsByClassName("js-main-link-home"),o=document.getElementsByClassName("js-main-link-favorites"),a=window.location.pathname,y="favorites.html";a.endsWith(y)?(console.log("FAVORITES"),Array.from(o).forEach(l=>l.classList.add("active-link")),Array.from(s).forEach(l=>l.classList.remove("active-link"))):(console.log("HOME"),Array.from(s).forEach(l=>l.classList.add("active-link")),Array.from(o).forEach(l=>l.classList.remove("active-link")))}),e.closeModalBtn.addEventListener("click",function(){t(),n()}),e.backdrop.addEventListener("click",function(s){s.target===e.backdrop&&(t(),n())});function t(){e.modal.classList.toggle("is-hidden"),e.backdrop.classList.toggle("hidden")}function r(){document.body.style.overflow="hidden"}function n(){document.body.style.overflow=""}})();const b=document.querySelector(".link-favorites"),w=document.querySelector(".link-home");window.addEventListener("load",()=>{window.location.pathname.endsWith("favorites.html")?(b.classList.add("active-link"),w.classList.remove("active-link")):(w.classList.add("active-link"),b.classList.remove("active-link"))});async function q({filter:e,limit:t,page:r=1,typeFilter:n,id:s=null}){try{const o=s?`https://energyflow.b.goit.study/api/${n}/${s}`:`https://energyflow.b.goit.study/api/${n}`;return await V.get(o,{params:{filter:e,page:r,limit:t,id:s}})}catch(o){console.error(o.message)}}const v={author:"Bruce Lee",quote:"It doesn't matter how slowly you progress. The main thing is that you don't stop."},c={quotePage:document.querySelector(".js-quote"),authorPage:document.querySelector(".js-author"),getDate:localStorage.getItem("dateNow"),storedQuote:JSON.parse(localStorage.getItem("quoteDay"))};function A(){const t=O(new Date,"dd.MM.yyyy");if(setTimeout(()=>{if(c.getDate===t){const r=JSON.parse(localStorage.getItem("quoteDay")),{author:n,quote:s}=r;c.quotePage.textContent=s,c.authorPage.textContent=n}},500),!c.getDate||c.getDate!==t||c.storedQuote){localStorage.setItem("dateNow",t);try{q({typeFilter:"quote"}).then(({data:r})=>{const{author:n,quote:s}=r,o={author:n,quote:s};localStorage.setItem("quoteDay",JSON.stringify(o)),c.quotePage.textContent=s,c.authorPage.textContent=n}).catch(r=>{console.error("Помилка при отриманні цитати:",r),c.quotePage.textContent=v.quote,c.authorPage.textContent=v.author,localStorage.setItem("quoteDay",JSON.stringify(v))})}catch(r){console.error("Помилка при виконанні запиту:",r)}}}A();const T={getInfo(e){p.info({title:"Hello",message:e})},getErrorInfo(e){p.error({title:"Error",message:e})},getSuccessInfo(e){p.success({title:"OK",message:e})}},h="/project-JS-Wizards/assets/sprite-afa54ed9.svg",g={favoritesCard:document.getElementById("favorites-container"),removeCards:document.querySelector(".container-remove-favorites"),deleteButtons:document.querySelectorAll(".button-remove"),galleryWindow:document.querySelector(".js-gallery")};function N(){try{const e=JSON.parse(localStorage.getItem("addKeyID"))||[];D(e)}catch(e){console.log(e),T.getErrorInfo("Wrong operation!!!")}}function D(e){!e||e.length===0?L():(j(e),$(),J()),C()}g.galleryWindow.addEventListener("click",M);function M(e){if(e.target.classList.contains("js-remove-favorites")){const t=e.target.closest(".list-favorites-item");t.classList.add("animation-items-remove"),setTimeout(()=>{const r=t.dataset.id;P(r),t.remove(),(JSON.parse(localStorage.getItem("addKeyID"))||[]).length===0&&L()},500)}}function P(e){let t=JSON.parse(localStorage.getItem("addKeyID"))||[];t=t.filter(r=>r!==e),localStorage.setItem("addKeyID",JSON.stringify(t))}function L(){g.removeCards.classList.remove("is-hidden")}function $(){g.removeCards.classList.add("is-hidden")}function J(){const e=document.querySelector(".scroll");e&&(e.getBoundingClientRect().height,window.scrollBy({top:0,behavior:"smooth"}))}function C(){const e=g.favoritesCard,t=e.querySelector(".list-favorites"),r=4;t&&(Math.ceil(t.children.length/3)>r?e.style.overflowY="scroll":e.style.overflowY="hidden")}window.location.pathname.endsWith("/favorites.html")&&N();function j(e){Promise.all(e.map(t=>q({typeFilter:"exercises",id:t}))).then(t=>{const r=t.map(o=>o.data),n=W(r),s=document.getElementById("favorites-container");if(s){s.insertAdjacentHTML("beforeend",n);const o=document.querySelectorAll(".js-animation");o.forEach(a=>{a.classList.add("animation-items")}),setTimeout(()=>{o.forEach(a=>{a.classList.remove("animation-items")})},500),C()}}).catch(t=>console.error(t))}function W(e){return e.map(({name:t,target:r,bodyPart:n,burnedCalories:s,_id:o})=>`
  • +import{a as A,f as O,i as p}from"./vendor-0a7c832e.js";(function(){const t=document.createElement("link").relList;if(t&&t.supports&&t.supports("modulepreload"))return;for(const s of document.querySelectorAll('link[rel="modulepreload"]'))n(s);new MutationObserver(s=>{for(const o of s)if(o.type==="childList")for(const a of o.addedNodes)a.tagName==="LINK"&&a.rel==="modulepreload"&&n(a)}).observe(document,{childList:!0,subtree:!0});function r(s){const o={};return s.integrity&&(o.integrity=s.integrity),s.referrerPolicy&&(o.referrerPolicy=s.referrerPolicy),s.crossOrigin==="use-credentials"?o.credentials="include":s.crossOrigin==="anonymous"?o.credentials="omit":o.credentials="same-origin",o}function n(s){if(s.ep)return;s.ep=!0;const o=r(s);fetch(s.href,o)}})();(()=>{const e={openModalBtn:document.querySelector(".burger-menu-open"),closeModalBtn:document.querySelector(".burger-closed"),modal:document.querySelector(".backdrop"),backdrop:document.querySelector(".background-menu")};e.modal.classList.add("is-hidden"),e.openModalBtn.addEventListener("click",function(){t(),r();const s=document.getElementsByClassName("js-main-link-home"),o=document.getElementsByClassName("js-main-link-favorites"),a=window.location.pathname,y="favorites.html";a.endsWith(y)?(console.log("FAVORITES"),Array.from(o).forEach(l=>l.classList.add("active-link")),Array.from(s).forEach(l=>l.classList.remove("active-link"))):(console.log("HOME"),Array.from(s).forEach(l=>l.classList.add("active-link")),Array.from(o).forEach(l=>l.classList.remove("active-link")))}),e.closeModalBtn.addEventListener("click",function(){t(),n()}),e.backdrop.addEventListener("click",function(s){s.target===e.backdrop&&(t(),n())});function t(){e.modal.classList.toggle("is-hidden"),e.backdrop.classList.toggle("hidden")}function r(){document.body.style.overflow="hidden"}function n(){document.body.style.overflow=""}})();const b=document.querySelector(".link-favorites"),w=document.querySelector(".link-home");window.addEventListener("load",()=>{window.location.pathname.endsWith("favorites.html")?(b.classList.add("active-link"),w.classList.remove("active-link")):(w.classList.add("active-link"),b.classList.remove("active-link"))});async function q({filter:e,limit:t,page:r=1,typeFilter:n,id:s=null}){try{const o=s?`https://energyflow.b.goit.study/api/${n}/${s}`:`https://energyflow.b.goit.study/api/${n}`;return await A.get(o,{params:{filter:e,page:r,limit:t,id:s}})}catch(o){console.error(o.message)}}const v={author:"Bruce Lee",quote:"It doesn't matter how slowly you progress. The main thing is that you don't stop."},c={quotePage:document.querySelector(".js-quote"),authorPage:document.querySelector(".js-author"),getDate:localStorage.getItem("dateNow"),storedQuote:JSON.parse(localStorage.getItem("quoteDay"))};function T(){const t=O(new Date,"dd.MM.yyyy");if(setTimeout(()=>{if(c.getDate===t){const r=JSON.parse(localStorage.getItem("quoteDay")),{author:n,quote:s}=r;c.quotePage.textContent=s,c.authorPage.textContent=n}},500),!c.getDate||c.getDate!==t||c.storedQuote){localStorage.setItem("dateNow",t);try{q({typeFilter:"quote"}).then(({data:r})=>{const{author:n,quote:s}=r,o={author:n,quote:s};localStorage.setItem("quoteDay",JSON.stringify(o)),c.quotePage.textContent=s,c.authorPage.textContent=n}).catch(r=>{console.error("Помилка при отриманні цитати:",r),c.quotePage.textContent=v.quote,c.authorPage.textContent=v.author,localStorage.setItem("quoteDay",JSON.stringify(v))})}catch(r){console.error("Помилка при виконанні запиту:",r)}}}T();const M={getInfo(e){p.info({title:"Hello",message:e})},getErrorInfo(e){p.error({title:"Error",message:e})},getSuccessInfo(e){p.success({title:"OK",message:e})}},h="/project-JS-Wizards/assets/sprite-afa54ed9.svg",u=JSON.parse(localStorage.getItem("addKeyID"))||[];let f;const i={addToFavoritesBtn:document.querySelector(".add-to-favorities"),removeFromFavoritesBtn:document.querySelector(".js-remove"),idModul:document.querySelector(".js-gallery")};i.idModul.addEventListener("click",N);function N(e){const t=e.target.closest(".js-id");t&&(f=t.dataset.id,D().includes(f)?(i.removeFromFavoritesBtn.classList.remove("hidden-btn"),i.addToFavoritesBtn.classList.add("hidden-btn")):(i.removeFromFavoritesBtn.classList.add("hidden-btn"),i.addToFavoritesBtn.classList.remove("hidden-btn")))}if(!localStorage.getItem("addKeyID")){const e=[];localStorage.setItem("addKeyID",JSON.stringify(e))}i.addToFavoritesBtn.addEventListener("click",()=>P(f));function P(e){i.removeFromFavoritesBtn.classList.remove("hidden-btn"),i.addToFavoritesBtn.classList.add("hidden-btn"),C(e),u.push(e),localStorage.setItem("addKeyID",JSON.stringify(u))}i.removeFromFavoritesBtn.addEventListener("click",()=>L(f));function L(e){i.removeFromFavoritesBtn.classList.add("hidden-btn"),i.addToFavoritesBtn.classList.remove("hidden-btn"),C(e);const t=document.querySelector(`.list-favorites-item[data-id="${e}"]`);t&&(t.classList.add("animation-items-remove"),setTimeout(()=>{t.remove()},500)),u.splice(u.indexOf(e),1),localStorage.setItem("addKeyID",JSON.stringify(u))}function C(e){const t=u.filter(n=>n!==e);localStorage.setItem("addKeyID",JSON.stringify(t)),document.querySelector(`.list-favorites-item[data-id="${e}"]`)||k([e])}function D(){return localStorage.getItem("addKeyID")}const g={favoritesCard:document.getElementById("favorites-container"),removeCards:document.querySelector(".container-remove-favorites"),deleteButtons:document.querySelectorAll(".button-remove"),galleryWindow:document.querySelector(".js-gallery")};function $(){try{const e=JSON.parse(localStorage.getItem("addKeyID"))||[];W(e)}catch(e){console.log(e),M.getErrorInfo("Wrong operation!!!")}}function W(e){!e||e.length===0?j():(k(e),K(),R()),I()}g.galleryWindow.addEventListener("click",J);function J(e){if(e.target.classList.contains("js-remove-favorites")){const t=e.target.closest(".list-favorites-item");t.classList.add("animation-items-remove"),setTimeout(()=>{const r=t.dataset.id;L(r),t.remove(),(JSON.parse(localStorage.getItem("addKeyID"))||[]).length===0&&j()},500)}}function j(){g.removeCards.classList.remove("is-hidden")}function K(){g.removeCards.classList.add("is-hidden")}function R(){const e=document.querySelector(".scroll");e&&(e.getBoundingClientRect().height,window.scrollBy({top:0,behavior:"smooth"}))}function I(){const e=g.favoritesCard,t=e.querySelector(".list-favorites"),r=4;t&&(Math.ceil(t.children.length/3)>r?e.style.overflowY="scroll":e.style.overflowY="hidden")}window.location.pathname.endsWith("/favorites.html")&&$();function k(e){Promise.all(e.map(t=>q({typeFilter:"exercises",id:t}))).then(t=>{const r=t.map(o=>o.data),n=H(r),s=document.getElementById("favorites-container");if(s){s.insertAdjacentHTML("beforeend",n);const o=document.querySelectorAll(".js-animation");o.forEach(a=>{a.classList.add("animation-items")}),setTimeout(()=>{o.forEach(a=>{a.classList.remove("animation-items")})},500),I()}}).catch(t=>console.error(t))}function H(e){return e.map(({name:t,target:r,bodyPart:n,burnedCalories:s,_id:o})=>`
  • @@ -36,5 +36,5 @@ import{a as V,f as O,i as p}from"./vendor-0a7c832e.js";(function(){const t=docum ${r}
    -
  • `).join("")}const m={backdrop:document.querySelector(".backdrop-thumb"),closeIcon:document.querySelector(".js-modal-window"),galleryWindow:document.querySelector(".js-gallery")},S=document.querySelectorAll(".raiting");m.galleryWindow.addEventListener("click",K);function K(e){if(e.target.classList.contains("js-start")){m.backdrop.classList.remove("is-open"),document.body.style.overflow="hidden";const t=e.target.closest(".js-id");if(t){const r=t.dataset.id;H(r)}}}m.closeIcon.addEventListener("click",I);document.addEventListener("keydown",R);function I(e){m.backdrop.classList.add("is-open"),document.body.style.overflow="",k()}function R(e){e.code==="Escape"&&(m.backdrop.classList.add("is-open"),document.body.style.overflow="",k())}m.backdrop.addEventListener("click",function(e){e.target===this&&I()});function H(e){q({typeFilter:"exercises",id:e}).then(({data:t})=>{const{name:r,rating:n,target:s,bodyPart:o,equipment:a,popularity:y,burnedCalories:l,description:E,gifUrl:B,_id:F}=t;document.querySelector(".modal-window").setAttribute("data-modal-id",F);const d={img:document.querySelector(".js-img"),title:document.querySelector(".js-title"),raiting:document.querySelector(".js-raiting"),targetValue:document.querySelector(".js-target"),bodyPartValue:document.querySelector(".js-body-part"),equipmentValue:document.querySelector(".js-equipment"),popularValue:document.querySelector(".js-popular"),caloriesValue:document.querySelector(".js-calories"),descriptionValue:document.querySelector(".js-description")};d.img.setAttribute("src",B||"./img/picture/energyflow.png"),d.title.textContent=r.charAt(0).toUpperCase()+r.slice(1),d.raiting.textContent=n,d.targetValue.textContent=s,d.bodyPartValue.textContent=o,d.equipmentValue.textContent=a,d.popularValue.textContent=y,d.caloriesValue.textContent=l,d.descriptionValue.textContent=E,S.length>0&&z()}).catch(t=>{console.error(t),document.querySelector(".js-img").setAttribute("src","./img/picture/energyflow.png")})}function k(){const e={img:document.querySelector(".js-img"),title:document.querySelector(".js-title"),raiting:document.querySelector(".js-raiting"),targetValue:document.querySelector(".js-target"),bodyPartValue:document.querySelector(".js-body-part"),equipmentValue:document.querySelector(".js-equipment"),popularValue:document.querySelector(".js-popular"),caloriesValue:document.querySelector(".js-calories"),descriptionValue:document.querySelector(".js-description")};e.img.setAttribute("src",""),e.title.textContent="",e.raiting.textContent="",e.targetValue.textContent="",e.bodyPartValue.textContent="",e.equipmentValue.textContent="",e.popularValue.textContent="",e.caloriesValue.textContent="",e.descriptionValue.textContent="",document.querySelectorAll(".raiting-item .icon-star").forEach(r=>{r.classList.add("non-activ")})}function z(){let e,t;for(let o=0;oU(f));function U(e){i.removeFromFavoritesBtn.classList.remove("hidden-btn"),i.addToFavoritesBtn.classList.add("hidden-btn"),x(e),u.push(e),localStorage.setItem("addKeyID",JSON.stringify(u))}i.removeFromFavoritesBtn.addEventListener("click",()=>G(f));function G(e){i.removeFromFavoritesBtn.classList.add("hidden-btn"),i.addToFavoritesBtn.classList.remove("hidden-btn"),x(e);const t=document.querySelector(`.list-favorites-item[data-id="${e}"]`);t&&(t.classList.add("animation-items-remove"),setTimeout(()=>{t.remove()},500)),u.splice(u.indexOf(e),1),localStorage.setItem("addKeyID",JSON.stringify(u))}function x(e){const t=u.filter(n=>n!==e);localStorage.setItem("addKeyID",JSON.stringify(t)),document.querySelector(`.list-favorites-item[data-id="${e}"]`)||j([e])}function Y(){return localStorage.getItem("addKeyID")}export{h as i}; -//# sourceMappingURL=add-to-favorites-5dd64793.js.map +`).join("")}const m={backdrop:document.querySelector(".backdrop-thumb"),closeIcon:document.querySelector(".js-modal-window"),galleryWindow:document.querySelector(".js-gallery")},S=document.querySelectorAll(".raiting");m.galleryWindow.addEventListener("click",z);function z(e){if(e.target.classList.contains("js-start")){m.backdrop.classList.remove("is-open"),document.body.style.overflow="hidden";const t=e.target.closest(".js-id");if(t){const r=t.dataset.id;U(r)}}}m.closeIcon.addEventListener("click",x);document.addEventListener("keydown",Q);function x(e){m.backdrop.classList.add("is-open"),document.body.style.overflow="",E()}function Q(e){e.code==="Escape"&&(m.backdrop.classList.add("is-open"),document.body.style.overflow="",E())}m.backdrop.addEventListener("click",function(e){e.target===this&&x()});function U(e){q({typeFilter:"exercises",id:e}).then(({data:t})=>{const{name:r,rating:n,target:s,bodyPart:o,equipment:a,popularity:y,burnedCalories:l,description:B,gifUrl:F,_id:V}=t;document.querySelector(".modal-window").setAttribute("data-modal-id",V);const d={img:document.querySelector(".js-img"),title:document.querySelector(".js-title"),raiting:document.querySelector(".js-raiting"),targetValue:document.querySelector(".js-target"),bodyPartValue:document.querySelector(".js-body-part"),equipmentValue:document.querySelector(".js-equipment"),popularValue:document.querySelector(".js-popular"),caloriesValue:document.querySelector(".js-calories"),descriptionValue:document.querySelector(".js-description")};d.img.setAttribute("src",F||"./img/picture/energyflow.png"),d.title.textContent=r.charAt(0).toUpperCase()+r.slice(1),d.raiting.textContent=n,d.targetValue.textContent=s,d.bodyPartValue.textContent=o,d.equipmentValue.textContent=a,d.popularValue.textContent=y,d.caloriesValue.textContent=l,d.descriptionValue.textContent=B,S.length>0&&G()}).catch(t=>{console.error(t),document.querySelector(".js-img").setAttribute("src","./img/picture/energyflow.png")})}function E(){const e={img:document.querySelector(".js-img"),title:document.querySelector(".js-title"),raiting:document.querySelector(".js-raiting"),targetValue:document.querySelector(".js-target"),bodyPartValue:document.querySelector(".js-body-part"),equipmentValue:document.querySelector(".js-equipment"),popularValue:document.querySelector(".js-popular"),caloriesValue:document.querySelector(".js-calories"),descriptionValue:document.querySelector(".js-description")};e.img.setAttribute("src",""),e.title.textContent="",e.raiting.textContent="",e.targetValue.textContent="",e.bodyPartValue.textContent="",e.equipmentValue.textContent="",e.popularValue.textContent="",e.caloriesValue.textContent="",e.descriptionValue.textContent="",document.querySelectorAll(".raiting-item .icon-star").forEach(r=>{r.classList.add("non-activ")})}function G(){let e,t;for(let o=0;o {\n const refs = {\n openModalBtn: document.querySelector('.burger-menu-open'),\n closeModalBtn: document.querySelector('.burger-closed'),\n modal: document.querySelector('.backdrop'),\n backdrop: document.querySelector('.background-menu'),\n };\n\n refs.modal.classList.add('is-hidden');\n\n refs.openModalBtn.addEventListener('click', function () {\n toggleModal();\n disableScroll();\n\n //Для активної лінки\n const homeButtons = document.getElementsByClassName('js-main-link-home');\n const favoritesButtons = document.getElementsByClassName('js-main-link-favorites');\n const currentPath = window.location.pathname;\n const targetPage = 'favorites.html';\n\n if (currentPath.endsWith(targetPage)) {\n console.log('FAVORITES')\n Array.from(favoritesButtons).forEach(button => button.classList.add('active-link'));\n Array.from(homeButtons).forEach(button => button.classList.remove('active-link'));\n } else {\n console.log('HOME')\n Array.from(homeButtons).forEach(button => button.classList.add('active-link'));\n Array.from(favoritesButtons).forEach(button => button.classList.remove('active-link'));\n }\n\n });\n\n refs.closeModalBtn.addEventListener('click', function () {\n toggleModal();\n enableScroll();\n });\n\n refs.backdrop.addEventListener('click', function (event) {\n if (event.target === refs.backdrop) {\n toggleModal();\n enableScroll();\n }\n });\n\n function toggleModal() {\n refs.modal.classList.toggle('is-hidden');\n refs.backdrop.classList.toggle('hidden');\n }\n\n // Функція для заборони прокручування\n function disableScroll() {\n document.body.style.overflow = 'hidden';\n }\n\n // Функція для дозволу прокручування\n function enableScroll() {\n document.body.style.overflow = '';\n }\n})();\n\n\nconst favoritesButton = document.querySelector('.link-favorites');\nconst homeButton = document.querySelector('.link-home');\n\nwindow.addEventListener('load', () => {\n if (window.location.pathname.endsWith('favorites.html')) {\n favoritesButton.classList.add('active-link');\n homeButton.classList.remove('active-link');\n } else {\n homeButton.classList.add('active-link');\n favoritesButton.classList.remove('active-link');\n }\n});\n","import axios from 'axios';\n\nexport { getAccess, postAccess };\n\n/**\n * Виконує GET-запит до сервера за вказаною URL з вказаними параметрами.\n * @param {Object} options - Об'єкт з параметрами.\n * @param {string} options.filter - Фільтр для запиту.\n * @param {number} [options.page=1] - Номер сторінки (за замовчуванням 1).\n * @param {number} [options.limit] - Ліміт результатів на сторінці.\n * @param {string} options.typeFilter - Тип фільтра, який використовується у URL.\n * @returns {Promise} Об'єкт Promise, який розрішується у відповідь від сервера.\n */\nasync function getAccess({ filter, limit, page = 1, typeFilter, id = null }) {\n try {\n const url = id\n ? `https://energyflow.b.goit.study/api/${typeFilter}/${id}`\n : `https://energyflow.b.goit.study/api/${typeFilter}`;\n\n const response = await axios.get(url, {\n params: {\n filter,\n page,\n limit,\n id,\n },\n });\n return response;\n } catch (error) {\n console.error(error.message);\n }\n}\n\n/**\n * Виконує POST-запит до сервера за вказаною URL з вказаними даними.\n * @param {Object} options - Об'єкт з параметрами\n * @param {Object} options.userEmail - Дані, які відправляються у POST-запиті (відправляються у форматі JSON)\n * @param {string} options.typeFilter - Тип фільтра, який використовується у URL (в данному випадку потрібно вказувати subscription)\n * @returns {Promise} Об'єкт Promise, який розрішується у відповідь від сервера.\n */\nasync function postAccess({ userEmail, typeFilter }) {\n try {\n const response = await axios.post(\n `https://energyflow.b.goit.study/api/${typeFilter}`,\n userEmail\n );\n return response;\n } catch (error) {\n console.error(error.message);\n }\n}\n","import { getAccess } from \"./helper/get-access\";\nimport { format } from 'date-fns';\n\nconst quoteOfTheDayHelps = {\n author: `Bruce Lee`,\n quote: `It doesn't matter how slowly you progress. The main thing is that you don't stop.`,\n}\nconst refs = {\n quotePage: document.querySelector('.js-quote'),\n authorPage: document.querySelector('.js-author'),\n getDate: localStorage.getItem('dateNow'),\n storedQuote: JSON.parse(localStorage.getItem('quoteDay')),\n}\n\nfunction getQuote() {\n const date = new Date();\n const formattedDate = format(date, 'dd.MM.yyyy');\n\n setTimeout(() => {\n if (refs.getDate === formattedDate) {\n const localInfo = JSON.parse(localStorage.getItem('quoteDay'))\n const { author, quote } = localInfo;\n refs.quotePage.textContent = quote;\n refs.authorPage.textContent = author;\n }\n }, 500)\n\n if (!refs.getDate || refs.getDate !== formattedDate || !!refs.storedQuote) {\n localStorage.setItem('dateNow', formattedDate);\n\n try {\n getAccess({\n typeFilter: 'quote',\n })\n .then(({ data }) => {\n const { author, quote } = data;\n\n const quoteOfTheDay = {\n author: author,\n quote: quote\n };\n localStorage.setItem('quoteDay', JSON.stringify(quoteOfTheDay));\n\n refs.quotePage.textContent = quote;\n refs.authorPage.textContent = author;\n })\n .catch((err) => {\n console.error(\"Помилка при отриманні цитати:\", err);\n\n refs.quotePage.textContent = quoteOfTheDayHelps.quote;\n refs.authorPage.textContent = quoteOfTheDayHelps.author;\n localStorage.setItem('quoteDay', JSON.stringify(quoteOfTheDayHelps));\n })\n } catch (error) {\n console.error(\"Помилка при виконанні запиту:\", error);\n }\n }\n\n}\n\ngetQuote();","import iziToast from \"izitoast\";\nimport 'izitoast/dist/css/iziToast.min.css'\n\nconst iziToastFunctions = {\n getInfo(messageInfo) {\n iziToast.info({\n title: 'Hello',\n message: messageInfo,\n });\n },\n\n getErrorInfo(messageInfo) {\n iziToast.error({\n title: 'Error',\n message: messageInfo,\n });\n },\n\n getSuccessInfo(messageInfo) {\n iziToast.success({\n title: 'OK',\n message: messageInfo,\n });\n },\n};\n\nfunction createMarkupFilter(filter, galleryContainer) {\n const markup = filter\n .map(\n ({ filter, imgUrl, name }) => `\n
  • \n \"${name}\"class=\"pic\"\n
    \n

    ${name}

    \n

    ${filter}

    \n
    \n
  • `\n )\n .join('');\n\n galleryContainer.insertAdjacentHTML('beforeend', markup);\n return markup;\n}\n\nexport { iziToastFunctions };\nexport { createMarkupFilter };","export default \"__VITE_ASSET__d61b4e3a__\"","import { createCardFavorites } from \"./favorities\";\n\nconst storedArrayAdd = JSON.parse(localStorage.getItem('addKeyID')) || [];\nlet cardID;\n\nconst refs = {\n addToFavoritesBtn: document.querySelector('.add-to-favorities'),\n removeFromFavoritesBtn: document.querySelector('.js-remove'),\n idModul: document.querySelector('.js-gallery'),\n}\n\nrefs.idModul.addEventListener('click', getIDModul);\nfunction getIDModul(e) {\n const liElement = e.target.closest('.js-id');\n if (liElement) {\n cardID = liElement.dataset.id;\n\n if (updateLicalStorage().includes(cardID)) {\n refs.removeFromFavoritesBtn.classList.remove('hidden-btn');\n refs.addToFavoritesBtn.classList.add('hidden-btn');\n } else {\n refs.removeFromFavoritesBtn.classList.add('hidden-btn');\n refs.addToFavoritesBtn.classList.remove('hidden-btn');\n }\n }\n}\n\nif (!localStorage.getItem('addKeyID')) {\n const emptyArrayAdd = [];\n localStorage.setItem('addKeyID', JSON.stringify(emptyArrayAdd));\n}\n\nrefs.addToFavoritesBtn.addEventListener('click', () => getIdFavorites(cardID));\n\nfunction getIdFavorites(cardID) {\n refs.removeFromFavoritesBtn.classList.remove('hidden-btn');\n refs.addToFavoritesBtn.classList.add('hidden-btn');\n\n updateGallery(cardID);\n\n storedArrayAdd.push(cardID); // Оновлення масиву storedArrayAdd\n localStorage.setItem('addKeyID', JSON.stringify(storedArrayAdd));\n}\n\nrefs.removeFromFavoritesBtn.addEventListener('click', () => removeIdFavorites(cardID));\n\nexport function removeIdFavorites(cardID) {\n refs.removeFromFavoritesBtn.classList.add('hidden-btn');\n refs.addToFavoritesBtn.classList.remove('hidden-btn');\n updateGallery(cardID);\n\n const cardToRemove = document.querySelector(`.list-favorites-item[data-id=\"${cardID}\"]`);\n if (cardToRemove) {\n cardToRemove.classList.add('animation-items-remove'); // Додаємо клас для анімації видалення\n setTimeout(() => {\n cardToRemove.remove();\n }, 500); // Час, необхідний для виконання анімації\n }\n storedArrayAdd.splice(storedArrayAdd.indexOf(cardID), 1); // Оновлення масиву storedArrayAdd\n localStorage.setItem('addKeyID', JSON.stringify(storedArrayAdd));\n}\n\nfunction updateGallery(cardID) {\n const savedCards = storedArrayAdd.filter(card => card !== cardID);\n localStorage.setItem('addKeyID', JSON.stringify(savedCards));\n\n const cardToRemove = document.querySelector(`.list-favorites-item[data-id=\"${cardID}\"]`);\n if (!cardToRemove) {\n createCardFavorites([cardID])\n }\n}\n\nfunction updateLicalStorage() {\n return localStorage.getItem('addKeyID');\n}\n","import { getAccess } from './helper/get-access.js';\nimport { iziToastFunctions } from './helper/helpers.js';\nimport icons from '../img/icons/sprite.svg';\nimport { removeIdFavorites } from './add-to-favorites.js';\n\nconst refs = {\n favoritesCard: document.getElementById('favorites-container'),\n removeCards: document.querySelector(\".container-remove-favorites\"),\n deleteButtons: document.querySelectorAll('.button-remove'),\n galleryWindow: document.querySelector('.js-gallery'),\n}\n\nfunction savedCardsStorage() {\n try {\n const savedCards = JSON.parse(localStorage.getItem('addKeyID')) || [];\n displayFavoriteCards(savedCards);\n }\n catch (err) {\n console.log(err)\n iziToastFunctions.getErrorInfo('Wrong operation!!!');\n }\n}\n\nfunction displayFavoriteCards(savedCards) {\n if (!savedCards || savedCards.length === 0) {\n showRemoveCards();\n } else {\n createCardFavorites(savedCards)\n hideRemoveCards();\n smoothScrollToNextGroup();\n }\n checkContainerHeight();\n}\n\nrefs.galleryWindow.addEventListener('click', deleteFavorites);\n\nfunction deleteFavorites(e) {\n if (e.target.classList.contains('js-remove-favorites')) {\n const card = e.target.closest('.list-favorites-item');\n\n card.classList.add('animation-items-remove'); // Додаємо клас для анімації видалення\n setTimeout(() => {\n const cardId = card.dataset.id;\n removeIdFavorites(cardId)\n card.remove();\n\n const savedCards = JSON.parse(localStorage.getItem('addKeyID')) || [];\n if (savedCards.length === 0) {\n showRemoveCards();\n }\n }, 500); // Час, необхідний для виконання анімації\n }\n}\n\nfunction showRemoveCards() {\n refs.removeCards.classList.remove(\"is-hidden\");\n}\n\nfunction hideRemoveCards() {\n refs.removeCards.classList.add(\"is-hidden\");\n}\n\nfunction smoothScrollToNextGroup() {\n const favoritesItem = document.querySelector(\".scroll\");\n if (favoritesItem) {\n const galleryItemHeight = favoritesItem.getBoundingClientRect().height;\n window.scrollBy({\n top: 0,\n behavior: \"smooth\",\n });\n }\n}\n\nfunction checkContainerHeight() {\n const container = refs.favoritesCard;\n const extraSpace = 200; // Додатковий простір\n const content = container.querySelector(\".list-favorites\");\n const cardHeight = 165; // Висота однієї картки\n const rowsToShow = 4; // Кількість рядків, після яких з'явиться скролбар\n\n if (content) {\n const rowsCount = Math.ceil(content.children.length / 3); // Кількість рядків\n\n // Перевірка, чи кількість рядків перевищує задану кількість\n if (rowsCount > rowsToShow) {\n container.style.overflowY = \"scroll\";\n } else {\n container.style.overflowY = \"hidden\";\n }\n }\n}\n\nif (window.location.pathname.endsWith('/favorites.html')) {\n savedCardsStorage();\n}\n\nexport function createCardFavorites(arr) {\n Promise.all(arr.map(value =>\n getAccess({ typeFilter: 'exercises', id: value })\n ))\n .then(results => {\n const dataList = results.map(result => result.data);\n const markup = createMarkup(dataList)\n const favoritesCard = document.getElementById('favorites-container');\n\n // Перевіряємо, чи елемент favoritesCard існує\n if (favoritesCard) {\n favoritesCard.insertAdjacentHTML(\"beforeend\", markup);\n\n const filterCards = document.querySelectorAll('.js-animation');\n filterCards.forEach(card => {\n card.classList.add('animation-items');\n });\n const disappearance = setTimeout(() => {\n filterCards.forEach(card => {\n card.classList.remove('animation-items');\n });\n }, 500);\n\n checkContainerHeight();\n }\n })\n .catch(err => console.error(err));\n}\n\nfunction createMarkup(arr) {\n return arr.map(({ name, target, bodyPart, burnedCalories, _id }) =>\n `
  • \n\n
    \n
    \n
    Workout
    \n \n
    \n \n
    \n
    \n \n \n \n

    ${name.charAt(0).toUpperCase() + name.slice(1)\n }

    \n
    \n
    \n \n Burned calories:\n ${burnedCalories}/ 3 min\n \n \n Body part:\n ${bodyPart}\n \n \n Target: \n ${target}\n \n
    \n
  • `)\n .join('');\n}","import { getAccess } from './helper/get-access';\n\nconst refs = {\n backdrop: document.querySelector('.backdrop-thumb'),\n closeIcon: document.querySelector('.js-modal-window'),\n galleryWindow: document.querySelector('.js-gallery'),\n}\n\nconst raitings = document.querySelectorAll('.raiting')\n\nrefs.galleryWindow.addEventListener('click', openModal);\n\n// Відкриття модалки\nfunction openModal(e) {\n if (e.target.classList.contains('js-start')) {\n refs.backdrop.classList.remove('is-open');\n document.body.style.overflow = 'hidden';\n\n const liElement = e.target.closest('.js-id');\n\n if (liElement) {\n const id = liElement.dataset.id;\n getExercisesObject(id);\n }\n }\n}\n\n// Закриття модального вікна\nrefs.closeIcon.addEventListener('click', closeModal);\ndocument.addEventListener('keydown', closeModalByEsc);\n\nfunction closeModal(e) {\n refs.backdrop.classList.add('is-open');\n document.body.style.overflow = '';\n\n clearModalContent();\n}\n\nfunction closeModalByEsc(e) {\n if (e.code === 'Escape') {\n refs.backdrop.classList.add('is-open');\n document.body.style.overflow = '';\n clearModalContent();\n }\n}\nrefs.backdrop.addEventListener('click', function (event) {\n if (event.target === this) {\n closeModal();\n }\n});\n\n// Завантаження сторінки\nfunction getExercisesObject(id) {\n getAccess({ typeFilter: 'exercises', id: id })\n .then(({ data }) => {\n const {\n name,\n rating,\n target,\n bodyPart,\n equipment,\n popularity,\n burnedCalories,\n description,\n gifUrl,\n _id,\n } = data;\n\n const modalWindow = document.querySelector('.modal-window');\n modalWindow.setAttribute('data-modal-id', _id);\n\n\n const refs = {\n img: document.querySelector('.js-img'),\n title: document.querySelector('.js-title'),\n raiting: document.querySelector('.js-raiting'),\n targetValue: document.querySelector('.js-target'),\n bodyPartValue: document.querySelector('.js-body-part'),\n equipmentValue: document.querySelector('.js-equipment'),\n popularValue: document.querySelector('.js-popular'),\n caloriesValue: document.querySelector('.js-calories'),\n descriptionValue: document.querySelector('.js-description'),\n };\n\n refs.img.setAttribute('src', gifUrl || './img/picture/energyflow.png');\n refs.title.textContent = name.charAt(0).toUpperCase() + name.slice(1);\n refs.raiting.textContent = rating;\n refs.targetValue.textContent = target;\n refs.bodyPartValue.textContent = bodyPart;\n refs.equipmentValue.textContent = equipment;\n refs.popularValue.textContent = popularity;\n refs.caloriesValue.textContent = burnedCalories;\n refs.descriptionValue.textContent = description;\n\n if (raitings.length > 0) {\n initRatings();\n }\n })\n .catch(err => {\n console.error(err);\n const img = document.querySelector('.js-img');\n img.setAttribute('src', './img/picture/energyflow.png');\n });\n}\n\n// Очіщюємо вміст модалки після закриття\nfunction clearModalContent() {\n const refs = {\n img: document.querySelector('.js-img'),\n title: document.querySelector('.js-title'),\n raiting: document.querySelector('.js-raiting'),\n targetValue: document.querySelector('.js-target'),\n bodyPartValue: document.querySelector('.js-body-part'),\n equipmentValue: document.querySelector('.js-equipment'),\n popularValue: document.querySelector('.js-popular'),\n caloriesValue: document.querySelector('.js-calories'),\n descriptionValue: document.querySelector('.js-description'),\n };\n\n // Встановлюємо пусті значення для всіх елементів модального вікна\n refs.img.setAttribute('src', '');\n refs.title.textContent = '';\n refs.raiting.textContent = '';\n refs.targetValue.textContent = '';\n refs.bodyPartValue.textContent = '';\n refs.equipmentValue.textContent = '';\n refs.popularValue.textContent = '';\n refs.caloriesValue.textContent = '';\n refs.descriptionValue.textContent = '';\n\n // Очищаємо класи зірок рейтингу\n const stars = document.querySelectorAll('.raiting-item .icon-star');\n stars.forEach(star => {\n star.classList.add('non-activ');\n });\n}\n\n// Зірочки\n\nfunction initRatings() {\n let ratingActive, ratingValue;\n\n for (let i = 0; i < raitings.length; i++) {\n const rating = raitings[i];\n initRatings(rating);\n }\n\n function initRatings(rating) {\n initRatingVars(rating);\n\n setRatingActiveWidth();\n }\n\n function initRatingVars(rating) {\n ratingActive = rating.querySelector('.raiting-active');\n ratingValue = rating.getElementsByClassName('raiting-value')[0];\n }\n\n function setRatingActiveWidth(index = ratingValue.innerHTML) {\n const ratingActiveWidth = index / 0.05;\n ratingActive.style.width = `${ratingActiveWidth}%`\n }\n\n}"],"names":["refs","toggleModal","disableScroll","homeButtons","favoritesButtons","currentPath","targetPage","button","enableScroll","event","favoritesButton","homeButton","getAccess","filter","limit","page","typeFilter","id","url","axios","error","quoteOfTheDayHelps","getQuote","formattedDate","format","localInfo","author","quote","data","quoteOfTheDay","err","iziToastFunctions","messageInfo","iziToast","icons","storedArrayAdd","cardID","getIDModul","liElement","updateLicalStorage","emptyArrayAdd","getIdFavorites","updateGallery","removeIdFavorites","cardToRemove","savedCards","card","createCardFavorites","savedCardsStorage","displayFavoriteCards","showRemoveCards","hideRemoveCards","smoothScrollToNextGroup","checkContainerHeight","deleteFavorites","cardId","favoritesItem","container","content","rowsToShow","arr","value","results","dataList","result","markup","createMarkup","favoritesCard","filterCards","name","target","bodyPart","burnedCalories","_id","raitings","openModal","getExercisesObject","closeModal","closeModalByEsc","clearModalContent","rating","equipment","popularity","description","gifUrl","initRatings","star","ratingActive","ratingValue","i","initRatingVars","setRatingActiveWidth","index","ratingActiveWidth"],"mappings":"8vBAAC,IAAM,CACL,MAAMA,EAAO,CACX,aAAc,SAAS,cAAc,mBAAmB,EACxD,cAAe,SAAS,cAAc,gBAAgB,EACtD,MAAO,SAAS,cAAc,WAAW,EACzC,SAAU,SAAS,cAAc,kBAAkB,CACvD,EAEEA,EAAK,MAAM,UAAU,IAAI,WAAW,EAEpCA,EAAK,aAAa,iBAAiB,QAAS,UAAY,CACtDC,IACAC,IAGA,MAAMC,EAAc,SAAS,uBAAuB,mBAAmB,EACjEC,EAAmB,SAAS,uBAAuB,wBAAwB,EAC3EC,EAAc,OAAO,SAAS,SAC9BC,EAAa,iBAEfD,EAAY,SAASC,CAAU,GACjC,QAAQ,IAAI,WAAW,EACvB,MAAM,KAAKF,CAAgB,EAAE,QAAQG,GAAUA,EAAO,UAAU,IAAI,aAAa,CAAC,EAClF,MAAM,KAAKJ,CAAW,EAAE,QAA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AYL,CAAM,CACnB,CAED,SAASK,EAAYL,EAAQ,CAC3BU,EAAeV,CAAM,EAErBW,GACD,CAED,SAASD,EAAeV,EAAQ,CAC9BO,EAAeP,EAAO,cAAc,iBAAiB,EACrDQ,EAAcR,EAAO,uBAAuB,eAAe,EAAE,CAAC,CAC/D,CAED,SAASW,EAAqBC,EAAQJ,EAAY,UAAW,CAC3D,MAAMK,EAAoBD,EAAQ,IAClCL,EAAa,MAAM,MAAQ,GAAGM,CAAiB,GAChD,CAEH"} \ No newline at end of file diff --git a/assets/add-to-favorites-e9afa675.css b/assets/modal-window-e9afa675.css similarity index 100% rename from assets/add-to-favorites-e9afa675.css rename to assets/modal-window-e9afa675.css diff --git a/commonHelpers2.js b/commonHelpers2.js index 6f0ac44..f88bd46 100644 --- a/commonHelpers2.js +++ b/commonHelpers2.js @@ -1,4 +1,4 @@ -import{i as x}from"./assets/add-to-favorites-5dd64793.js";import{a as h,P as E,i as f}from"./assets/vendor-0a7c832e.js";const y={page:1,limit:1,filter:"Muscles"};function g(e){window.innerWidth>=1440?y.limit=9:y.limit=8,l.innerHTML="",b(e,y.page).then(t=>{if(t.results.length===0)document.querySelector(".tui-pagination").style.display="none",l.innerHTML='

    Unfortunately, no results were found. You may want to consider other search options to find the exercise you are looking for. Our range is wide and you have the opportunity to find more options that suit your needs.

    ';else{w(t.results);const s=document.querySelectorAll(".js-animation-exercises");s.forEach(i=>{i.classList.add("animation-items")}),setTimeout(()=>{s.forEach(i=>{i.classList.remove("animation-items")})},500),t.totalPages>1?(document.querySelector(".tui-pagination").style.display="flex",P(t.totalPages).on("afterMove",({page:i})=>{b(e,i).then(m=>{l.innerHTML="",w(m.results);const p=document.querySelectorAll(".js-animation-exercises");p.forEach(v=>{v.classList.add("animation-items")}),setTimeout(()=>{p.forEach(v=>{v.classList.remove("animation-items")})},500)})})):document.querySelector(".tui-pagination").style.display="none"}}).catch(t=>{handleError(t.message)})}async function b(e,t){return n.value.length>0?a.keyword=n.value.trim().toLowerCase():a.keyword="",(await h.get("/exercises",{params:{[e]:a.filterGroup,keyword:a.keyword,page:t,limit:y.limit}})).data}function w(e){let t=e.map(s=>`
  • +import{i as x}from"./assets/modal-window-5ca35ebd.js";import{a as h,P as E,i as f}from"./assets/vendor-0a7c832e.js";const y={page:1,limit:1,filter:"Muscles"};function g(e){window.innerWidth>=1440?y.limit=9:y.limit=8,l.innerHTML="",b(e,y.page).then(t=>{if(t.results.length===0)document.querySelector(".tui-pagination").style.display="none",l.innerHTML='

    Unfortunately, no results were found. You may want to consider other search options to find the exercise you are looking for. Our range is wide and you have the opportunity to find more options that suit your needs.

    ';else{w(t.results);const s=document.querySelectorAll(".js-animation-exercises");s.forEach(i=>{i.classList.add("animation-items")}),setTimeout(()=>{s.forEach(i=>{i.classList.remove("animation-items")})},500),t.totalPages>1?(document.querySelector(".tui-pagination").style.display="flex",P(t.totalPages).on("afterMove",({page:i})=>{b(e,i).then(m=>{l.innerHTML="",w(m.results);const p=document.querySelectorAll(".js-animation-exercises");p.forEach(v=>{v.classList.add("animation-items")}),setTimeout(()=>{p.forEach(v=>{v.classList.remove("animation-items")})},500)})})):document.querySelector(".tui-pagination").style.display="none"}}).catch(t=>{handleError(t.message)})}async function b(e,t){return n.value.length>0?a.keyword=n.value.trim().toLowerCase():a.keyword="",(await h.get("/exercises",{params:{[e]:a.filterGroup,keyword:a.keyword,page:t,limit:y.limit}})).data}function w(e){let t=e.map(s=>`
  • WORKOUT diff --git a/commonHelpers2.js.map b/commonHelpers2.js.map index a14d48e..5069ddc 100644 --- a/commonHelpers2.js.map +++ b/commonHelpers2.js.map @@ -1 +1 @@ -{"version":3,"file":"commonHelpers2.js","sources":["../src/js/body-parts.js","../src/js/search.js","../src/js/pagination.js","../src/js/muscles.js","../src/js/subscribe.js"],"sourcesContent":["// відображення вправ після натискання на картку, перенести потім у файл боді-партс\n\nimport axios from 'axios';\nimport icons from '../img/icons/sprite.svg';\nimport { galleryElement, searchInputField, exerciseParams } from './search.js';\nimport { createPaginationExercisesInner } from './pagination';\nexport { updateExercisesList, loadExercises, renderExercises };\n\nconst params = {\n page: 1,\n limit: 1,\n filter: 'Muscles',\n};\n\n// Ця функція оновлює список вправ на основі наданого фільтра.Він очищає вміст galleryElement.\n\nfunction updateExercisesList(filter) {\n if (window.innerWidth >= 1440) {\n params.limit = 9;\n } else {\n params.limit = 8;\n }\n galleryElement.innerHTML = '';\n loadExercises(filter, params.page)\n .then(data => {\n if (data.results.length === 0) {\n document.querySelector('.tui-pagination').style.display = 'none';\n galleryElement.innerHTML =\n '

    Unfortunately, no results were found. You may want to consider other search options to find the exercise you are looking for. Our range is wide and you have the opportunity to find more options that suit your needs.

    ';\n } else {\n renderExercises(data.results);\n const filterCards = document.querySelectorAll('.js-animation-exercises');\n filterCards.forEach(card => {\n card.classList.add('animation-items');\n });\n const disappearance = setTimeout(() => {\n filterCards.forEach(card => {\n card.classList.remove('animation-items');\n });\n }, 500);\n if (data.totalPages > 1) {\n document.querySelector('.tui-pagination').style.display = 'flex';\n createPaginationExercisesInner(data.totalPages).on(\n 'afterMove',\n ({ page }) => {\n loadExercises(filter, page).then(data => {\n galleryElement.innerHTML = '';\n renderExercises(data.results);\n const filterCards = document.querySelectorAll('.js-animation-exercises');\n filterCards.forEach(card => {\n card.classList.add('animation-items');\n });\n const disappearance = setTimeout(() => {\n filterCards.forEach(card => {\n card.classList.remove('animation-items');\n });\n }, 500);\n });\n }\n );\n } else {\n document.querySelector('.tui-pagination').style.display = 'none';\n }\n }\n\n })\n .catch(error => {\n\n handleError(error.message);\n });\n}\n\n// Ця функція завантажує дані вправ із сервера на основі наданого фільтра.\n\nasync function loadExercises(filter, page) {\n\n if (searchInputField.value.length > 0) {\n exerciseParams.keyword = searchInputField.value.trim().toLowerCase();\n } else {\n exerciseParams.keyword = '';\n }\n const data = await axios.get('/exercises', {\n params: {\n [filter]: exerciseParams.filterGroup,\n keyword: exerciseParams.keyword,\n page,\n limit: params.limit,\n },\n });\n return data.data;\n}\n// Ця функція відтворює дані вправ у DOM. Він приймає отримані дані як вхідні дані. Він генерує HTML-розмітку для кожного елемента вправи за допомогою шаблонних літералів і наданих піктограм.\n\nfunction renderExercises(data) {\n let markup = data\n .map(\n i =>\n `
  • \n
    \n \n WORKOUT\n \n ${(i.rating).toFixed(\n 2\n )}\n \n \n \n \n Start\n \n \n
    \n \n \n

    ${i.name.charAt(0).toUpperCase() + i.name.slice(1)\n }

    \n
    \n
    \n \n Burned calories:\n ${i.burnedCalories} / ${i.time} min\n \n \n Body part:\n ${i.bodyPart.charAt(0).toUpperCase() + i.bodyPart.slice(1)\n }\n \n \n Target:\n ${i.target.charAt(0).toUpperCase() + i.target.slice(1)\n }\n \n
    \n
  • `\n )\n .join('');\n\n galleryElement.innerHTML = markup;\n}\n","import { updateExercisesList } from './body-parts.js';\n\nconst exerciseParams = {\n page: 1,\n keyword: '',\n filter: '',\n filterGroup: '',\n};\n\nconst galleryElement = document.querySelector('.gallery');\nconst searchInputField = document.querySelector('.search-input');\n\nif (galleryElement) {\n galleryElement.addEventListener('click', handleClickOnCard);\n galleryElement.classList.add('exercises-card');\n}\n\nconst refs = {\n searchButton: document.querySelector('.search-btn'),\n clearSearchButton: document.querySelector('.search-clear-btn'),\n filterButtonsContainer: document.querySelector('.exercises-btns-div'),\n searchFormContainer: document.querySelector('.ex-search'),\n sectionHeaderElement: document.querySelector('.exercises-header'),\n}\n\n// обробляємо клік по карточці для групи вправ\n\nfunction handleClickOnCard(event) {\n event.preventDefault();\n if (event.target.closest('ul').dataset.exercises) {\n refs.searchButton.addEventListener('click', handleSearchButtonClick);\n refs.clearSearchButton.addEventListener('click', handleClearSearchInput);\n searchInputField.addEventListener('input', handleSearchInput);\n refs.filterButtonsContainer.addEventListener('click', handleClickOnFilterButton);\n refs.searchFormContainer.style.display = 'block';\n\n const filterButton = document.querySelector('.exercises-button.active');\n exerciseParams.filter = filterButton.dataset.filter;\n exerciseParams.filterGroup = event.target.closest('ul').dataset.exercises;\n const headerContent = `Exercises / ${exerciseParams.filterGroup.charAt(0).toUpperCase() +\n exerciseParams.filterGroup.slice(1)\n }`;\n refs.sectionHeaderElement.innerHTML = headerContent;\n updateExercisesList(exerciseParams.filter);\n }\n return;\n}\n// обробляємо клік по кнопці пошуку і також очищаємо поле пошуку\n\nfunction handleSearchButtonClick(event) {\n event.preventDefault();\n if (searchInputField.value.length > 0) {\n exerciseParams.page = 1;\n exerciseParams.keyword = searchInputField.value.trim().toLowerCase();\n updateExercisesList(exerciseParams.filter, true);\n\n searchInputField.value = '';\n refs.clearSearchButton.style.visibility = 'hidden';\n }\n return;\n}\n\n// Обробка пошукового тексту в полі пошуку\n\nfunction handleSearchInput() {\n if (searchInputField.value.length > 0) {\n refs.clearSearchButton.style.visibility = 'visible';\n } else {\n refs.clearSearchButton.style.visibility = 'hidden';\n }\n}\n\n// Очищаємо поле пошуку при натисканні на кнопку\n\nfunction handleClearSearchInput() {\n searchInputField.value = '';\n refs.clearSearchButton.style.visibility = 'hidden';\n exerciseParams.page = 1;\n updateExercisesList(exerciseParams.filter, exerciseParams.filterGroup);\n}\n\n// Відбувається пошук по пошуковому слову та очищаємо поле пошуку при натисканні на enter\n\nsearchInputField.addEventListener('keypress', function (event) {\n if (event.key === 'Enter') {\n const keyword = searchInputField.value.trim().toLowerCase();\n exerciseParams.keyword = keyword;\n refs.clearSearchButton.style.visibility = 'hidden';\n exerciseParams.page = 1;\n updateExercisesList(exerciseParams.filter, exerciseParams.filterGroup);\n searchInputField.value = '';\n }\n});\n\n// Обробляємо клік по одній з трьох кнопок. Видаляємо слухачі подій. Очищаємо поле пошуку.\n\nfunction handleClickOnFilterButton(event) {\n if (event.target.tagName === 'BUTTON') {\n searchInputField.value = '';\n refs.searchFormContainer.style.display = 'none';\n galleryElement.innerHTML = '';\n galleryElement.classList.remove('exercises-card');\n refs.searchButton.removeEventListener('click', handleSearchButtonClick);\n refs.clearSearchButton.removeEventListener('click', handleClearSearchInput);\n searchInputField.removeEventListener('input', handleSearchInput);\n refs.filterButtonsContainer.removeEventListener(\n 'click',\n handleClickOnFilterButton\n );\n\n exerciseParams.page = 1;\n refs.sectionHeaderElement.innerHTML = 'Exercises';\n }\n}\n\nexport { galleryElement, searchInputField, exerciseParams };\n","import Pagination from 'tui-pagination';\nimport { exerciseParams } from './search.js';\n\nfunction createPaginationExercisesInner(totalPages) {\n if (window.innerWidth >= 1440) {\n exerciseParams.limit = 9;\n } else {\n exerciseParams.limit = 8;\n }\n\n const container = document.querySelector('.tui-pagination');\n const options = {\n totalItems: exerciseParams.limit * totalPages,\n itemsPerPage: exerciseParams.limit,\n visiblePages: 3,\n centerAlign: true,\n };\n\n const instance = new Pagination(container, options);\n\n return instance;\n}\n\nfunction createPaginationExercisesOuter(totalPages) {\n if (window.innerWidth >= 768) {\n exerciseParams.limit = 12;\n } else {\n exerciseParams.limit = 8;\n }\n\n const container = document.querySelector('.tui-pagination');\n const options = {\n totalItems: exerciseParams.limit * totalPages,\n itemsPerPage: exerciseParams.limit,\n visiblePages: 3,\n centerAlign: true,\n };\n\n const instance = new Pagination(container, options);\n\n return instance;\n}\n\nexport { createPaginationExercisesInner, createPaginationExercisesOuter };\n","import axios from 'axios';\nimport iziToast from 'izitoast';\nimport { createPaginationExercisesOuter } from './pagination';\n\nconst refs = {\n gallery: document.querySelector('.gallery'),\n buttons: document.querySelector('.exercises-btns-div'),\n musclesBtn: document.querySelector('[data-filter=\"muscles\"]'),\n bodypartsBtn: document.querySelector('[data-filter=\"bodypart\"]'),\n equipBtn: document.querySelector('[data-filter=\"equipment\"]'),\n};\n\naxios.defaults.baseURL = 'https://energyflow.b.goit.study/api';\nfunction getLoader(act = 'show') {\n const loader = document.querySelector('.loader');\n if (act === 'show') {\n loader.style.display = 'inline-block';\n } else {\n loader.style.display = 'none';\n }\n}\n\nconst params = {\n page: 1,\n limit: 1,\n filter: 'Muscles',\n};\n\nasync function getData(page) {\n getLoader();\n const data = await axios.get('/filters', {\n params: {\n filter: params.filter,\n limit: params.limit,\n page,\n },\n });\n\n return data.data;\n}\n\nfunction handleError(message) {\n iziToast.error({\n position: 'topRight',\n message: message,\n });\n}\n\nfunction createMarkup(results) {\n refs.gallery.innerHTML = '';\n const markup = results\n .map(\n ({ name, filter, imgUrl }) => `
  • \n \n \"Galllery\n
      \n
    • ${name}
    • \n
    • ${filter}
    • \n
    \n
    \n
  • `\n )\n .join('');\n\n refs.gallery.innerHTML = markup;\n\n const filterCards = document.querySelectorAll('.js-animation');\n filterCards.forEach(card => {\n card.classList.add('animation-items');\n });\n const disappearance = setTimeout(() => {\n filterCards.forEach(card => {\n card.classList.remove('animation-items');\n });\n }, 500);\n}\n\nasync function handleSearch() {\n // Отримати дані з оновленим фільтром\n if (window.innerWidth >= 768) {\n params.limit = 12;\n } else {\n params.limit = 8;\n }\n getData(params.page)\n .then(data => {\n const { results } = data;\n createMarkup(results);\n if (data.totalPages > 1) {\n document.querySelector('.tui-pagination').style.display = 'flex';\n createPaginationExercisesOuter(data.totalPages).on(\n 'afterMove',\n ({ page }) => {\n getData(page).then(data => {\n const { results } = data;\n refs.gallery.innerHTML = '';\n createMarkup(results);\n });\n }\n );\n } else {\n document.querySelector('.tui-pagination').style.display = 'none';\n }\n })\n .catch(error => {\n handleError(error.message);\n });\n}\nhandleSearch();\nrefs.musclesBtn.classList.add('active');\n\nrefs.buttons.addEventListener('click', event => {\n selected(event);\n const targetMenu = event.target;\n\n if (targetMenu === event.currentTarget) {\n return;\n } else if (targetMenu === refs.musclesBtn) {\n // Оновити фільтр на 'Muscles'\n params.filter = 'Muscles';\n } else if (targetMenu === refs.bodypartsBtn) {\n // Оновити фільтр на 'Body parts'\n params.filter = 'Body parts';\n } else if (targetMenu === refs.equipBtn) {\n // Оновити фільтр на 'Equipment'\n params.filter = 'Equipment';\n }\n handleSearch();\n});\n\nlet prevButton = null;\n\nfunction selected(e) {\n const isButton = e.target.nodeName === 'BUTTON';\n refs.musclesBtn.classList.remove('active');\n\n if (!isButton) {\n return;\n }\n\n e.target.classList.add('active');\n\n if (prevButton !== null) {\n prevButton.classList.remove('active');\n }\n prevButton = e.target;\n\n if (prevButton === prevButton) {\n prevButton.classList.add('active');\n }\n}\n","import axios from 'axios';\nimport iziToast from 'izitoast';\nimport 'izitoast/dist/css/iziToast.min.css';\n\nconst refs = {\n emailPattern: /^[\\w-]+(\\.[\\w-]+)*@([\\w-]+\\.)+[a-zA-Z]{2,7}$/,\n footerForm: document.querySelector('.footer-subscription-form'),\n footerInput: document.querySelector('.footer-subscription-input'),\n feedbackForm: \"feedback-subscribe-state\",\n}\n\nconst subscribeEmail = async (email) => {\n try {\n const response = await axios.post('https://energyflow.b.goit.study/api/subscription', { email });\n return response.data;\n } catch (error) {\n throw error;\n }\n};\n\nconst subscribeValidity = async (event) => {\n event.preventDefault();\n\n const email = refs.footerInput.value.trim();\n\n if (!refs.emailPattern.test(email)) {\n iziToast.error({\n message: 'Enter the correct email!'\n });\n } else {\n try {\n await subscribeEmail(email);\n iziToast.success({\n message: 'Successful subscription!'\n });\n } catch (error) {\n iziToast.error({\n message: 'The user with this address is already subscribed!'\n });\n }\n\n localStorage.removeItem(refs.feedbackForm);\n refs.footerForm.reset();\n }\n};\n\nrefs.footerForm.addEventListener('submit', subscribeValidity);\n\nrefs.footerForm.addEventListener('input', () => {\n const footerEmail = refs.footerInput.value.trim();\n const formData = JSON.stringify({ footerEmail });\n localStorage.setItem(refs.feedbackForm, formData);\n});"],"names":["params","updateExercisesList","filter","galleryElement","loadExercises","data","renderExercises","filterCards","card","createPaginationExercisesInner","page","error","searchInputField","exerciseParams","axios","markup","i","icons","handleClickOnCard","refs","event","handleSearchButtonClick","handleClearSearchInput","handleSearchInput","handleClickOnFilterButton","filterButton","headerContent","keyword","totalPages","container","options","Pagination","createPaginationExercisesOuter","getLoader","act","loader","getData","handleError","message","iziToast","createMarkup","results","name","imgUrl","handleSearch","selected","targetMenu","prevButton","isButton","subscribeEmail","email","subscribeValidity","footerEmail","formData"],"mappings":"wHAQA,MAAMA,EAAS,CAC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S,cAAc,4BAA4B,EAChE,aAAc,0BAClB,EAEM8B,EAAiB,MAAOC,GAAU,CACpC,GAAI,CAEA,OADiB,MAAMpC,EAAM,KAAK,mDAAoD,CAAE,MAAAoC,CAAK,CAAE,GAC/E,IACnB,OAAQvC,EAAO,CACZ,MAAMA,CACT,CACL,EAEMwC,EAAoB,MAAO/B,GAAU,CACvCA,EAAM,eAAc,EAEpB,MAAM8B,EAAQ/B,EAAK,YAAY,MAAM,KAAI,EAEzC,GAAI,CAACA,EAAK,aAAa,KAAK+B,CAAK,EAC7BX,EAAS,MAAM,CACX,QAAS,0BACrB,CAAS,MACE,CACH,GAAI,CACA,MAAMU,EAAeC,CAAK,EAC1BX,EAAS,QAAQ,CACb,QAAS,0BACzB,CAAa,CACJ,MAAe,CACZA,EAAS,MAAM,CACX,QAAS,mDACzB,CAAa,CACJ,CAED,aAAa,WAAWpB,EAAK,YAAY,EACzCA,EAAK,WAAW,OACnB,CACL,EAEAA,EAAK,WAAW,iBAAiB,SAAUgC,CAAiB,EAE5DhC,EAAK,WAAW,iBAAiB,QAAS,IAAM,CAC5C,MAAMiC,EAAcjC,EAAK,YAAY,MAAM,KAAI,EACzCkC,EAAW,KAAK,UAAU,CAAE,YAAAD,CAAa,CAAA,EAC/C,aAAa,QAAQjC,EAAK,aAAckC,CAAQ,CACpD,CAAC"} \ No newline at end of file +{"version":3,"file":"commonHelpers2.js","sources":["../src/js/body-parts.js","../src/js/search.js","../src/js/pagination.js","../src/js/muscles.js","../src/js/subscribe.js"],"sourcesContent":["// відображення вправ після натискання на картку, перенести потім у файл боді-партс\n\nimport axios from 'axios';\nimport icons from '../img/icons/sprite.svg';\nimport { galleryElement, searchInputField, exerciseParams } from './search.js';\nimport { createPaginationExercisesInner } from './pagination';\nexport { updateExercisesList, loadExercises, renderExercises };\n\nconst params = {\n page: 1,\n limit: 1,\n filter: 'Muscles',\n};\n\n// Ця функція оновлює список вправ на основі наданого фільтра.Він очищає вміст galleryElement.\n\nfunction updateExercisesList(filter) {\n if (window.innerWidth >= 1440) {\n params.limit = 9;\n } else {\n params.limit = 8;\n }\n galleryElement.innerHTML = '';\n loadExercises(filter, params.page)\n .then(data => {\n if (data.results.length === 0) {\n document.querySelector('.tui-pagination').style.display = 'none';\n galleryElement.innerHTML =\n '

    Unfortunately, no results were found. You may want to consider other search options to find the exercise you are looking for. Our range is wide and you have the opportunity to find more options that suit your needs.

    ';\n } else {\n renderExercises(data.results);\n const filterCards = document.querySelectorAll('.js-animation-exercises');\n filterCards.forEach(card => {\n card.classList.add('animation-items');\n });\n const disappearance = setTimeout(() => {\n filterCards.forEach(card => {\n card.classList.remove('animation-items');\n });\n }, 500);\n if (data.totalPages > 1) {\n document.querySelector('.tui-pagination').style.display = 'flex';\n createPaginationExercisesInner(data.totalPages).on(\n 'afterMove',\n ({ page }) => {\n loadExercises(filter, page).then(data => {\n galleryElement.innerHTML = '';\n renderExercises(data.results);\n const filterCards = document.querySelectorAll('.js-animation-exercises');\n filterCards.forEach(card => {\n card.classList.add('animation-items');\n });\n const disappearance = setTimeout(() => {\n filterCards.forEach(card => {\n card.classList.remove('animation-items');\n });\n }, 500);\n });\n }\n );\n } else {\n document.querySelector('.tui-pagination').style.display = 'none';\n }\n }\n\n })\n .catch(error => {\n\n handleError(error.message);\n });\n}\n\n// Ця функція завантажує дані вправ із сервера на основі наданого фільтра.\n\nasync function loadExercises(filter, page) {\n\n if (searchInputField.value.length > 0) {\n exerciseParams.keyword = searchInputField.value.trim().toLowerCase();\n } else {\n exerciseParams.keyword = '';\n }\n const data = await axios.get('/exercises', {\n params: {\n [filter]: exerciseParams.filterGroup,\n keyword: exerciseParams.keyword,\n page,\n limit: params.limit,\n },\n });\n return data.data;\n}\n// Ця функція відтворює дані вправ у DOM. Він приймає отримані дані як вхідні дані. Він генерує HTML-розмітку для кожного елемента вправи за допомогою шаблонних літералів і наданих піктограм.\n\nfunction renderExercises(data) {\n let markup = data\n .map(\n i =>\n `
  • \n
    \n \n WORKOUT\n \n ${(i.rating).toFixed(\n 2\n )}\n \n \n \n \n Start\n \n \n
    \n \n \n

    ${i.name.charAt(0).toUpperCase() + i.name.slice(1)\n }

    \n
    \n
    \n \n Burned calories:\n ${i.burnedCalories} / ${i.time} min\n \n \n Body part:\n ${i.bodyPart.charAt(0).toUpperCase() + i.bodyPart.slice(1)\n }\n \n \n Target:\n ${i.target.charAt(0).toUpperCase() + i.target.slice(1)\n }\n \n
    \n
  • `\n )\n .join('');\n\n galleryElement.innerHTML = markup;\n}\n","import { updateExercisesList } from './body-parts.js';\n\nconst exerciseParams = {\n page: 1,\n keyword: '',\n filter: '',\n filterGroup: '',\n};\n\nconst galleryElement = document.querySelector('.gallery');\nconst searchInputField = document.querySelector('.search-input');\n\nif (galleryElement) {\n galleryElement.addEventListener('click', handleClickOnCard);\n galleryElement.classList.add('exercises-card');\n}\n\nconst refs = {\n searchButton: document.querySelector('.search-btn'),\n clearSearchButton: document.querySelector('.search-clear-btn'),\n filterButtonsContainer: document.querySelector('.exercises-btns-div'),\n searchFormContainer: document.querySelector('.ex-search'),\n sectionHeaderElement: document.querySelector('.exercises-header'),\n}\n\n// обробляємо клік по карточці для групи вправ\n\nfunction handleClickOnCard(event) {\n event.preventDefault();\n if (event.target.closest('ul').dataset.exercises) {\n refs.searchButton.addEventListener('click', handleSearchButtonClick);\n refs.clearSearchButton.addEventListener('click', handleClearSearchInput);\n searchInputField.addEventListener('input', handleSearchInput);\n refs.filterButtonsContainer.addEventListener('click', handleClickOnFilterButton);\n refs.searchFormContainer.style.display = 'block';\n\n const filterButton = document.querySelector('.exercises-button.active');\n exerciseParams.filter = filterButton.dataset.filter;\n exerciseParams.filterGroup = event.target.closest('ul').dataset.exercises;\n const headerContent = `Exercises / ${exerciseParams.filterGroup.charAt(0).toUpperCase() +\n exerciseParams.filterGroup.slice(1)\n }`;\n refs.sectionHeaderElement.innerHTML = headerContent;\n updateExercisesList(exerciseParams.filter);\n }\n return;\n}\n// обробляємо клік по кнопці пошуку і також очищаємо поле пошуку\n\nfunction handleSearchButtonClick(event) {\n event.preventDefault();\n if (searchInputField.value.length > 0) {\n exerciseParams.page = 1;\n exerciseParams.keyword = searchInputField.value.trim().toLowerCase();\n updateExercisesList(exerciseParams.filter, true);\n\n searchInputField.value = '';\n refs.clearSearchButton.style.visibility = 'hidden';\n }\n return;\n}\n\n// Обробка пошукового тексту в полі пошуку\n\nfunction handleSearchInput() {\n if (searchInputField.value.length > 0) {\n refs.clearSearchButton.style.visibility = 'visible';\n } else {\n refs.clearSearchButton.style.visibility = 'hidden';\n }\n}\n\n// Очищаємо поле пошуку при натисканні на кнопку\n\nfunction handleClearSearchInput() {\n searchInputField.value = '';\n refs.clearSearchButton.style.visibility = 'hidden';\n exerciseParams.page = 1;\n updateExercisesList(exerciseParams.filter, exerciseParams.filterGroup);\n}\n\n// Відбувається пошук по пошуковому слову та очищаємо поле пошуку при натисканні на enter\n\nsearchInputField.addEventListener('keypress', function (event) {\n if (event.key === 'Enter') {\n const keyword = searchInputField.value.trim().toLowerCase();\n exerciseParams.keyword = keyword;\n refs.clearSearchButton.style.visibility = 'hidden';\n exerciseParams.page = 1;\n updateExercisesList(exerciseParams.filter, exerciseParams.filterGroup);\n searchInputField.value = '';\n }\n});\n\n// Обробляємо клік по одній з трьох кнопок. Видаляємо слухачі подій. Очищаємо поле пошуку.\n\nfunction handleClickOnFilterButton(event) {\n if (event.target.tagName === 'BUTTON') {\n searchInputField.value = '';\n refs.searchFormContainer.style.display = 'none';\n galleryElement.innerHTML = '';\n galleryElement.classList.remove('exercises-card');\n refs.searchButton.removeEventListener('click', handleSearchButtonClick);\n refs.clearSearchButton.removeEventListener('click', handleClearSearchInput);\n searchInputField.removeEventListener('input', handleSearchInput);\n refs.filterButtonsContainer.removeEventListener(\n 'click',\n handleClickOnFilterButton\n );\n\n exerciseParams.page = 1;\n refs.sectionHeaderElement.innerHTML = 'Exercises';\n }\n}\n\nexport { galleryElement, searchInputField, exerciseParams };\n","import Pagination from 'tui-pagination';\nimport { exerciseParams } from './search.js';\n\nfunction createPaginationExercisesInner(totalPages) {\n if (window.innerWidth >= 1440) {\n exerciseParams.limit = 9;\n } else {\n exerciseParams.limit = 8;\n }\n\n const container = document.querySelector('.tui-pagination');\n const options = {\n totalItems: exerciseParams.limit * totalPages,\n itemsPerPage: exerciseParams.limit,\n visiblePages: 3,\n centerAlign: true,\n };\n\n const instance = new Pagination(container, options);\n\n return instance;\n}\n\nfunction createPaginationExercisesOuter(totalPages) {\n if (window.innerWidth >= 768) {\n exerciseParams.limit = 12;\n } else {\n exerciseParams.limit = 8;\n }\n\n const container = document.querySelector('.tui-pagination');\n const options = {\n totalItems: exerciseParams.limit * totalPages,\n itemsPerPage: exerciseParams.limit,\n visiblePages: 3,\n centerAlign: true,\n };\n\n const instance = new Pagination(container, options);\n\n return instance;\n}\n\nexport { createPaginationExercisesInner, createPaginationExercisesOuter };\n","import axios from 'axios';\nimport iziToast from 'izitoast';\nimport { createPaginationExercisesOuter } from './pagination';\n\nconst refs = {\n gallery: document.querySelector('.gallery'),\n buttons: document.querySelector('.exercises-btns-div'),\n musclesBtn: document.querySelector('[data-filter=\"muscles\"]'),\n bodypartsBtn: document.querySelector('[data-filter=\"bodypart\"]'),\n equipBtn: document.querySelector('[data-filter=\"equipment\"]'),\n};\n\naxios.defaults.baseURL = 'https://energyflow.b.goit.study/api';\nfunction getLoader(act = 'show') {\n const loader = document.querySelector('.loader');\n if (act === 'show') {\n loader.style.display = 'inline-block';\n } else {\n loader.style.display = 'none';\n }\n}\n\nconst params = {\n page: 1,\n limit: 1,\n filter: 'Muscles',\n};\n\nasync function getData(page) {\n getLoader();\n const data = await axios.get('/filters', {\n params: {\n filter: params.filter,\n limit: params.limit,\n page,\n },\n });\n\n return data.data;\n}\n\nfunction handleError(message) {\n iziToast.error({\n position: 'topRight',\n message: message,\n });\n}\n\nfunction createMarkup(results) {\n refs.gallery.innerHTML = '';\n const markup = results\n .map(\n ({ name, filter, imgUrl }) => `
  • \n \n \"Galllery\n
      \n
    • ${name}
    • \n
    • ${filter}
    • \n
    \n
    \n
  • `\n )\n .join('');\n\n refs.gallery.innerHTML = markup;\n\n const filterCards = document.querySelectorAll('.js-animation');\n filterCards.forEach(card => {\n card.classList.add('animation-items');\n });\n const disappearance = setTimeout(() => {\n filterCards.forEach(card => {\n card.classList.remove('animation-items');\n });\n }, 500);\n}\n\nasync function handleSearch() {\n // Отримати дані з оновленим фільтром\n if (window.innerWidth >= 768) {\n params.limit = 12;\n } else {\n params.limit = 8;\n }\n getData(params.page)\n .then(data => {\n const { results } = data;\n createMarkup(results);\n if (data.totalPages > 1) {\n document.querySelector('.tui-pagination').style.display = 'flex';\n createPaginationExercisesOuter(data.totalPages).on(\n 'afterMove',\n ({ page }) => {\n getData(page).then(data => {\n const { results } = data;\n refs.gallery.innerHTML = '';\n createMarkup(results);\n });\n }\n );\n } else {\n document.querySelector('.tui-pagination').style.display = 'none';\n }\n })\n .catch(error => {\n handleError(error.message);\n });\n}\nhandleSearch();\nrefs.musclesBtn.classList.add('active');\n\nrefs.buttons.addEventListener('click', event => {\n selected(event);\n const targetMenu = event.target;\n\n if (targetMenu === event.currentTarget) {\n return;\n } else if (targetMenu === refs.musclesBtn) {\n // Оновити фільтр на 'Muscles'\n params.filter = 'Muscles';\n } else if (targetMenu === refs.bodypartsBtn) {\n // Оновити фільтр на 'Body parts'\n params.filter = 'Body parts';\n } else if (targetMenu === refs.equipBtn) {\n // Оновити фільтр на 'Equipment'\n params.filter = 'Equipment';\n }\n handleSearch();\n});\n\nlet prevButton = null;\n\nfunction selected(e) {\n const isButton = e.target.nodeName === 'BUTTON';\n refs.musclesBtn.classList.remove('active');\n\n if (!isButton) {\n return;\n }\n\n e.target.classList.add('active');\n\n if (prevButton !== null) {\n prevButton.classList.remove('active');\n }\n prevButton = e.target;\n\n if (prevButton === prevButton) {\n prevButton.classList.add('active');\n }\n}\n","import axios from 'axios';\nimport iziToast from 'izitoast';\nimport 'izitoast/dist/css/iziToast.min.css';\n\nconst refs = {\n emailPattern: /^[\\w-]+(\\.[\\w-]+)*@([\\w-]+\\.)+[a-zA-Z]{2,7}$/,\n footerForm: document.querySelector('.footer-subscription-form'),\n footerInput: document.querySelector('.footer-subscription-input'),\n feedbackForm: \"feedback-subscribe-state\",\n}\n\nconst subscribeEmail = async (email) => {\n try {\n const response = await axios.post('https://energyflow.b.goit.study/api/subscription', { email });\n return response.data;\n } catch (error) {\n throw error;\n }\n};\n\nconst subscribeValidity = async (event) => {\n event.preventDefault();\n\n const email = refs.footerInput.value.trim();\n\n if (!refs.emailPattern.test(email)) {\n iziToast.error({\n message: 'Enter the correct email!'\n });\n } else {\n try {\n await subscribeEmail(email);\n iziToast.success({\n message: 'Successful subscription!'\n });\n } catch (error) {\n iziToast.error({\n message: 'The user with this address is already subscribed!'\n });\n }\n\n localStorage.removeItem(refs.feedbackForm);\n refs.footerForm.reset();\n }\n};\n\nrefs.footerForm.addEventListener('submit', subscribeValidity);\n\nrefs.footerForm.addEventListener('input', () => {\n const footerEmail = refs.footerInput.value.trim();\n const formData = JSON.stringify({ footerEmail });\n localStorage.setItem(refs.feedbackForm, formData);\n});"],"names":["params","updateExercisesList","filter","galleryElement","loadExercises","data","renderExercises","filterCards","card","createPaginationExercisesInner","page","error","searchInputField","exerciseParams","axios","markup","i","icons","handleClickOnCard","refs","event","handleSearchButtonClick","handleClearSearchInput","handleSearchInput","handleClickOnFilterButton","filterButton","headerContent","keyword","totalPages","container","options","Pagination","createPaginationExercisesOuter","getLoader","act","loader","getData","handleError","message","iziToast","createMarkup","results","name","imgUrl","handleSearch","selected","targetMenu","prevButton","isButton","subscribeEmail","email","subscribeValidity","footerEmail","formData"],"mappings":"oHAQA,MAAMA,EAAS,CACb,KAAM,EACN,MAAO,EACP,OAAQ,SACV,EAIA,SAASC,EAAoBC,EAAQ,CAC/B,OAAO,YAAc,KACvBF,EAAO,MAAQ,EAEfA,EAAO,MAAQ,EAEjBG,EAAe,UAAY,GAC3BC,EAAcF,EA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vC,EAAO,CACZ,MAAMA,CACT,CACL,EAEMwC,EAAoB,MAAO/B,GAAU,CACvCA,EAAM,eAAc,EAEpB,MAAM8B,EAAQ/B,EAAK,YAAY,MAAM,KAAI,EAEzC,GAAI,CAACA,EAAK,aAAa,KAAK+B,CAAK,EAC7BX,EAAS,MAAM,CACX,QAAS,0BACrB,CAAS,MACE,CACH,GAAI,CACA,MAAMU,EAAeC,CAAK,EAC1BX,EAAS,QAAQ,CACb,QAAS,0BACzB,CAAa,CACJ,MAAe,CACZA,EAAS,MAAM,CACX,QAAS,mDACzB,CAAa,CACJ,CAED,aAAa,WAAWpB,EAAK,YAAY,EACzCA,EAAK,WAAW,OACnB,CACL,EAEAA,EAAK,WAAW,iBAAiB,SAAUgC,CAAiB,EAE5DhC,EAAK,WAAW,iBAAiB,QAAS,IAAM,CAC5C,MAAMiC,EAAcjC,EAAK,YAAY,MAAM,KAAI,EACzCkC,EAAW,KAAK,UAAU,CAAE,YAAAD,CAAa,CAAA,EAC/C,aAAa,QAAQjC,EAAK,aAAckC,CAAQ,CACpD,CAAC"} \ No newline at end of file diff --git a/favorites.html b/favorites.html index ff9a1d2..04018da 100644 --- a/favorites.html +++ b/favorites.html @@ -11,8 +11,8 @@ EnergyFlow - - + + diff --git a/index.html b/index.html index 38b2663..07f079f 100644 --- a/index.html +++ b/index.html @@ -12,9 +12,9 @@ - + - +