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ACL,IAAK,QACDhD,EAAaC,GACP,IAKyC,EAC/D,GACJ,EAEAd,EAAK2D,cAAgB,SAAU7C,EAAGgD,EAAaC,EAAUC,EAAQC,GAC7D,MAAMC,EAAaH,EAASnD,cAAc,kCAM1C,GAJAE,EAAEI,iBACFJ,EAAEM,2BACFN,EAAEK,kBAEE4C,EAAS1C,UAAUqC,SAAS,QAAS,CACrCK,EAAS1C,UAAU8C,OAAO,QAEtBD,GAAkD,aAApCA,EAAWxD,aAAa,UACtCwD,EAAWE,QAGf,MAAMC,EAAY,IAAI7C,MAAM,QAC5BuC,EAAStC,cAAc4C,EAC3B,CAEAP,EAAYV,aAAa,YAAa,GAElCrB,OAAOsB,YA3KK,KA4KZW,EAAOV,QAGXjD,SAASiE,oBAAoB,UAAWL,GAExC5D,SAASO,cAAc,QAAQkB,MAAMqB,SAAW,SACpD,EAkCAnD,EAAKG,kCAAoC,WACrC,IAAIoE,EAA2BlE,SAASC,iBAAiB,+BAEzD,GAAKiE,EAAL,CAIA,IAAIC,EAAOnE,SAASO,cAAc,QAC9B6D,EAAc,GAElBF,EAAyBhE,SAAQ,SAAUmE,GACvC,IAAIC,EAASD,EAAUhE,aAAa,WAEhC+D,EAAYG,SAASD,GAIrBD,EAAUP,UAIdM,EAAYI,KAAKF,GACjBH,EAAKM,OAAOJ,GAChB,GAlBA,CAmBJ,CACJ,EAEA3C,OAAOgD,GAAKhD,OAAOgD,IAAM,CAAC,EAC1BhD,OAAOgD,GAAGhB,SAAWhE,EAErBgC,OAAO0B,iBAAiB,OAAQ1B,OAAOgD,GAAGhB,SAAS7D,MAEnD,S","sources":["webpack://netzkern.am/./src/Feature/Lightbox/Code/Scripts/Lightbox/lightbox.js"],"sourcesContent":["import '../../Lightbox/Styles/_lightbox.scss'\r\n\r\nconst Lightbox = new function () {\r\n const that = this;\r\n const tabletWidth = 768;\r\n const desktopWidth = 1024;\r\n\r\n that.init = function () {\r\n that.setLightboxContentContainerToBody();\r\n const aTags = document.querySelectorAll('a[target=\"_lightbox\"], img[target=\"_lightbox\"]');\r\n\r\n if (aTags == null) {\r\n return;\r\n }\r\n\r\n aTags.forEach(function (item) {\r\n let lightboxId = item.getAttribute('data-lightbox-id');\r\n\r\n if (!lightboxId) {\r\n return;\r\n }\r\n\r\n let lightBoxDiv = document.querySelector('.lightbox-overlay-container[data-id=\"' + lightboxId + '\"]');\r\n\r\n if (!lightBoxDiv) {\r\n return;\r\n }\r\n\r\n const openLightbox = (e) => {\r\n const currentTag = e.target;\r\n\r\n e.target.blur();\r\n e.preventDefault();\r\n e.stopPropagation();\r\n e.stopImmediatePropagation();\r\n\r\n lightBoxDiv.classList.add('show');\r\n\r\n const showEvent = new Event('show');\r\n lightBoxDiv.dispatchEvent(showEvent);\r\n\r\n var videoPlayer = lightBoxDiv.querySelector('.video-container .videoPlayer');\r\n\r\n if (videoPlayer != null) {\r\n adjustPlayerHeight(videoPlayer);\r\n // The media element plugin calculates the wrong heights for the lightbox video player\r\n // while the lightbox overlay is closed. Therefore we need to resize after opening the overlay\r\n // that every height is correct calculated\r\n window.dispatchEvent(new Event('resize'));\r\n }\r\n\r\n const lightboxCloseButton = lightBoxDiv.querySelector(\".lightbox-close-button\");\r\n const lightboxOverlay = lightBoxDiv.querySelector(\".lightbox-overlay\");\r\n const lightboxContent = lightBoxDiv.querySelector(\".lightbox-content\");\r\n\r\n if (!lightboxContent || !lightboxOverlay) {\r\n return;\r\n }\r\n\r\n let isInOverlayMousedown = false;\r\n\r\n var preventScrollFunc = function (e) {\r\n if ((e.keycode || e.which) == 32) {\r\n e.preventDefault();\r\n }\r\n };\r\n\r\n document.querySelector(\"body\").style.overflow = 'hidden';\r\n\r\n\r\n lightboxCloseButton.setAttribute(\"tabindex\", \"0\");\r\n\r\n if (window.innerWidth >= desktopWidth) {\r\n lightboxCloseButton.focus();\r\n }\r\n\r\n // if events are already added, return here\r\n if (lightboxOverlay.dataset.eventsInitialized) {\r\n return;\r\n }\r\n lightboxOverlay.dataset.eventsInitialized = \"true\";\r\n\r\n /* Prevent scrolling in document if modal is closing with space. */\r\n document.addEventListener('keydown', preventScrollFunc, false);\r\n\r\n /* Prevent closing the layout if clicking on the content */\r\n lightboxContent.addEventListener(\"click\",\r\n function (e) {\r\n e.stopPropagation();\r\n });\r\n\r\n /* Prevent closing the layout if clicking on the content */\r\n lightboxOverlay.addEventListener(\"click\",\r\n function (e) {\r\n e.stopPropagation();\r\n });\r\n \r\n lightboxOverlay.addEventListener('mousedown', () => {\r\n isInOverlayMousedown = true;\r\n });\r\n\r\n lightboxOverlay.addEventListener('mouseup', () => {\r\n isInOverlayMousedown = false;\r\n });\r\n\r\n lightBoxDiv.addEventListener(\"mouseup\", function (e) {\r\n if (isInOverlayMousedown ||\r\n lightboxOverlay.contains(e.target)) {\r\n isInOverlayMousedown = false;\r\n return;\r\n }\r\n\r\n that.closeLightbox(e, this, lightBoxDiv, currentTag, preventScrollFunc);\r\n });\r\n\r\n lightboxCloseButton.addEventListener(\"click\", function (e) {\r\n that.closeLightbox(e, this, lightBoxDiv, currentTag, preventScrollFunc);\r\n });\r\n\r\n lightboxCloseButton.addEventListener(\"touch\", function (e) {\r\n that.closeLightbox(e, this, lightBoxDiv, currentTag, preventScrollFunc);\r\n });\r\n\r\n lightboxCloseButton.addEventListener(\"keydown\", function (e) {\r\n /* Enter, ESC, Space */\r\n if (e.keyCode == 13 || e.keyCode == 27 || e.keyCode == 32) {\r\n that.closeLightbox(e, this, lightBoxDiv, currentTag, preventScrollFunc);\r\n }\r\n });\r\n\r\n document.addEventListener('keydown', function (e) {\r\n if (lightboxCloseButton) {\r\n if (e.keyCode === 27) {\r\n that.closeLightbox(e, lightboxCloseButton, lightBoxDiv, currentTag, preventScrollFunc);\r\n }\r\n }\r\n })\r\n\r\n lightboxOverlay.dataset.eventsInitialized = \"true\";\r\n };\r\n\r\n const openLightboxWithKeyboard = (e) => {\r\n switch (e.key) {\r\n case 'Enter':\r\n case 'Space':\r\n openLightbox(e);\r\n break;\r\n }\r\n };\r\n\r\n item.addEventListener(\"click\", openLightbox, false);\r\n item.addEventListener(\"keydown\", openLightboxWithKeyboard, false);\r\n });\r\n };\r\n\r\n that.closeLightbox = function (e, closeButton, lightbox, opener, tracker) {\r\n const playButton = lightbox.querySelector(\".mejs__playpause-button button\");\r\n\r\n e.preventDefault();\r\n e.stopImmediatePropagation();\r\n e.stopPropagation();\r\n\r\n if (lightbox.classList.contains('show')) {\r\n lightbox.classList.remove('show');\r\n\r\n if (playButton && playButton.getAttribute(\"title\") != \"Abspielen\") {\r\n playButton.click();\r\n }\r\n\r\n const hideEvent = new Event('hide');\r\n lightbox.dispatchEvent(hideEvent);\r\n }\r\n\r\n closeButton.setAttribute(\"tabindex\", -1);\r\n\r\n if (window.innerWidth >= tabletWidth) {\r\n opener.focus();\r\n }\r\n\r\n document.removeEventListener('keydown', tracker);\r\n\r\n document.querySelector(\"body\").style.overflow = 'visible';\r\n };\r\n\r\n /**\r\n * Adjusts the video player size if the controls are displayed in two rows.\r\n * Needs to call after the lightbox is shown because invisible lightbox elements cant adjust video players (no height)\r\n * Video player height is always the height of the player because the controls are usually inside the video (overlayed)\r\n * @param {any} element\r\n * \r\n * This code must be the same as in the frontend project videoplayer.js !!!\r\n * Workaround because we have not access between both projects\r\n * \r\n */\r\n function adjustPlayerHeight(element) {\r\n var controls = element.querySelector(\".mejs__controls\");\r\n var videoContainer = element.querySelector('.videoPlayer__video');\r\n var style = null;\r\n\r\n if (window.getComputedStyle) {\r\n style = getComputedStyle(controls, null);\r\n } else {\r\n style = el.currentStyle;\r\n }\r\n\r\n var bottomVal = parseFloat(style.bottom);\r\n var heightVal = parseFloat(style.height);\r\n\r\n if (bottomVal > 0 && !isNaN(heightVal)) {\r\n /* Set height on video container - previously we set the value on the element but then it conflicted with the parent margin (was ignored) */\r\n videoContainer.style.marginBottom = (heightVal - bottomVal) + \"px\";\r\n } else {\r\n videoContainer.style.removeProperty(\"margin-bottom\");\r\n }\r\n };\r\n\r\n that.setLightboxContentContainerToBody = function () {\r\n var lightboxContentContainer = document.querySelectorAll(\".lightbox-overlay-container\");\r\n\r\n if (!lightboxContentContainer) {\r\n return;\r\n }\r\n\r\n var body = document.querySelector('body');\r\n var lightboxIds = [];\r\n\r\n lightboxContentContainer.forEach(function (container) {\r\n let dataId = container.getAttribute(\"data-id\");\r\n\r\n if (lightboxIds.includes(dataId)) {\r\n // It can be possible that we have more then one lightbox container\r\n // with the same id. Based on cacheable renderings vs not cacheable renderings.\r\n // Therefore we need to remove the doubled lightbox content container\r\n container.remove();\r\n return;\r\n }\r\n\r\n lightboxIds.push(dataId);\r\n body.append(container);\r\n });\r\n };\r\n};\r\n\r\nwindow.am = window.am || {};\r\nwindow.am.lightbox = Lightbox;\r\n\r\nwindow.addEventListener('load', window.am.lightbox.init);\r\n\r\nexport default Lightbox;"],"names":["Lightbox","that","this","init","setLightboxContentContainerToBody","aTags","document","querySelectorAll","forEach","item","lightboxId","getAttribute","lightBoxDiv","querySelector","openLightbox","e","currentTag","target","blur","preventDefault","stopPropagation","stopImmediatePropagation","classList","add","showEvent","Event","dispatchEvent","videoPlayer","element","controls","videoContainer","style","window","getComputedStyle","el","currentStyle","bottomVal","parseFloat","bottom","heightVal","height","isNaN","marginBottom","removeProperty","adjustPlayerHeight","lightboxCloseButton","lightboxOverlay","lightboxContent","isInOverlayMousedown","preventScrollFunc","keycode","which","overflow","setAttribute","innerWidth","focus","dataset","eventsInitialized","addEventListener","contains","closeLightbox","keyCode","key","closeButton","lightbox","opener","tracker","playButton","remove","click","hideEvent","removeEventListener","lightboxContentContainer","body","lightboxIds","container","dataId","includes","push","append","am"],"sourceRoot":""}