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L,IAAIlD,EAAaiD","sources":["webpack://dclt.web/./wwwroot/app/src/js/image-galleries.js"],"sourcesContent":["// *****************************************\r\n// ************* Image Gallery *************\r\n// *****************************************\r\n\r\nimport PhotoSwipe from 'photoswipe';\r\nimport PhotoSwipeUI_Default from 'photoswipe/dist/photoswipe-ui-default';\r\n\r\nclass ImageGallery {\r\n\r\n constructor(el) {\r\n this.el = el;\r\n // show captions in modal?\r\n this.showCaptions = this.el.dataset.showCaptions == 'true';\r\n // get items\r\n this.items = [];\r\n this.pswp = document.querySelector('.pswp');\r\n let findItems = this.el.querySelectorAll('figure a');\r\n if(findItems != null) {\r\n [...findItems].forEach((itemElement, itemIndex) => {\r\n // store item details\r\n let dataWidth = itemElement.dataset.width,\r\n dataHeight = itemElement.dataset.height;\r\n this.items[itemIndex] = {\r\n el : itemElement,\r\n src: itemElement.getAttribute('href'),\r\n w: parseFloat(dataWidth) > 0 ? parseFloat(dataWidth) : 0,\r\n h: parseFloat(dataHeight) > 0 ? parseFloat(dataHeight) : 0,\r\n title: this.showCaptions ? itemElement.querySelector('figcaption').innerText : null,\r\n };\r\n // behaviour\r\n itemElement.onclick = (e) => {\r\n e.stopPropagation();\r\n e.preventDefault();\r\n // create lightbox\r\n this.options = {\r\n loop: false,\r\n index: itemIndex,\r\n bgOpacity: 0.95,\r\n showHideOpacity: true,\r\n preload: [1, 1]\r\n }\r\n this.lightBox = new PhotoSwipe(this.pswp, PhotoSwipeUI_Default, this.items, this.options);\r\n this.lightBox.listen('gettingData', function (index, item) {\r\n if (item.w < 1 || item.h < 1) { // unknown size\r\n var img = new Image();\r\n img.onload = function () { // will get size after load\r\n item.w = this.width; // set image width\r\n item.h = this.height; // set image height\r\n this.lightBox.invalidateCurrItems(); // reinit Items\r\n this.lightBox.updateSize(true); // reinit Items\r\n }\r\n img.src = item.src; // let's download image\r\n }\r\n });\r\n this.lightBox.init();\r\n }\r\n });\r\n }\r\n }\r\n\r\n}\r\n\r\n// export the default function to create\r\nexport function createFrom(wrappers) {\r\n wrappers.forEach((node) => {\r\n // if node is an element\r\n if (node.nodeType === 1) {\r\n new ImageGallery(node);\r\n }\r\n });\r\n}"],"names":["ImageGallery","constructor","el","this","showCaptions","dataset","items","pswp","document","querySelector","findItems","querySelectorAll","forEach","itemElement","itemIndex","dataWidth","width","dataHeight","height","src","getAttribute","w","parseFloat","h","title","innerText","onclick","e","stopPropagation","preventDefault","options","loop","index","bgOpacity","showHideOpacity","preload","lightBox","PhotoSwipe","PhotoSwipeUI_Default","listen","item","img","Image","onload","invalidateCurrItems","updateSize","init","createFrom","wrappers","node","nodeType"],"sourceRoot":""}