From fa75a8cea71f71b8da4751984fcfb94398e31819 Mon Sep 17 00:00:00 2001 From: ViktorSvertoka Date: Sun, 17 Dec 2023 22:38:27 +0000 Subject: [PATCH] =?UTF-8?q?Deploying=20to=20gh-pages=20from=20@=20ViktorSv?= =?UTF-8?q?ertoka/your-energy@95bb8dacdad60fce9fe5717bed9e60196aa59264=20?= =?UTF-8?q?=F0=9F=9A=80?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- assets/index-f0ba0118.js | 41 ---------------------------------------- assets/index-f25c9eb1.js | 41 ++++++++++++++++++++++++++++++++++++++++ index.html | 6 +++--- 3 files changed, 44 insertions(+), 44 deletions(-) delete mode 100644 assets/index-f0ba0118.js create mode 100644 assets/index-f25c9eb1.js diff --git a/assets/index-f0ba0118.js b/assets/index-f0ba0118.js deleted file mode 100644 index 71dc046..0000000 --- a/assets/index-f0ba0118.js +++ /dev/null @@ -1,41 +0,0 @@ -import{A as H,i as N,a as me}from"./05-modal-exercises-50014dae.js";const ge=new H,X=document.querySelector(".js-list");V("Muscles");async function V(r){try{const d=await ge.getFilter(r);ve(d)}catch(d){console.log(d)}}function ve(r){const d=r.map(({filter:p,name:f,imgURL:n})=>` -
  • - -
    -

    ${p}

    -

    ${f}

    -
    -
  • - `).join("");X.insertAdjacentHTML("beforeend",d)}document.querySelectorAll(".btnFilters").forEach(r=>{r.addEventListener("click",()=>{const d=r.innerText;X.innerHTML="",V(d)})});const he=new H,R=document.querySelector(".js-list"),$=document.querySelector(".search__form");R.addEventListener("click",ye);async function ye(r){if(!r.target.closest(".filters__item"))return;$.classList.remove("hidden");const d=r.target.closest(".filters__item");let p=d.lastElementChild.children[0].innerText.toLowerCase().replace(/\s/g,"");const f=d.lastElementChild.children[1].innerText.toLowerCase().replace(/\s/g,"%20");p==="bodyparts"&&(p="bodypart");const n={filter:p,name:f};localStorage.setItem("paramSearch",JSON.stringify(n));try{const v=await he.getExercises(p,f);P(v)}catch(v){console.log(v)}}function P(r){R.innerHTML="";const d=r.map(({_id:p,rating:f,name:n,burnedCalories:v,bodyPart:B,target:M})=>` -
  • -
    -
    -

    Workout

    - - ${f} - - - - - -
    -
    -
    - - - -
    -

    ${n}

    -
    -
    -

    Burned calories:${v}

    -

    Body part:${B}

    -

    Target:${M}

    -
    -
    -
  • `).join("");R.insertAdjacentHTML("beforeend",d)}document.addEventListener("DOMContentLoaded",()=>{const r=document.querySelectorAll(".exercises__btn");r.forEach(d=>{d.addEventListener("click",()=>{r.forEach(p=>p.classList.remove("active")),d.classList.add("active"),$.classList.add("hidden")})})});const be=new H,Le=document.querySelector(".search__button"),J=document.querySelector(".search__input");Le.addEventListener("click",function(r){r.preventDefault(),Y()});J.addEventListener("keydown",function(r){r.key==="Enter"&&(r.preventDefault(),Y())});async function Y(r){const{filter:d,name:p}=JSON.parse(localStorage.getItem("paramSearch")),f=J.value.trim();if(f!=="")try{const n=await be.getSearch(d,p,f);P(n)}catch(n){console.log(n)}}const Ee=document.querySelector(".footer__link"),S=document.querySelector(".team__backdrop"),K=document.querySelector(".team__modal-close-btn");function we(r){r.preventDefault(),S.classList.remove("is-hidden"),document.body.classList.add("modal-open"),Ce()}function Q(r){r.preventDefault(),r.code==="Escape"&&j()}function Z(r){r.target.closest(".team__wrapper")||j()}function ee(r){r.preventDefault(),j()}function Ce(){document.addEventListener("keydown",Q),S.addEventListener("click",Z),K.addEventListener("click",ee)}function j(){document.removeEventListener("keydown",Q),S.removeEventListener("click",Z),K.removeEventListener("click",ee),S.classList.add("is-hidden"),document.body.classList.remove("modal-open")}Ee.addEventListener("click",we);const D=document.querySelector(".scroll__go-top");D.addEventListener("click",te);window.addEventListener("scroll",Ie);function Ie(){const r=window.pageYOffset,d=document.documentElement.clientHeight;r>d?D.classList.add("scroll__go-top--show"):D.classList.remove("scroll__go-top--show")}function te(){window.pageYOffset>0&&(window.scrollBy(0,-75),setTimeout(te,0))}var I=typeof globalThis<"u"?globalThis:typeof window<"u"?window:typeof global<"u"?global:typeof self<"u"?self:{};function Te(r){return r&&r.__esModule&&Object.prototype.hasOwnProperty.call(r,"default")?r.default:r}var ne={exports:{}};(function(r,d){(function(p,f){r.exports=f(p)})(typeof I<"u"?I:window||I.window||I.global,function(p){var f={},n="iziToast";document.querySelector("body");var v=!!/Mobi/.test(navigator.userAgent),B=/Chrome/.test(navigator.userAgent)&&/Google Inc/.test(navigator.vendor),M=typeof InstallTrigger<"u",L="ontouchstart"in document.documentElement,F=["bottomRight","bottomLeft","bottomCenter","topRight","topLeft","topCenter","center"],ce={info:{color:"blue",icon:"ico-info"},success:{color:"green",icon:"ico-success"},warning:{color:"orange",icon:"ico-warning"},error:{color:"red",icon:"ico-error"},question:{color:"yellow",icon:"ico-question"}},E=568,w={};f.children={};var O={id:null,class:"",title:"",titleColor:"",titleSize:"",titleLineHeight:"",message:"",messageColor:"",messageSize:"",messageLineHeight:"",backgroundColor:"",theme:"light",color:"",icon:"",iconText:"",iconColor:"",iconUrl:null,image:"",imageWidth:50,maxWidth:null,zindex:null,layout:1,balloon:!1,close:!0,closeOnEscape:!1,closeOnClick:!1,displayMode:0,position:"bottomRight",target:"",targetFirst:!0,timeout:5e3,rtl:!1,animateInside:!0,drag:!0,pauseOnHover:!0,resetOnHover:!1,progressBar:!0,progressBarColor:"",progressBarEasing:"linear",overlay:!1,overlayClose:!1,overlayColor:"rgba(0, 0, 0, 0.6)",transitionIn:"fadeInUp",transitionOut:"fadeOut",transitionInMobile:"fadeInUp",transitionOutMobile:"fadeOutDown",buttons:{},inputs:{},onOpening:function(){},onOpened:function(){},onClosing:function(){},onClosed:function(){}};if("remove"in Element.prototype||(Element.prototype.remove=function(){this.parentNode&&this.parentNode.removeChild(this)}),typeof window.CustomEvent!="function"){var G=function(o,i){i=i||{bubbles:!1,cancelable:!1,detail:void 0};var e=document.createEvent("CustomEvent");return e.initCustomEvent(o,i.bubbles,i.cancelable,i.detail),e};G.prototype=window.Event.prototype,window.CustomEvent=G}var g=function(o,i,e){if(Object.prototype.toString.call(o)==="[object Object]")for(var t in o)Object.prototype.hasOwnProperty.call(o,t)&&i.call(e,o[t],t,o);else if(o)for(var a=0,c=o.length;a0?(a=(s-t)/s,a"u"&&(i.classList.remove(n+"-reseted"),s!==null&&(s.style.transition="width "+c.timeout+"ms "+c.progressBarEasing,s.style.width="0%"),c.time.START=new Date().getTime(),c.time.END=c.time.START+c.timeout,c.time.TIMER=setTimeout(function(){clearTimeout(c.time.TIMER),i.classList.contains(n+"-closing")||(t.hide(c,i,"timeout"),typeof e=="function"&&e.apply(t))},c.timeout),t.setSetting(a,"time",c.time))},pause:function(){if(typeof c.time.START<"u"&&!i.classList.contains(n+"-paused")&&!i.classList.contains(n+"-reseted")){if(i.classList.add(n+"-paused"),c.time.REMAINING=c.time.END-new Date().getTime(),clearTimeout(c.time.TIMER),t.setSetting(a,"time",c.time),s!==null){var l=window.getComputedStyle(s),u=l.getPropertyValue("width");s.style.transition="none",s.style.width=u}typeof e=="function"&&setTimeout(function(){e.apply(t)},10)}},resume:function(){typeof c.time.REMAINING<"u"?(i.classList.remove(n+"-paused"),s!==null&&(s.style.transition="width "+c.time.REMAINING+"ms "+c.progressBarEasing,s.style.width="0%"),c.time.END=new Date().getTime()+c.time.REMAINING,c.time.TIMER=setTimeout(function(){clearTimeout(c.time.TIMER),i.classList.contains(n+"-closing")||(t.hide(c,i,"timeout"),typeof e=="function"&&e.apply(t))},c.time.REMAINING),t.setSetting(a,"time",c.time)):this.start()},reset:function(){clearTimeout(c.time.TIMER),delete c.time.REMAINING,t.setSetting(a,"time",c.time),i.classList.add(n+"-reseted"),i.classList.remove(n+"-paused"),s!==null&&(s.style.transition="none",s.style.width="100%"),typeof e=="function"&&setTimeout(function(){e.apply(t)},10)}}},f.hide=function(o,i,e){typeof i!="object"&&(i=document.querySelector(i));var t=this,a=h(this.children[i.getAttribute("data-iziToast-ref")],o||{});a.closedBy=e||null,delete a.time.REMAINING,i.classList.add(n+"-closing"),function(){var l=document.querySelector("."+n+"-overlay");if(l!==null){var u=l.getAttribute("data-iziToast-ref");u=u.split(",");var m=u.indexOf(String(a.ref));m!==-1&&u.splice(m,1),l.setAttribute("data-iziToast-ref",u.join()),u.length===0&&(l.classList.remove("fadeIn"),l.classList.add("fadeOut"),setTimeout(function(){l.remove()},700))}}(),a.transitionIn&&i.classList.remove(a.transitionIn),a.transitionInMobile&&i.classList.remove(a.transitionInMobile),v||window.innerWidth<=E?a.transitionOutMobile&&i.classList.add(a.transitionOutMobile):a.transitionOut&&i.classList.add(a.transitionOut);var c=i.parentNode.offsetHeight;i.parentNode.style.height=c+"px",i.style.pointerEvents="none",(!v||window.innerWidth>E)&&(i.parentNode.style.transitionDelay="0.2s");try{var s=new CustomEvent(n+"-closing",{detail:a,bubbles:!0,cancelable:!0});document.dispatchEvent(s)}catch(l){console.warn(l)}setTimeout(function(){i.parentNode.style.height="0px",i.parentNode.style.overflow="",setTimeout(function(){delete t.children[a.ref],i.parentNode.remove();try{var l=new CustomEvent(n+"-closed",{detail:a,bubbles:!0,cancelable:!0});document.dispatchEvent(l)}catch(u){console.warn(u)}typeof a.onClosed<"u"&&a.onClosed.apply(null,[a,i,e])},1e3)},200),typeof a.onClosing<"u"&&a.onClosing.apply(null,[a,i,e])},f.show=function(o){var i=this,e=h(w,o||{});if(e=h(O,e),e.time={},e.id===null&&(e.id=de(e.title+e.message+e.color)),e.displayMode===1||e.displayMode=="once")try{if(document.querySelectorAll("."+n+"#"+e.id).length>0)return!1}catch{console.warn("["+n+"] Could not find an element with this selector: #"+e.id+". Try to set an valid id.")}if(e.displayMode===2||e.displayMode=="replace")try{g(document.querySelectorAll("."+n+"#"+e.id),function(s,l){i.hide(e,s,"replaced")})}catch{console.warn("["+n+"] Could not find an element with this selector: #"+e.id+". Try to set an valid id.")}e.ref=new Date().getTime()+Math.floor(Math.random()*1e7+1),f.children[e.ref]=e;var t={body:document.querySelector("body"),overlay:document.createElement("div"),toast:document.createElement("div"),toastBody:document.createElement("div"),toastTexts:document.createElement("div"),toastCapsule:document.createElement("div"),cover:document.createElement("div"),buttons:document.createElement("div"),inputs:document.createElement("div"),icon:e.iconUrl?document.createElement("img"):document.createElement("i"),wrapper:null};t.toast.setAttribute("data-iziToast-ref",e.ref),t.toast.appendChild(t.toastBody),t.toastCapsule.appendChild(t.toast),function(){if(t.toast.classList.add(n),t.toast.classList.add(n+"-opening"),t.toastCapsule.classList.add(n+"-capsule"),t.toastBody.classList.add(n+"-body"),t.toastTexts.classList.add(n+"-texts"),v||window.innerWidth<=E?e.transitionInMobile&&t.toast.classList.add(e.transitionInMobile):e.transitionIn&&t.toast.classList.add(e.transitionIn),e.class){var s=e.class.split(" ");g(s,function(l,u){t.toast.classList.add(l)})}e.id&&(t.toast.id=e.id),e.rtl&&(t.toast.classList.add(n+"-rtl"),t.toast.setAttribute("dir","rtl")),e.layout>1&&t.toast.classList.add(n+"-layout"+e.layout),e.balloon&&t.toast.classList.add(n+"-balloon"),e.maxWidth&&(isNaN(e.maxWidth)?t.toast.style.maxWidth=e.maxWidth:t.toast.style.maxWidth=e.maxWidth+"px"),(e.theme!==""||e.theme!=="light")&&t.toast.classList.add(n+"-theme-"+e.theme),e.color&&(ue(e.color)?t.toast.style.background=e.color:t.toast.classList.add(n+"-color-"+e.color)),e.backgroundColor&&(t.toast.style.background=e.backgroundColor,e.balloon&&(t.toast.style.borderColor=e.backgroundColor))}(),function(){e.image&&(t.cover.classList.add(n+"-cover"),t.cover.style.width=e.imageWidth+"px",fe(e.image.replace(/ /g,""))?t.cover.style.backgroundImage="url(data:image/png;base64,"+e.image.replace(/ /g,"")+")":t.cover.style.backgroundImage="url("+e.image+")",e.rtl?t.toastBody.style.marginRight=e.imageWidth+10+"px":t.toastBody.style.marginLeft=e.imageWidth+10+"px",t.toast.appendChild(t.cover))}(),function(){e.close?(t.buttonClose=document.createElement("button"),t.buttonClose.type="button",t.buttonClose.classList.add(n+"-close"),t.buttonClose.addEventListener("click",function(s){s.target,i.hide(e,t.toast,"button")}),t.toast.appendChild(t.buttonClose)):e.rtl?t.toast.style.paddingLeft="18px":t.toast.style.paddingRight="18px"}(),function(){e.progressBar&&(t.progressBar=document.createElement("div"),t.progressBarDiv=document.createElement("div"),t.progressBar.classList.add(n+"-progressbar"),t.progressBarDiv.style.background=e.progressBarColor,t.progressBar.appendChild(t.progressBarDiv),t.toast.appendChild(t.progressBar)),e.timeout&&(e.pauseOnHover&&!e.resetOnHover&&(t.toast.addEventListener("mouseenter",function(s){i.progress(e,t.toast).pause()}),t.toast.addEventListener("mouseleave",function(s){i.progress(e,t.toast).resume()})),e.resetOnHover&&(t.toast.addEventListener("mouseenter",function(s){i.progress(e,t.toast).reset()}),t.toast.addEventListener("mouseleave",function(s){i.progress(e,t.toast).start()})))}(),function(){e.iconUrl?(t.icon.setAttribute("class",n+"-icon"),t.icon.setAttribute("src",e.iconUrl)):e.icon&&(t.icon.setAttribute("class",n+"-icon "+e.icon),e.iconText&&t.icon.appendChild(document.createTextNode(e.iconText)),e.iconColor&&(t.icon.style.color=e.iconColor)),(e.icon||e.iconUrl)&&(e.rtl?t.toastBody.style.paddingRight="33px":t.toastBody.style.paddingLeft="33px",t.toastBody.appendChild(t.icon))}(),function(){e.title.length>0&&(t.strong=document.createElement("strong"),t.strong.classList.add(n+"-title"),t.strong.appendChild(C(e.title)),t.toastTexts.appendChild(t.strong),e.titleColor&&(t.strong.style.color=e.titleColor),e.titleSize&&(isNaN(e.titleSize)?t.strong.style.fontSize=e.titleSize:t.strong.style.fontSize=e.titleSize+"px"),e.titleLineHeight&&(isNaN(e.titleSize)?t.strong.style.lineHeight=e.titleLineHeight:t.strong.style.lineHeight=e.titleLineHeight+"px")),e.message.length>0&&(t.p=document.createElement("p"),t.p.classList.add(n+"-message"),t.p.appendChild(C(e.message)),t.toastTexts.appendChild(t.p),e.messageColor&&(t.p.style.color=e.messageColor),e.messageSize&&(isNaN(e.titleSize)?t.p.style.fontSize=e.messageSize:t.p.style.fontSize=e.messageSize+"px"),e.messageLineHeight&&(isNaN(e.titleSize)?t.p.style.lineHeight=e.messageLineHeight:t.p.style.lineHeight=e.messageLineHeight+"px")),e.title.length>0&&e.message.length>0&&(e.rtl?t.strong.style.marginLeft="10px":e.layout!==2&&!e.rtl&&(t.strong.style.marginRight="10px"))}(),t.toastBody.appendChild(t.toastTexts);var a;(function(){e.inputs.length>0&&(t.inputs.classList.add(n+"-inputs"),g(e.inputs,function(s,l){t.inputs.appendChild(C(s[0])),a=t.inputs.childNodes,a[l].classList.add(n+"-inputs-child"),s[3]&&setTimeout(function(){a[l].focus()},300),a[l].addEventListener(s[1],function(u){var m=s[2];return m(i,t.toast,this,u)})}),t.toastBody.appendChild(t.inputs))})(),function(){e.buttons.length>0&&(t.buttons.classList.add(n+"-buttons"),g(e.buttons,function(s,l){t.buttons.appendChild(C(s[0]));var u=t.buttons.childNodes;u[l].classList.add(n+"-buttons-child"),s[2]&&setTimeout(function(){u[l].focus()},300),u[l].addEventListener("click",function(m){m.preventDefault();var pe=s[1];return pe(i,t.toast,this,m,a)})})),t.toastBody.appendChild(t.buttons)}(),e.message.length>0&&(e.inputs.length>0||e.buttons.length>0)&&(t.p.style.marginBottom="0"),(e.inputs.length>0||e.buttons.length>0)&&(e.rtl?t.toastTexts.style.marginLeft="10px":t.toastTexts.style.marginRight="10px",e.inputs.length>0&&e.buttons.length>0&&(e.rtl?t.inputs.style.marginLeft="8px":t.inputs.style.marginRight="8px")),function(){t.toastCapsule.style.visibility="hidden",setTimeout(function(){var s=t.toast.offsetHeight,l=t.toast.currentStyle||window.getComputedStyle(t.toast),u=l.marginTop;u=u.split("px"),u=parseInt(u[0]);var m=l.marginBottom;m=m.split("px"),m=parseInt(m[0]),t.toastCapsule.style.visibility="",t.toastCapsule.style.height=s+m+u+"px",setTimeout(function(){t.toastCapsule.style.height="auto",e.target&&(t.toastCapsule.style.overflow="visible")},500),e.timeout&&i.progress(e,t.toast).start()},100)}(),function(){var s=e.position;if(e.target)t.wrapper=document.querySelector(e.target),t.wrapper.classList.add(n+"-target"),e.targetFirst?t.wrapper.insertBefore(t.toastCapsule,t.wrapper.firstChild):t.wrapper.appendChild(t.toastCapsule);else{if(F.indexOf(e.position)==-1){console.warn("["+n+`] Incorrect position. -It can be › `+F);return}v||window.innerWidth<=E?e.position=="bottomLeft"||e.position=="bottomRight"||e.position=="bottomCenter"?s=n+"-wrapper-bottomCenter":e.position=="topLeft"||e.position=="topRight"||e.position=="topCenter"?s=n+"-wrapper-topCenter":s=n+"-wrapper-center":s=n+"-wrapper-"+s,t.wrapper=document.querySelector("."+n+"-wrapper."+s),t.wrapper||(t.wrapper=document.createElement("div"),t.wrapper.classList.add(n+"-wrapper"),t.wrapper.classList.add(s),document.body.appendChild(t.wrapper)),e.position=="topLeft"||e.position=="topCenter"||e.position=="topRight"?t.wrapper.insertBefore(t.toastCapsule,t.wrapper.firstChild):t.wrapper.appendChild(t.toastCapsule)}isNaN(e.zindex)?console.warn("["+n+"] Invalid zIndex."):t.wrapper.style.zIndex=e.zindex}(),function(){e.overlay&&(document.querySelector("."+n+"-overlay.fadeIn")!==null?(t.overlay=document.querySelector("."+n+"-overlay"),t.overlay.setAttribute("data-iziToast-ref",t.overlay.getAttribute("data-iziToast-ref")+","+e.ref),!isNaN(e.zindex)&&e.zindex!==null&&(t.overlay.style.zIndex=e.zindex-1)):(t.overlay.classList.add(n+"-overlay"),t.overlay.classList.add("fadeIn"),t.overlay.style.background=e.overlayColor,t.overlay.setAttribute("data-iziToast-ref",e.ref),!isNaN(e.zindex)&&e.zindex!==null&&(t.overlay.style.zIndex=e.zindex-1),document.querySelector("body").appendChild(t.overlay)),e.overlayClose?(t.overlay.removeEventListener("click",{}),t.overlay.addEventListener("click",function(s){i.hide(e,t.toast,"overlay")})):t.overlay.removeEventListener("click",{}))}(),function(){if(e.animateInside){t.toast.classList.add(n+"-animateInside");var s=[200,100,300];(e.transitionIn=="bounceInLeft"||e.transitionIn=="bounceInRight")&&(s=[400,200,400]),e.title.length>0&&setTimeout(function(){t.strong.classList.add("slideIn")},s[0]),e.message.length>0&&setTimeout(function(){t.p.classList.add("slideIn")},s[1]),(e.icon||e.iconUrl)&&setTimeout(function(){t.icon.classList.add("revealIn")},s[2]);var l=150;e.buttons.length>0&&t.buttons&&setTimeout(function(){g(t.buttons.childNodes,function(u,m){setTimeout(function(){u.classList.add("revealIn")},l),l=l+150})},e.inputs.length>0?150:0),e.inputs.length>0&&t.inputs&&(l=150,g(t.inputs.childNodes,function(u,m){setTimeout(function(){u.classList.add("revealIn")},l),l=l+150}))}}(),e.onOpening.apply(null,[e,t.toast]);try{var c=new CustomEvent(n+"-opening",{detail:e,bubbles:!0,cancelable:!0});document.dispatchEvent(c)}catch(s){console.warn(s)}setTimeout(function(){t.toast.classList.remove(n+"-opening"),t.toast.classList.add(n+"-opened");try{var s=new CustomEvent(n+"-opened",{detail:e,bubbles:!0,cancelable:!0});document.dispatchEvent(s)}catch(l){console.warn(l)}e.onOpened.apply(null,[e,t.toast])},1e3),e.drag&&(L?(t.toast.addEventListener("touchstart",function(s){b.startMoving(this,i,e,s)},!1),t.toast.addEventListener("touchend",function(s){b.stopMoving(this,s)},!1)):(t.toast.addEventListener("mousedown",function(s){s.preventDefault(),b.startMoving(this,i,e,s)},!1),t.toast.addEventListener("mouseup",function(s){s.preventDefault(),b.stopMoving(this,s)},!1))),e.closeOnEscape&&document.addEventListener("keyup",function(s){s=s||window.event,s.keyCode==27&&i.hide(e,t.toast,"esc")}),e.closeOnClick&&t.toast.addEventListener("click",function(s){i.hide(e,t.toast,"toast")}),i.toast=t.toast},f})})(ne);var xe=ne.exports;const z=Te(xe);const A={timeout:3e3,close:!1,closeOnClick:!0,icon:null,position:"topRight",transitionIn:"fadeInDown",transitionOut:"fadeOutUp"};class T{static success(d){z.success({title:"OK",titleColor:"green",message:d,messageColor:"green",progressBarColor:"green",...A})}static error(d){z.error({title:"Error",titleColor:"red",message:d,messageColor:"red",progressBarColor:"red",...A})}static warning(d){z.warning({title:"Caution",message:d,titleColor:"red",messageColor:"red",progressBarColor:"red",...A})}}const _=document.getElementById("subscribeForm"),ie=_.querySelector('input[name="email"]'),U=document.getElementById("subscribeBtn");ie.addEventListener("input",_e);_.addEventListener("submit",ke);function Se(r){return/^[^\s@]+@[^\s@]+\.[^\s@]+$/.test(r)}function _e(){ie.value}async function ke(r){r.preventDefault();const d=new FormData(_),p=d.get("email");if(!Se(p))return console.error("Invalid email address"),T.error("Invalid email address");try{U.disabled=!0;const n=await me.post("https://your-energy.b.goit.study/api/subscription",d,{headers:{"Content-Type":"application/json"}});return n.status>=200&&n.status<300?(_.reset(),T.success(`${n.data.message}`)):(console.error("Server Error:",n.status,n.statusText),T.error(`Server Error: ${n.status} ${n.statusText}`))}catch(n){return console.error("Error:",n.message),T.error(`Error: ${n.message}`)}finally{U.disabled=!1}}let y=document.getElementById("mySVG");y.style.transform="scale(1)";y.style.transition="fill 0.3s ease, transform 0.3s ease";let se=["var(--color-yellow)","var(--color-black)","var(--color-valid)"],q=0;y.addEventListener("mouseover",function(){y.style.fill=se[q],y.style.transform="scale(1.6) rotate(145deg)"});y.addEventListener("mouseout",function(){y.style.transform="scale(1) rotate(0deg)",q=(q+1)%se.length});const Be=document.getElementById("btn"),Me=document.getElementById("bmi-result"),x=document.getElementById("weight-condition");function Oe(){const r=document.getElementById("height").value/100,p=(document.getElementById("weight").value/(r*r)).toFixed(1);Me.value=p,p<18.5?x.innerText="Under weight!":p>=18.5&&p<=24.9?x.innerText="Normal weight!":p>=25&&p<=29.9?x.innerText="Overweight!":p>=30&&(x.innerText="Obesity!")}Be.addEventListener("click",Oe);const Ne=document.querySelector(".bmi__link"),k=document.querySelector(".bmi__backdrop"),oe=document.querySelector(".bmi__modal-close-btn");function ze(r){r.preventDefault(),k.classList.remove("is-hidden"),document.body.classList.add("modal-open"),Ae()}function re(r){r.preventDefault(),r.code==="Escape"&&W()}function ae(r){r.target.closest(".bmi__wrapper")||W()}function le(r){r.preventDefault(),W()}function Ae(){document.addEventListener("keydown",re),k.addEventListener("click",ae),oe.addEventListener("click",le)}function W(){document.removeEventListener("keydown",re),k.removeEventListener("click",ae),oe.removeEventListener("click",le),k.classList.add("is-hidden"),document.body.classList.remove("modal-open")}Ne.addEventListener("click",ze); diff --git a/assets/index-f25c9eb1.js b/assets/index-f25c9eb1.js new file mode 100644 index 0000000..7a63c77 --- /dev/null +++ b/assets/index-f25c9eb1.js @@ -0,0 +1,41 @@ +import{A as j,i as N,a as ve}from"./05-modal-exercises-50014dae.js";const he=new j,V=document.querySelector(".js-list");$("Muscles");async function $(r){try{const d=await he.getFilter(r);ye(d)}catch(d){console.log(d)}}function ye(r){const d=r.map(({filter:p,name:f,imgURL:n})=>` +
  • + +
    +

    ${p}

    +

    ${f}

    +
    +
  • + `).join("");V.insertAdjacentHTML("beforeend",d)}document.querySelectorAll(".btnFilters").forEach(r=>{r.addEventListener("click",()=>{const d=r.innerText;V.innerHTML="",$(d)})});const be=new j,R=document.querySelector(".js-list"),P=document.querySelector(".search__form"),J=document.querySelector(".exersices__span"),q=document.querySelector(".exersices__text");R.addEventListener("click",Le);async function Le(r){if(!r.target.closest(".filters__item"))return;P.classList.remove("hidden");const d=r.target.closest(".filters__item");let p=d.lastElementChild.children[0].innerText.toLowerCase().replace(/\s/g,"");const f=d.lastElementChild.children[1].innerText.toLowerCase().replace(/\s/g,"%20");p==="bodyparts"&&(p="bodypart");const n={filter:p,name:f};localStorage.setItem("paramSearch",JSON.stringify(n));try{const v=await be.getExercises(p,f);Y(v),Ee(v)}catch(v){console.log(v)}}function Ee(r){q.innerText=`${r[0].bodyPart}`,q.classList.remove("hidden"),J.classList.remove("hidden")}function Y(r){R.innerHTML="";const d=r.map(({_id:p,rating:f,name:n,burnedCalories:v,bodyPart:B,target:M})=>` +
  • +
    +
    +

    Workout

    + + ${f} + + + + + +
    +
    +
    + + + +
    +

    ${n}

    +
    +
    +

    Burned calories:${v}

    +

    Body part:${B}

    +

    Target:${M}

    +
    +
    +
  • `).join("");R.insertAdjacentHTML("beforeend",d)}document.addEventListener("DOMContentLoaded",()=>{const r=document.querySelectorAll(".exercises__btn");r.forEach(d=>{d.addEventListener("click",()=>{r.forEach(p=>p.classList.remove("active")),d.classList.add("active"),P.classList.add("hidden"),q.classList.add("hidden"),J.classList.add("hidden")})})});const we=new j,Ce=document.querySelector(".search__button"),K=document.querySelector(".search__input");Ce.addEventListener("click",function(r){r.preventDefault(),Q()});K.addEventListener("keydown",function(r){r.key==="Enter"&&(r.preventDefault(),Q())});async function Q(r){const{filter:d,name:p}=JSON.parse(localStorage.getItem("paramSearch")),f=K.value.trim();if(f!=="")try{const n=await we.getSearch(d,p,f);Y(n)}catch(n){console.log(n)}}const Ie=document.querySelector(".footer__link"),S=document.querySelector(".team__backdrop"),Z=document.querySelector(".team__modal-close-btn");function xe(r){r.preventDefault(),S.classList.remove("is-hidden"),document.body.classList.add("modal-open"),Te()}function ee(r){r.preventDefault(),r.code==="Escape"&&W()}function te(r){r.target.closest(".team__wrapper")||W()}function ne(r){r.preventDefault(),W()}function Te(){document.addEventListener("keydown",ee),S.addEventListener("click",te),Z.addEventListener("click",ne)}function W(){document.removeEventListener("keydown",ee),S.removeEventListener("click",te),Z.removeEventListener("click",ne),S.classList.add("is-hidden"),document.body.classList.remove("modal-open")}Ie.addEventListener("click",xe);const D=document.querySelector(".scroll__go-top");D.addEventListener("click",ie);window.addEventListener("scroll",Se);function Se(){const r=window.pageYOffset,d=document.documentElement.clientHeight;r>d?D.classList.add("scroll__go-top--show"):D.classList.remove("scroll__go-top--show")}function ie(){window.pageYOffset>0&&(window.scrollBy(0,-75),setTimeout(ie,0))}var I=typeof globalThis<"u"?globalThis:typeof window<"u"?window:typeof global<"u"?global:typeof self<"u"?self:{};function _e(r){return r&&r.__esModule&&Object.prototype.hasOwnProperty.call(r,"default")?r.default:r}var se={exports:{}};(function(r,d){(function(p,f){r.exports=f(p)})(typeof I<"u"?I:window||I.window||I.global,function(p){var f={},n="iziToast";document.querySelector("body");var v=!!/Mobi/.test(navigator.userAgent),B=/Chrome/.test(navigator.userAgent)&&/Google Inc/.test(navigator.vendor),M=typeof InstallTrigger<"u",L="ontouchstart"in document.documentElement,G=["bottomRight","bottomLeft","bottomCenter","topRight","topLeft","topCenter","center"],ue={info:{color:"blue",icon:"ico-info"},success:{color:"green",icon:"ico-success"},warning:{color:"orange",icon:"ico-warning"},error:{color:"red",icon:"ico-error"},question:{color:"yellow",icon:"ico-question"}},E=568,w={};f.children={};var O={id:null,class:"",title:"",titleColor:"",titleSize:"",titleLineHeight:"",message:"",messageColor:"",messageSize:"",messageLineHeight:"",backgroundColor:"",theme:"light",color:"",icon:"",iconText:"",iconColor:"",iconUrl:null,image:"",imageWidth:50,maxWidth:null,zindex:null,layout:1,balloon:!1,close:!0,closeOnEscape:!1,closeOnClick:!1,displayMode:0,position:"bottomRight",target:"",targetFirst:!0,timeout:5e3,rtl:!1,animateInside:!0,drag:!0,pauseOnHover:!0,resetOnHover:!1,progressBar:!0,progressBarColor:"",progressBarEasing:"linear",overlay:!1,overlayClose:!1,overlayColor:"rgba(0, 0, 0, 0.6)",transitionIn:"fadeInUp",transitionOut:"fadeOut",transitionInMobile:"fadeInUp",transitionOutMobile:"fadeOutDown",buttons:{},inputs:{},onOpening:function(){},onOpened:function(){},onClosing:function(){},onClosed:function(){}};if("remove"in Element.prototype||(Element.prototype.remove=function(){this.parentNode&&this.parentNode.removeChild(this)}),typeof window.CustomEvent!="function"){var U=function(o,i){i=i||{bubbles:!1,cancelable:!1,detail:void 0};var e=document.createEvent("CustomEvent");return e.initCustomEvent(o,i.bubbles,i.cancelable,i.detail),e};U.prototype=window.Event.prototype,window.CustomEvent=U}var g=function(o,i,e){if(Object.prototype.toString.call(o)==="[object Object]")for(var t in o)Object.prototype.hasOwnProperty.call(o,t)&&i.call(e,o[t],t,o);else if(o)for(var a=0,c=o.length;a0?(a=(s-t)/s,a"u"&&(i.classList.remove(n+"-reseted"),s!==null&&(s.style.transition="width "+c.timeout+"ms "+c.progressBarEasing,s.style.width="0%"),c.time.START=new Date().getTime(),c.time.END=c.time.START+c.timeout,c.time.TIMER=setTimeout(function(){clearTimeout(c.time.TIMER),i.classList.contains(n+"-closing")||(t.hide(c,i,"timeout"),typeof e=="function"&&e.apply(t))},c.timeout),t.setSetting(a,"time",c.time))},pause:function(){if(typeof c.time.START<"u"&&!i.classList.contains(n+"-paused")&&!i.classList.contains(n+"-reseted")){if(i.classList.add(n+"-paused"),c.time.REMAINING=c.time.END-new Date().getTime(),clearTimeout(c.time.TIMER),t.setSetting(a,"time",c.time),s!==null){var l=window.getComputedStyle(s),u=l.getPropertyValue("width");s.style.transition="none",s.style.width=u}typeof e=="function"&&setTimeout(function(){e.apply(t)},10)}},resume:function(){typeof c.time.REMAINING<"u"?(i.classList.remove(n+"-paused"),s!==null&&(s.style.transition="width "+c.time.REMAINING+"ms "+c.progressBarEasing,s.style.width="0%"),c.time.END=new Date().getTime()+c.time.REMAINING,c.time.TIMER=setTimeout(function(){clearTimeout(c.time.TIMER),i.classList.contains(n+"-closing")||(t.hide(c,i,"timeout"),typeof e=="function"&&e.apply(t))},c.time.REMAINING),t.setSetting(a,"time",c.time)):this.start()},reset:function(){clearTimeout(c.time.TIMER),delete c.time.REMAINING,t.setSetting(a,"time",c.time),i.classList.add(n+"-reseted"),i.classList.remove(n+"-paused"),s!==null&&(s.style.transition="none",s.style.width="100%"),typeof e=="function"&&setTimeout(function(){e.apply(t)},10)}}},f.hide=function(o,i,e){typeof i!="object"&&(i=document.querySelector(i));var t=this,a=h(this.children[i.getAttribute("data-iziToast-ref")],o||{});a.closedBy=e||null,delete a.time.REMAINING,i.classList.add(n+"-closing"),function(){var l=document.querySelector("."+n+"-overlay");if(l!==null){var u=l.getAttribute("data-iziToast-ref");u=u.split(",");var m=u.indexOf(String(a.ref));m!==-1&&u.splice(m,1),l.setAttribute("data-iziToast-ref",u.join()),u.length===0&&(l.classList.remove("fadeIn"),l.classList.add("fadeOut"),setTimeout(function(){l.remove()},700))}}(),a.transitionIn&&i.classList.remove(a.transitionIn),a.transitionInMobile&&i.classList.remove(a.transitionInMobile),v||window.innerWidth<=E?a.transitionOutMobile&&i.classList.add(a.transitionOutMobile):a.transitionOut&&i.classList.add(a.transitionOut);var c=i.parentNode.offsetHeight;i.parentNode.style.height=c+"px",i.style.pointerEvents="none",(!v||window.innerWidth>E)&&(i.parentNode.style.transitionDelay="0.2s");try{var s=new CustomEvent(n+"-closing",{detail:a,bubbles:!0,cancelable:!0});document.dispatchEvent(s)}catch(l){console.warn(l)}setTimeout(function(){i.parentNode.style.height="0px",i.parentNode.style.overflow="",setTimeout(function(){delete t.children[a.ref],i.parentNode.remove();try{var l=new CustomEvent(n+"-closed",{detail:a,bubbles:!0,cancelable:!0});document.dispatchEvent(l)}catch(u){console.warn(u)}typeof a.onClosed<"u"&&a.onClosed.apply(null,[a,i,e])},1e3)},200),typeof a.onClosing<"u"&&a.onClosing.apply(null,[a,i,e])},f.show=function(o){var i=this,e=h(w,o||{});if(e=h(O,e),e.time={},e.id===null&&(e.id=fe(e.title+e.message+e.color)),e.displayMode===1||e.displayMode=="once")try{if(document.querySelectorAll("."+n+"#"+e.id).length>0)return!1}catch{console.warn("["+n+"] Could not find an element with this selector: #"+e.id+". Try to set an valid id.")}if(e.displayMode===2||e.displayMode=="replace")try{g(document.querySelectorAll("."+n+"#"+e.id),function(s,l){i.hide(e,s,"replaced")})}catch{console.warn("["+n+"] Could not find an element with this selector: #"+e.id+". Try to set an valid id.")}e.ref=new Date().getTime()+Math.floor(Math.random()*1e7+1),f.children[e.ref]=e;var t={body:document.querySelector("body"),overlay:document.createElement("div"),toast:document.createElement("div"),toastBody:document.createElement("div"),toastTexts:document.createElement("div"),toastCapsule:document.createElement("div"),cover:document.createElement("div"),buttons:document.createElement("div"),inputs:document.createElement("div"),icon:e.iconUrl?document.createElement("img"):document.createElement("i"),wrapper:null};t.toast.setAttribute("data-iziToast-ref",e.ref),t.toast.appendChild(t.toastBody),t.toastCapsule.appendChild(t.toast),function(){if(t.toast.classList.add(n),t.toast.classList.add(n+"-opening"),t.toastCapsule.classList.add(n+"-capsule"),t.toastBody.classList.add(n+"-body"),t.toastTexts.classList.add(n+"-texts"),v||window.innerWidth<=E?e.transitionInMobile&&t.toast.classList.add(e.transitionInMobile):e.transitionIn&&t.toast.classList.add(e.transitionIn),e.class){var s=e.class.split(" ");g(s,function(l,u){t.toast.classList.add(l)})}e.id&&(t.toast.id=e.id),e.rtl&&(t.toast.classList.add(n+"-rtl"),t.toast.setAttribute("dir","rtl")),e.layout>1&&t.toast.classList.add(n+"-layout"+e.layout),e.balloon&&t.toast.classList.add(n+"-balloon"),e.maxWidth&&(isNaN(e.maxWidth)?t.toast.style.maxWidth=e.maxWidth:t.toast.style.maxWidth=e.maxWidth+"px"),(e.theme!==""||e.theme!=="light")&&t.toast.classList.add(n+"-theme-"+e.theme),e.color&&(pe(e.color)?t.toast.style.background=e.color:t.toast.classList.add(n+"-color-"+e.color)),e.backgroundColor&&(t.toast.style.background=e.backgroundColor,e.balloon&&(t.toast.style.borderColor=e.backgroundColor))}(),function(){e.image&&(t.cover.classList.add(n+"-cover"),t.cover.style.width=e.imageWidth+"px",me(e.image.replace(/ /g,""))?t.cover.style.backgroundImage="url(data:image/png;base64,"+e.image.replace(/ /g,"")+")":t.cover.style.backgroundImage="url("+e.image+")",e.rtl?t.toastBody.style.marginRight=e.imageWidth+10+"px":t.toastBody.style.marginLeft=e.imageWidth+10+"px",t.toast.appendChild(t.cover))}(),function(){e.close?(t.buttonClose=document.createElement("button"),t.buttonClose.type="button",t.buttonClose.classList.add(n+"-close"),t.buttonClose.addEventListener("click",function(s){s.target,i.hide(e,t.toast,"button")}),t.toast.appendChild(t.buttonClose)):e.rtl?t.toast.style.paddingLeft="18px":t.toast.style.paddingRight="18px"}(),function(){e.progressBar&&(t.progressBar=document.createElement("div"),t.progressBarDiv=document.createElement("div"),t.progressBar.classList.add(n+"-progressbar"),t.progressBarDiv.style.background=e.progressBarColor,t.progressBar.appendChild(t.progressBarDiv),t.toast.appendChild(t.progressBar)),e.timeout&&(e.pauseOnHover&&!e.resetOnHover&&(t.toast.addEventListener("mouseenter",function(s){i.progress(e,t.toast).pause()}),t.toast.addEventListener("mouseleave",function(s){i.progress(e,t.toast).resume()})),e.resetOnHover&&(t.toast.addEventListener("mouseenter",function(s){i.progress(e,t.toast).reset()}),t.toast.addEventListener("mouseleave",function(s){i.progress(e,t.toast).start()})))}(),function(){e.iconUrl?(t.icon.setAttribute("class",n+"-icon"),t.icon.setAttribute("src",e.iconUrl)):e.icon&&(t.icon.setAttribute("class",n+"-icon "+e.icon),e.iconText&&t.icon.appendChild(document.createTextNode(e.iconText)),e.iconColor&&(t.icon.style.color=e.iconColor)),(e.icon||e.iconUrl)&&(e.rtl?t.toastBody.style.paddingRight="33px":t.toastBody.style.paddingLeft="33px",t.toastBody.appendChild(t.icon))}(),function(){e.title.length>0&&(t.strong=document.createElement("strong"),t.strong.classList.add(n+"-title"),t.strong.appendChild(C(e.title)),t.toastTexts.appendChild(t.strong),e.titleColor&&(t.strong.style.color=e.titleColor),e.titleSize&&(isNaN(e.titleSize)?t.strong.style.fontSize=e.titleSize:t.strong.style.fontSize=e.titleSize+"px"),e.titleLineHeight&&(isNaN(e.titleSize)?t.strong.style.lineHeight=e.titleLineHeight:t.strong.style.lineHeight=e.titleLineHeight+"px")),e.message.length>0&&(t.p=document.createElement("p"),t.p.classList.add(n+"-message"),t.p.appendChild(C(e.message)),t.toastTexts.appendChild(t.p),e.messageColor&&(t.p.style.color=e.messageColor),e.messageSize&&(isNaN(e.titleSize)?t.p.style.fontSize=e.messageSize:t.p.style.fontSize=e.messageSize+"px"),e.messageLineHeight&&(isNaN(e.titleSize)?t.p.style.lineHeight=e.messageLineHeight:t.p.style.lineHeight=e.messageLineHeight+"px")),e.title.length>0&&e.message.length>0&&(e.rtl?t.strong.style.marginLeft="10px":e.layout!==2&&!e.rtl&&(t.strong.style.marginRight="10px"))}(),t.toastBody.appendChild(t.toastTexts);var a;(function(){e.inputs.length>0&&(t.inputs.classList.add(n+"-inputs"),g(e.inputs,function(s,l){t.inputs.appendChild(C(s[0])),a=t.inputs.childNodes,a[l].classList.add(n+"-inputs-child"),s[3]&&setTimeout(function(){a[l].focus()},300),a[l].addEventListener(s[1],function(u){var m=s[2];return m(i,t.toast,this,u)})}),t.toastBody.appendChild(t.inputs))})(),function(){e.buttons.length>0&&(t.buttons.classList.add(n+"-buttons"),g(e.buttons,function(s,l){t.buttons.appendChild(C(s[0]));var u=t.buttons.childNodes;u[l].classList.add(n+"-buttons-child"),s[2]&&setTimeout(function(){u[l].focus()},300),u[l].addEventListener("click",function(m){m.preventDefault();var ge=s[1];return ge(i,t.toast,this,m,a)})})),t.toastBody.appendChild(t.buttons)}(),e.message.length>0&&(e.inputs.length>0||e.buttons.length>0)&&(t.p.style.marginBottom="0"),(e.inputs.length>0||e.buttons.length>0)&&(e.rtl?t.toastTexts.style.marginLeft="10px":t.toastTexts.style.marginRight="10px",e.inputs.length>0&&e.buttons.length>0&&(e.rtl?t.inputs.style.marginLeft="8px":t.inputs.style.marginRight="8px")),function(){t.toastCapsule.style.visibility="hidden",setTimeout(function(){var s=t.toast.offsetHeight,l=t.toast.currentStyle||window.getComputedStyle(t.toast),u=l.marginTop;u=u.split("px"),u=parseInt(u[0]);var m=l.marginBottom;m=m.split("px"),m=parseInt(m[0]),t.toastCapsule.style.visibility="",t.toastCapsule.style.height=s+m+u+"px",setTimeout(function(){t.toastCapsule.style.height="auto",e.target&&(t.toastCapsule.style.overflow="visible")},500),e.timeout&&i.progress(e,t.toast).start()},100)}(),function(){var s=e.position;if(e.target)t.wrapper=document.querySelector(e.target),t.wrapper.classList.add(n+"-target"),e.targetFirst?t.wrapper.insertBefore(t.toastCapsule,t.wrapper.firstChild):t.wrapper.appendChild(t.toastCapsule);else{if(G.indexOf(e.position)==-1){console.warn("["+n+`] Incorrect position. +It can be › `+G);return}v||window.innerWidth<=E?e.position=="bottomLeft"||e.position=="bottomRight"||e.position=="bottomCenter"?s=n+"-wrapper-bottomCenter":e.position=="topLeft"||e.position=="topRight"||e.position=="topCenter"?s=n+"-wrapper-topCenter":s=n+"-wrapper-center":s=n+"-wrapper-"+s,t.wrapper=document.querySelector("."+n+"-wrapper."+s),t.wrapper||(t.wrapper=document.createElement("div"),t.wrapper.classList.add(n+"-wrapper"),t.wrapper.classList.add(s),document.body.appendChild(t.wrapper)),e.position=="topLeft"||e.position=="topCenter"||e.position=="topRight"?t.wrapper.insertBefore(t.toastCapsule,t.wrapper.firstChild):t.wrapper.appendChild(t.toastCapsule)}isNaN(e.zindex)?console.warn("["+n+"] Invalid zIndex."):t.wrapper.style.zIndex=e.zindex}(),function(){e.overlay&&(document.querySelector("."+n+"-overlay.fadeIn")!==null?(t.overlay=document.querySelector("."+n+"-overlay"),t.overlay.setAttribute("data-iziToast-ref",t.overlay.getAttribute("data-iziToast-ref")+","+e.ref),!isNaN(e.zindex)&&e.zindex!==null&&(t.overlay.style.zIndex=e.zindex-1)):(t.overlay.classList.add(n+"-overlay"),t.overlay.classList.add("fadeIn"),t.overlay.style.background=e.overlayColor,t.overlay.setAttribute("data-iziToast-ref",e.ref),!isNaN(e.zindex)&&e.zindex!==null&&(t.overlay.style.zIndex=e.zindex-1),document.querySelector("body").appendChild(t.overlay)),e.overlayClose?(t.overlay.removeEventListener("click",{}),t.overlay.addEventListener("click",function(s){i.hide(e,t.toast,"overlay")})):t.overlay.removeEventListener("click",{}))}(),function(){if(e.animateInside){t.toast.classList.add(n+"-animateInside");var s=[200,100,300];(e.transitionIn=="bounceInLeft"||e.transitionIn=="bounceInRight")&&(s=[400,200,400]),e.title.length>0&&setTimeout(function(){t.strong.classList.add("slideIn")},s[0]),e.message.length>0&&setTimeout(function(){t.p.classList.add("slideIn")},s[1]),(e.icon||e.iconUrl)&&setTimeout(function(){t.icon.classList.add("revealIn")},s[2]);var l=150;e.buttons.length>0&&t.buttons&&setTimeout(function(){g(t.buttons.childNodes,function(u,m){setTimeout(function(){u.classList.add("revealIn")},l),l=l+150})},e.inputs.length>0?150:0),e.inputs.length>0&&t.inputs&&(l=150,g(t.inputs.childNodes,function(u,m){setTimeout(function(){u.classList.add("revealIn")},l),l=l+150}))}}(),e.onOpening.apply(null,[e,t.toast]);try{var c=new CustomEvent(n+"-opening",{detail:e,bubbles:!0,cancelable:!0});document.dispatchEvent(c)}catch(s){console.warn(s)}setTimeout(function(){t.toast.classList.remove(n+"-opening"),t.toast.classList.add(n+"-opened");try{var s=new CustomEvent(n+"-opened",{detail:e,bubbles:!0,cancelable:!0});document.dispatchEvent(s)}catch(l){console.warn(l)}e.onOpened.apply(null,[e,t.toast])},1e3),e.drag&&(L?(t.toast.addEventListener("touchstart",function(s){b.startMoving(this,i,e,s)},!1),t.toast.addEventListener("touchend",function(s){b.stopMoving(this,s)},!1)):(t.toast.addEventListener("mousedown",function(s){s.preventDefault(),b.startMoving(this,i,e,s)},!1),t.toast.addEventListener("mouseup",function(s){s.preventDefault(),b.stopMoving(this,s)},!1))),e.closeOnEscape&&document.addEventListener("keyup",function(s){s=s||window.event,s.keyCode==27&&i.hide(e,t.toast,"esc")}),e.closeOnClick&&t.toast.addEventListener("click",function(s){i.hide(e,t.toast,"toast")}),i.toast=t.toast},f})})(se);var ke=se.exports;const z=_e(ke);const A={timeout:3e3,close:!1,closeOnClick:!0,icon:null,position:"topRight",transitionIn:"fadeInDown",transitionOut:"fadeOutUp"};class x{static success(d){z.success({title:"OK",titleColor:"green",message:d,messageColor:"green",progressBarColor:"green",...A})}static error(d){z.error({title:"Error",titleColor:"red",message:d,messageColor:"red",progressBarColor:"red",...A})}static warning(d){z.warning({title:"Caution",message:d,titleColor:"red",messageColor:"red",progressBarColor:"red",...A})}}const _=document.getElementById("subscribeForm"),oe=_.querySelector('input[name="email"]'),X=document.getElementById("subscribeBtn");oe.addEventListener("input",Me);_.addEventListener("submit",Oe);function Be(r){return/^[^\s@]+@[^\s@]+\.[^\s@]+$/.test(r)}function Me(){oe.value}async function Oe(r){r.preventDefault();const d=new FormData(_),p=d.get("email");if(!Be(p))return console.error("Invalid email address"),x.error("Invalid email address");try{X.disabled=!0;const n=await ve.post("https://your-energy.b.goit.study/api/subscription",d,{headers:{"Content-Type":"application/json"}});return n.status>=200&&n.status<300?(_.reset(),x.success(`${n.data.message}`)):(console.error("Server Error:",n.status,n.statusText),x.error(`Server Error: ${n.status} ${n.statusText}`))}catch(n){return console.error("Error:",n.message),x.error(`Error: ${n.message}`)}finally{X.disabled=!1}}let y=document.getElementById("mySVG");y.style.transform="scale(1)";y.style.transition="fill 0.3s ease, transform 0.3s ease";let re=["var(--color-yellow)","var(--color-black)","var(--color-valid)"],H=0;y.addEventListener("mouseover",function(){y.style.fill=re[H],y.style.transform="scale(1.6) rotate(145deg)"});y.addEventListener("mouseout",function(){y.style.transform="scale(1) rotate(0deg)",H=(H+1)%re.length});const Ne=document.getElementById("btn"),ze=document.getElementById("bmi-result"),T=document.getElementById("weight-condition");function Ae(){const r=document.getElementById("height").value/100,p=(document.getElementById("weight").value/(r*r)).toFixed(1);ze.value=p,p<18.5?T.innerText="Under weight!":p>=18.5&&p<=24.9?T.innerText="Normal weight!":p>=25&&p<=29.9?T.innerText="Overweight!":p>=30&&(T.innerText="Obesity!")}Ne.addEventListener("click",Ae);const Re=document.querySelector(".bmi__link"),k=document.querySelector(".bmi__backdrop"),ae=document.querySelector(".bmi__modal-close-btn");function qe(r){r.preventDefault(),k.classList.remove("is-hidden"),document.body.classList.add("modal-open"),De()}function le(r){r.preventDefault(),r.code==="Escape"&&F()}function ce(r){r.target.closest(".bmi__wrapper")||F()}function de(r){r.preventDefault(),F()}function De(){document.addEventListener("keydown",le),k.addEventListener("click",ce),ae.addEventListener("click",de)}function F(){document.removeEventListener("keydown",le),k.removeEventListener("click",ce),ae.removeEventListener("click",de),k.classList.add("is-hidden"),document.body.classList.remove("modal-open")}Re.addEventListener("click",qe); diff --git a/index.html b/index.html index bdc881f..e706ff8 100644 --- a/index.html +++ b/index.html @@ -14,7 +14,7 @@ /> Your Energy - + @@ -292,8 +292,8 @@

    - Exercises/ -

    + Exercises +