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P,UAAUC,SAAS,eAAkBM,EAAOM,QAAQ,gBAAmBN,EAAOM,QAAQ,gBACjG,EAAKX,iBAIb,EAtEA","sources":["webpack://evolve-boilerplate/./src/scripts/components/sliding.ts"],"sourcesContent":["class Sliding {\n body: HTMLBodyElement;\n mainSlidingOpen = 'mso';\n subSlidingOpen = 'open';\n btnSlide: HTMLBodyElement;\n slidingList: HTMLUListElement;\n subSlidingLinks: HTMLLIElement[];\n subSlidingBack: HTMLLinkElement[];\n\n constructor() {\n this.body = document.querySelector('body');\n this.btnSlide = document.querySelector('.btnSlide');\n this.slidingList = document.querySelector('.slidingList');\n if (this.slidingList) {\n this.subSlidingLinks = [].slice.call(this.slidingList.querySelectorAll('.menu-item-has-children'));\n this.subSlidingBack = [].slice.call(this.slidingList.querySelectorAll('.goback'));\n this.slide();\n this.subSlide();\n this.closeTargetList();\n this.goBack();\n }\n }\n \n slide() {\n this.btnSlide.addEventListener('click', () => {\n if (!this.body.classList.contains(this.mainSlidingOpen)) {\n this.body.classList.add(this.mainSlidingOpen);\n } else {\n this.closeSlide();\n }\n });\n }\n\n subSlide() {\n this.subSlidingLinks.forEach((link) => {\n link.addEventListener('click', (e) => {\n const target = e.target as HTMLElement;\n if (!target.classList.contains(this.subSlidingOpen) && target.classList.contains('menu-item-has-children')) {\n link.classList.add(this.subSlidingOpen);\n }\n });\n })\n }\n\n closeSlide() {\n this.body.classList.remove(this.mainSlidingOpen);\n this.subSlidingLinks.forEach((openSlide: HTMLLIElement) => {\n openSlide.classList.remove(this.subSlidingOpen);\n });\n }\n\n goBack() {\n this.subSlidingBack.forEach(back => {\n back.addEventListener('click', () => {\n const parent: HTMLElement = back.parentElement.parentElement;\n if (parent.classList.contains(this.subSlidingOpen)) {\n parent.classList.remove(this.subSlidingOpen);\n } \n });\n })\n }\n\n closeTargetList() {\n document.addEventListener('click', (e) => {\n const target = e.target as HTMLElement;\n if ( !target.classList.contains('header_nav') && !target.closest('.header_nav') && !target.closest('.header_ham') ) {\n this.closeSlide();\n }\n });\n }\n}\n\nnew Sliding;"],"names":["mainSlidingOpen","subSlidingOpen","this","body","document","querySelector","btnSlide","slidingList","subSlidingLinks","slice","call","querySelectorAll","subSlidingBack","slide","subSlide","closeTargetList","goBack","addEventListener","classList","contains","closeSlide","add","forEach","link","e","target","remove","openSlide","back","parent","parentElement","closest"],"sourceRoot":""}