{"version":3,"sources":["Scripts/src/home/app.js"],"names":["dureeSlide","elementsHasSnapSliper","home","init","settings","i","length","this","snap","jumpTonextSection","id","btn","document","querySelector","addEventListener","el","parent","target","parentNode","nextSection","nextElementSibling","posYNextSection","getBoundingClientRect","top","window","scroll","selector","self","elementSnap","concat","items","querySelectorAll","helpers","elementExist","forEach","dataset","glideDir","classList","add","bullet","index","parseInt","scrollIntoView","behavior","block","e","_scrollHandlerSnap","width","dir","scrollBy","left","atSnappingPoint","scrollLeft","offsetWidth","timeOut","arrayOfBullets","clearTimeout","scrollTimeout","setTimeout","x","remove","_animateCSS","element","animationName","callback","handleAnimationEnd","node","removeEventListener","_animSlider","nomPays","titre","_loadImgSlide","container","windowWidth","breakpoint","arguments","undefined","li","bg","getAttribute","style","backgroundImage","slider","Glide","launchConseillerSlider","type","autoplay","gap","perView","mount","carousel","getElementById","count","hoverpause","on","body","animate","duration","iterations","Infinity","src","srcMobile","srcDesktop","setAttribute","isTouchDevice","module","exports"],"mappings":"m4CAAA,IAAMA,GAAa,IAEfC,GAAyB,qBAAsB,sBAI/CC,GACHC,KAAI,SAACC,GAKJ,IAAK,GAAIC,GAAI,EAAGA,EAAIJ,EAAsBK,OAAQD,IACjDE,KAAKC,KAAKP,EAAsBI,KAIlCI,kBAAmB,SAAUC,GAC5B,GAAMC,GAAMC,SAASC,cAAcH,EACnCC,GAAIG,iBAAiB,QAAS,SAAUC,GACvC,GAAIC,GAASD,EAAGE,OAAOC,WACtBC,EAAcH,EAAOI,mBACrBC,EAAkBF,EAAYG,wBAAwBC,GACvDC,QAAOC,OAAO,EAAGJ,EAAkB,OAKrCb,KAAI,SAACkB,GACJ,GAAIC,GAAOpB,KACVqB,EAAchB,SAASC,cAAa,GAAAgB,OAAIH,EAAQ,iBAChDI,EAAQF,EAAYG,iBAAiB,KAGlCC,SAAQC,aAAY,GAAAJ,OAAIH,EAAQ,sBACnCd,SAASmB,iBAAgB,GAAAF,OAAIH,EAAQ,oBAAmBQ,QAAQ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kBAA1BxD,UAASmF,KAAKC,SACxBpF,SAASC,cAAc,kBAAkBmF,UAGvCjD,MAAO,MAEPA,MAAO,UAIRkD,SAAUjG,EACVkG,WAAYC,EAAAA,IAIdjG,EAAKqE,cAAc,gBAAiBE,KAGpCgB,YAEFvF,GAAKkE,cACLlE,EAAKqE,cAAc,gBAAiBE,EAKtC,IAAIzC,QAAQC,aAAa,+BACxB,CAAkB,GAAIkD,GAAM,+BAC1BE,KAAM,SACNC,SAAuB,GAAbtF,EACV6F,YAAY,EACZN,IAAK,IAELO,IAAI,eAAgB,OAAQ,WAC5B5F,EAAKqE,cAAc,8BAA+BE,EAAa,OAE/DgB,YAEF,IAAwD,OAApD7E,SAASC,cAAc,yBAAmC,CAC7D,GAAIuF,GAAMxF,SAASC,cAAc,2BAA2BsB,QAAQkE,SAChE5B,GAAc,MACjB2B,EAAMxF,SAASC,cAAc,2BAA2BsB,QAAQmE,YAEjE1F,SAASC,cAAc,6BAA6B0F,aAAa,MAAOH,GAe1E,IAAKpE,QAAQwE,gBACZ,CAAoB9C,WAAW0B,EAAwB,OAK1DqB,GAAOC,QAAUxG","file":"static/scripts/home/home.js.map","sourcesContent":["const dureeSlide = 9000;\r\nlet nombreConseillersAffiches = 3;\r\nlet elementsHasSnapSliper = ['[data-slider=\"dm\"]', '[data-slider=\"dg\"]']\r\n\r\n\"use strict\";\r\n\r\nvar home = {\r\n\tinit(settings) {\r\n\t\t/// Flèche sroll bottom\r\n\t\t//this.jumpTonextSection('[data-js=\"scrollNext\"]');\r\n\r\n\t\t/// Dernières minutes et départs garantis\r\n\t\tfor (var i = 0; i < elementsHasSnapSliper.length; i++) {\r\n\t\t\tthis.snap(elementsHasSnapSliper[i]);\r\n\t\t}\r\n\t},\r\n\r\n\tjumpTonextSection: function (id) {\r\n\t\tconst btn = document.querySelector(id);\r\n\t\tbtn.addEventListener('click', function (el) {\r\n\t\t\tlet parent = el.target.parentNode,\r\n\t\t\t\tnextSection = parent.nextElementSibling,\r\n\t\t\t\tposYNextSection = nextSection.getBoundingClientRect().top;\r\n\t\t\twindow.scroll(0, posYNextSection - 28); // margin top section\r\n\t\t});\r\n\t},\r\n\r\n\t/// SNAP SLIDER [Dernières minutes et départs garantis]\r\n\tsnap(selector) {\r\n\t\tlet self = this,\r\n\t\t\telementSnap = document.querySelector(`${selector} [data-snap]`),\r\n\t\t\titems = elementSnap.querySelectorAll('li');\r\n\r\n\r\n\t\tif (helpers.elementExist(`${selector} .glide__bullet`)) {\r\n\t\t\tdocument.querySelectorAll(`${selector} .glide__bullet`).forEach(el => {\r\n\t\t\t\t/// On ajoute la classe 'is-active' sur la première bullet\r\n\t\t\t\t/// Au click sur une bullet, on scroll jusqu'à l'item correspondant\r\n\t\t\t\tel.dataset.glideDir === \"0\" && el.classList.add('is-active');\r\n\t\t\t\tel.addEventListener('click', function (bullet) {\r\n\t\t\t\t\tlet index = parseInt(bullet.target.dataset.glideDir);\r\n\t\t\t\t\titems[index].scrollIntoView({\r\n\t\t\t\t\t\tbehavior: 'smooth',\r\n\t\t\t\t\t\tblock: 'nearest'\r\n\t\t\t\t\t});\r\n\t\t\t\t})\r\n\t\t\t});\r\n\t\t\t/// Event scroll\r\n\t\t\t/// Lors d'un event scroll sur `elementSnap`, on active la bullet correspondante\r\n\t\t\telementSnap.addEventListener('scroll', function (e) {\r\n\t\t\t\tself._scrollHandlerSnap(e.target, selector, items)\r\n\t\t\t});\r\n\t\t}\r\n\r\n\t\t/// Event click arrow\r\n\t\tif (helpers.elementExist(`${selector} .glide__arrow`)) {\r\n\t\t\tdocument.querySelectorAll(`${selector} .glide__arrow`).forEach(el => {\r\n\t\t\t\tel.addEventListener('click', function (btn) {\r\n\t\t\t\t\tlet width = document.querySelector(selector).getBoundingClientRect().width,\r\n\t\t\t\t\t\tdir = btn.target.dataset.glideDir === \">\" ? width : -width;\r\n\r\n\t\t\t\t\telementSnap.scrollBy({\r\n\t\t\t\t\t\ttop: 0,\r\n\t\t\t\t\t\tleft: dir,\r\n\t\t\t\t\t\tbehavior: 'smooth'\r\n\t\t\t\t\t});\r\n\t\t\t\t})\r\n\t\t\t})\r\n\t\t}\r\n\t},\r\n\t_scrollHandlerSnap(target, selector, items) {\r\n\t\tlet atSnappingPoint = target.scrollLeft % target.offsetWidth === 0,\r\n\t\t\ttimeOut = atSnappingPoint ? 0 : 10,\r\n\t\t\tarrayOfBullets = document.querySelectorAll(`${selector} .glide__bullet`);\r\n\r\n\t\tclearTimeout(target.scrollTimeout); // on remet le timeout à 0\r\n\r\n\t\ttarget.scrollTimeout = setTimeout(function () {\r\n\t\t\t//!timeOut ? console.log('Scroller snapped!') : console.log('User stopped scrolling.');\r\n\t\t\tlet index = 0;\r\n\t\t\titems.forEach(el => {\r\n\t\t\t\tel.getBoundingClientRect().x === target.getBoundingClientRect().x ? arrayOfBullets[index].classList.add('is-active') : arrayOfBullets[index].classList.remove('is-active');\r\n\t\t\t\tindex++;\r\n\t\t\t})\r\n\t\t}, timeOut);\r\n\t},\r\n\t/// #SNAP SLIDER\r\n\r\n\r\n\t_animateCSS(element, animationName, callback) {\r\n\t\tconst node = element\r\n\t\tnode.classList.add('animated', animationName)\r\n\r\n\t\tfunction handleAnimationEnd() {\r\n\t\t\tnode.classList.remove('animated', animationName)\r\n\t\t\tnode.removeEventListener('animationend', handleAnimationEnd)\r\n\r\n\t\t\tif (typeof callback === 'function') callback()\r\n\t\t}\r\n\r\n\t\tnode.addEventListener('animationend', handleAnimationEnd)\r\n\t},\r\n\t_animSlider: function () {\r\n\t\tlet nomPays = document.querySelectorAll('.slider--pays');\r\n\t\tlet titre = document.querySelectorAll('.slider--titre');\r\n\t\tlet btn = document.querySelectorAll('.slider--btn');\r\n\r\n\t\tfor (var i = 0; i < nomPays.length; i++) {\r\n\t\t\tthis._animateCSS(nomPays[i], 'fadeInDown');\r\n\t\t}\r\n\t\tfor (var i = 0; i < titre.length; i++) {\r\n\t\t\tthis._animateCSS(titre[i], 'fadeInDown');\r\n\t\t}\r\n\t\tfor (var i = 0; i < btn.length; i++) {\r\n\t\t\tthis._animateCSS(btn[i], 'fadeInDown');\r\n\t\t}\r\n\t},\r\n\t_loadImgSlide(container, windowWidth, breakpoint = 1024) {\r\n\t\tlet li = document.querySelectorAll(`${container} .glide__slide`);\r\n\t\tfor (var i = li.length - 1; i >= 0; i--) {\r\n\t\t\tlet bg = li[i].getAttribute('data-img-desktop');\r\n\t\t\tif (windowWidth < breakpoint) {\r\n\t\t\t\tbg = li[i].getAttribute('data-img-mobile');\r\n\t\t\t}\r\n\t\t\tli[i].style.backgroundImage = 'url(' + bg + ')';\r\n\r\n\t\t\t// if (Boolean(li[i].dataset.imageCache)) {\r\n\t\t\t// \tlet pathImg = li[i].getAttribute('data-img-desktop');\r\n\t\t\t// \tif (windowWidth < breakpoint) {\r\n\t\t\t// \t\tli[i].getAttribute('data-img-mobile');\r\n\t\t\t// \t}\r\n\t\t\t// \t// On met en cache le chemin de la première image\r\n\t\t\t// \thelpers.setCookie('heroImg', pathImg, 1)\r\n\t\t\t// }\r\n\t\t}\r\n\t},\r\n\tslider: function (windowWidth, Glide) {\r\n\t\tlet settings = {} || settings;\r\n\r\n\t\t/// Carousel\r\n\t\tsettings.carousel = document.getElementById('carouselHero') === null ? false : true;\r\n\r\n\t\tif (settings.carousel) {\r\n\t\t\tif (parseInt(document.getElementById('carouselHero').dataset.count) > 1) {\r\n\t\t\t\tvar carouselHome = new Glide('#carouselHero', {\r\n\t\t\t\t\t\ttype: 'carousel',\r\n\t\t\t\t\t\tautoplay: dureeSlide,\r\n\t\t\t\t\t\thoverpause: false,\r\n\t\t\t\t\t\tgap: 0\r\n\t\t\t\t\t})\r\n\t\t\t\t\t.on(['mount.before', 'run'], function () {\r\n\t\t\t\t\t\thome._animSlider();\r\n\r\n\t\t\t\t\t\tif (typeof document.body.animate === 'function') {\r\n\t\t\t\t\t\t\tdocument.querySelector('.progress--bar').animate([\r\n\t\t\t\t\t\t\t\t// keyframes\r\n\t\t\t\t\t\t\t\t{\r\n\t\t\t\t\t\t\t\t\twidth: '0'\r\n\t\t\t\t\t\t\t\t}, {\r\n\t\t\t\t\t\t\t\t\twidth: '100%'\r\n\t\t\t\t\t\t\t\t}\r\n\t\t\t\t\t\t\t], {\r\n\t\t\t\t\t\t\t\t// timing options\r\n\t\t\t\t\t\t\t\tduration: dureeSlide,\r\n\t\t\t\t\t\t\t\titerations: Infinity\r\n\t\t\t\t\t\t\t});\r\n\t\t\t\t\t\t}\r\n\r\n\t\t\t\t\t\thome._loadImgSlide('#carouselHero', windowWidth);\r\n\r\n\t\t\t\t\t})\r\n\t\t\t\t\t.mount();\r\n\t\t\t} else {\r\n\t\t\t\thome._animSlider();\r\n\t\t\t\thome._loadImgSlide('#carouselHero', windowWidth);\r\n\t\t\t}\r\n\t\t}\r\n\r\n\t\t// Coup de coeur\r\n\t\tif (helpers.elementExist('[data-slider=\"coupdecoeur\"]')) {\r\n\t\t\tvar coupDeCoeur = new Glide('[data-slider=\"coupdecoeur\"]', {\r\n\t\t\t\t\ttype: 'slider',\r\n\t\t\t\t\tautoplay: dureeSlide * 50,\r\n\t\t\t\t\thoverpause: true,\r\n\t\t\t\t\tgap: 0\r\n\t\t\t\t})\r\n\t\t\t\t.on(['mount.before', 'run'], function () {\r\n\t\t\t\t\thome._loadImgSlide('[data-slider=\"coupdecoeur\"]', windowWidth, 810);\r\n\t\t\t\t})\r\n\t\t\t\t.mount();\r\n\t\t} else {\r\n\t\t\tif (document.querySelector('.section--coupdecoeur') !== null) {\r\n\t\t\t\tlet src = document.querySelector('.section--coupdecoeur a').dataset.srcMobile;\r\n\t\t\t\tif (windowWidth > 810) {\r\n\t\t\t\t\tsrc = document.querySelector('.section--coupdecoeur a').dataset.srcDesktop\r\n\t\t\t\t}\r\n\t\t\t\tdocument.querySelector('.section--coupdecoeur img').setAttribute('src', src)\r\n\t\t\t}\r\n\t\t}\r\n\r\n\t\t/// Conseiller\r\n\t\tfunction launchConseillerSlider() {\r\n\t\t\tnew Glide('[data-slider=\"conseiller\"]', {\r\n\t\t\t\t\ttype: 'carousel',\r\n\t\t\t\t\tautoplay: false,\r\n\t\t\t\t\tgap: 0,\r\n\t\t\t\t\tperView: 3\r\n\t\t\t\t})\r\n\t\t\t\t.mount();\r\n\t\t}\r\n\r\n\t\tif (!helpers.isTouchDevice()) {\r\n\t\t\tconst conseillers = setTimeout(launchConseillerSlider, 2000);\r\n\t\t}\r\n\t}\r\n}\r\n\r\nmodule.exports = home;"]}