{ "version": 3, "sources": ["../../../Vettvangur.Frontend/src/scripts/components/imageModal.ts"], "sourcesContent": ["const imageModal = {\r\n el: {\r\n imgContainers: document.querySelectorAll('.image-modal__content-container'),\r\n },\r\n\r\n init() {\r\n // checking if modal exists\r\n if (this.el.imgContainers.length > 0) {\r\n this.el.imgContainers.forEach((imgContainer) => {\r\n //elements in image block\r\n const imgOverlayButtons = imgContainer.querySelector('.image-modal__buttons')\r\n const imgFullscreenBtn = imgContainer.querySelector('.image-modal__fullscreen-button')\r\n \r\n // elements for image modal\r\n const modal = imgContainer.querySelector('.image-modal')\r\n const modalClose = modal.querySelector('.image-modal__close')\r\n \r\n //checking if vital elements exist\r\n if(imgOverlayButtons != null && modal != null) {\r\n \r\n //listening to clicks on document to toggle modal and buttons\r\n document.addEventListener('click', (event) => {\r\n const toggleModal = event.composedPath().includes(modalClose) || event.composedPath().includes(imgFullscreenBtn)\r\n //toggle modal\r\n if (toggleModal) {\r\n this.toggleImageModal(modal)\r\n }\r\n })\r\n }\r\n \r\n imgContainer.addEventListener('mouseover', () => {\r\n imgOverlayButtons.classList.add('image-modal__buttons--visible');\r\n })\r\n \r\n imgContainer.addEventListener('mouseout', () => {\r\n imgOverlayButtons.classList.remove('image-modal__buttons--visible');\r\n })\r\n \r\n })\r\n }\r\n },\r\n\r\n //toggle image modal\r\n toggleImageModal(imageModal: HTMLElement) {\r\n const isOpen = imageModal.classList.contains(\"open\")\r\n\r\n if (isOpen) {\r\n document.body.classList.remove('h-disable-scroll')\r\n } else {\r\n document.body.classList.add('h-disable-scroll')\r\n imageModal.classList.add(\"open\")\r\n document.body.appendChild(imageModal);\r\n }\r\n }\r\n}\r\n\r\nexport default imageModal\r\n"], "mappings": "gCAAA,IAAMA,EAAa,CACjB,GAAI,CACF,cAAe,SAAS,iBAA8B,iCAAiC,CACzF,EAEA,MAAO,CAED,KAAK,GAAG,cAAc,OAAS,GACjC,KAAK,GAAG,cAAc,QAASC,GAAiB,CAE9C,IAAMC,EAAoBD,EAAa,cAA2B,uBAAuB,EACnFE,EAAmBF,EAAa,cAAiC,iCAAiC,EAGlGG,EAAQH,EAAa,cAA2B,cAAc,EAC9DI,EAAaD,EAAM,cAA2B,qBAAqB,EAGtEF,GAAqB,MAAQE,GAAS,MAGvC,SAAS,iBAAiB,QAAUE,GAAU,EACxBA,EAAM,aAAa,EAAE,SAASD,CAAU,GAAKC,EAAM,aAAa,EAAE,SAASH,CAAgB,IAG7G,KAAK,iBAAiBC,CAAK,CAE/B,CAAC,EAGHH,EAAa,iBAAiB,YAAa,IAAM,CAC/CC,EAAkB,UAAU,IAAI,+BAA+B,CACjE,CAAC,EAEDD,EAAa,iBAAiB,WAAY,IAAM,CAC9CC,EAAkB,UAAU,OAAO,+BAA+B,CACpE,CAAC,CAEH,CAAC,CAEL,EAGA,iBAAiBF,EAAyB,CACzBA,EAAW,UAAU,SAAS,MAAM,EAGjD,SAAS,KAAK,UAAU,OAAO,kBAAkB,GAEjD,SAAS,KAAK,UAAU,IAAI,kBAAkB,EAC9CA,EAAW,UAAU,IAAI,MAAM,EAC/B,SAAS,KAAK,YAAYA,CAAU,EAExC,CACF,EAEOO,EAAQP", "names": ["imageModal", "imgContainer", "imgOverlayButtons", "imgFullscreenBtn", "modal", "modalClose", "event", "imageModal_default"] }