From 38e976a66b198420e8bf7f3da2f52a7657bc7345 Mon Sep 17 00:00:00 2001 From: Robin <23118399+robinheidrich@users.noreply.github.com> Date: Mon, 6 Jan 2025 02:19:34 +0100 Subject: [PATCH] Add bs5-lightbox as replacement for colorbox --- pmaweb/static/js/bs5-lightbox/index.bundle.min.js | 6 ++++++ pmaweb/static/js/bs5-lightbox/index.bundle.min.js.map | 1 + 2 files changed, 7 insertions(+) create mode 100644 pmaweb/static/js/bs5-lightbox/index.bundle.min.js create mode 100644 pmaweb/static/js/bs5-lightbox/index.bundle.min.js.map diff --git a/pmaweb/static/js/bs5-lightbox/index.bundle.min.js b/pmaweb/static/js/bs5-lightbox/index.bundle.min.js new file mode 100644 index 00000000..15ab5cb3 --- /dev/null +++ b/pmaweb/static/js/bs5-lightbox/index.bundle.min.js @@ -0,0 +1,6 @@ +/*! + * Lightbox for Bootstrap 5 v1.8.3 (https://trvswgnr.github.io/bs5-lightbox/) + * Copyright 2023 Travis Aaron Wagner (https://github.com/trvswgnr/) + * Licensed under MIT (https://github.com/trvswgnr/bs5-lightbox/blob/main/LICENSE) + */!function(){"use strict";var t={d:function(e,s){for(var a in s)t.o(s,a)&&!t.o(e,a)&&Object.defineProperty(e,a,{enumerable:!0,get:s[a]})},o:function(t,e){return Object.prototype.hasOwnProperty.call(t,e)}},e={};t.d(e,{default:function(){return i}});var s=window.bootstrap;const a={Modal:s.Modal,Carousel:s.Carousel};class o{constructor(t){let e=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{};this.hash=this.randomHash(),this.settings=Object.assign(Object.assign(Object.assign({},a.Modal.Default),a.Carousel.Default),{interval:!1,target:'[data-toggle="lightbox"]',gallery:"",size:"xl",constrain:!0}),this.settings=Object.assign(Object.assign({},this.settings),e),this.modalOptions=(()=>this.setOptionsFromSettings(a.Modal.Default))(),this.carouselOptions=(()=>this.setOptionsFromSettings(a.Carousel.Default))(),"string"==typeof t&&(this.settings.target=t,t=document.querySelector(this.settings.target)),this.el=t,this.type=t.dataset.type||"",this.src=this.getSrc(t),this.sources=this.getGalleryItems(),this.createCarousel(),this.createModal()}show(){document.body.appendChild(this.modalElement),this.modal.show()}hide(){this.modal.hide()}setOptionsFromSettings(t){return Object.keys(t).reduce(((t,e)=>Object.assign(t,{[e]:this.settings[e]})),{})}getSrc(t){let e=t.dataset.src||t.dataset.remote||t.href||"http://via.placeholder.com/1600x900";if("html"===t.dataset.type)return e;/\:\/\//.test(e)||(e=window.location.origin+e);const s=new URL(e);return(t.dataset.footer||t.dataset.caption)&&s.searchParams.set("caption",t.dataset.footer||t.dataset.caption),s.toString()}getGalleryItems(){let t;if(this.settings.gallery){if(Array.isArray(this.settings.gallery))return this.settings.gallery;t=this.settings.gallery}else this.el.dataset.gallery&&(t=this.el.dataset.gallery);return t?[...new Set(Array.from(document.querySelectorAll('[data-gallery="'.concat(t,'"]')),(t=>"".concat(t.dataset.type?t.dataset.type:"").concat(this.getSrc(t)))))]:["".concat(this.type?this.type:"").concat(this.src)]}getYoutubeId(t){if(!t)return!1;const e=t.match(/^.*(youtu.be\/|v\/|u\/\w\/|embed\/|watch\?v=|&v=)([^#&?]*).*/);return!(!e||11!==e[2].length)&&e[2]}getYoutubeLink(t){const e=this.getYoutubeId(t);if(!e)return!1;const s=t.split("?");let a=s.length>1?"?"+s[1]:"";return"https://www.youtube.com/embed/".concat(e).concat(a)}getInstagramEmbed(t){if(/instagram/.test(t))return t+=/\/embed$/.test(t)?"":"/embed",'')}isEmbed(t){const e=new RegExp("("+o.allowedEmbedTypes.join("|")+")").test(t),s=/\.(png|jpe?g|gif|svg|webp)/i.test(t)||"image"===this.el.dataset.type;return e||!s}createCarousel(){const t=document.createElement("template"),e=o.allowedMediaTypes.join("|"),s=this.sources.map(((t,s)=>{t=t.replace(/\/$/,"");const a=new RegExp("^(".concat(e,")"),"i"),o=/^html/.test(t),i=/^image/.test(t);a.test(t)&&(t=t.replace(a,""));const n=this.settings.constrain?"mw-100 mh-100 h-auto w-auto m-auto top-0 end-0 bottom-0 start-0":"h-100 w-100",l=new URLSearchParams(t.split("?")[1]);let r="",c=t;if(l.get("caption")){try{c=new URL(t),c.searchParams.delete("caption"),c=c.toString()}catch(e){c=t}r='")}let d=''),h="";const u=this.getInstagramEmbed(t),m=this.getYoutubeLink(t);this.isEmbed(t)&&!i&&(m&&(t=m,h='title="YouTube video player" frameborder="0" allow="accelerometer autoplay clipboard-write encrypted-media gyroscope picture-in-picture"'),d=u||'")),o&&(d=t);return'\n\t\t\t\t")})).join(""),i=this.sources.length<2?"":'\n\t\t\t\n\t\t\t');let n="lightbox-carousel carousel slide";"fullscreen"===this.settings.size&&(n+=" position-absolute w-100 translate-middle top-50 start-50");const l='\n\t\t\t
\n\t\t\t\t\n\t\t\t\t").concat(i,"\n\t\t\t
");t.innerHTML=l.trim(),this.carouselElement=t.content.firstChild;const r=Object.assign(Object.assign({},this.carouselOptions),{keyboard:!1});this.carousel=new a.Carousel(this.carouselElement,r);const c=this.type&&"image"!==this.type?this.type+this.src:this.src;return this.carousel.to(this.findGalleryItemIndex(this.sources,c)),!0===this.carouselOptions.keyboard&&document.addEventListener("keydown",(t=>{if("ArrowLeft"===t.code){const t=document.getElementById("#lightboxCarousel-".concat(this.hash,"-prev"));return t&&t.click(),!1}if("ArrowRight"===t.code){const t=document.getElementById("#lightboxCarousel-".concat(this.hash,"-next"));return t&&t.click(),!1}})),this.carousel}findGalleryItemIndex(t,e){let s=0;for(const a of t){if(a.includes(e))return s;s++}return 0}createModal(){const t=document.createElement("template"),e='\n\t\t\t");return t.innerHTML=e.trim(),this.modalElement=t.content.firstChild,this.modalElement.querySelector(".modal-body").appendChild(this.carouselElement),this.modalElement.addEventListener("hidden.bs.modal",(()=>this.modalElement.remove())),this.modalElement.querySelector("[data-bs-dismiss]").addEventListener("click",(()=>this.modal.hide())),this.modal=new a.Modal(this.modalElement,this.modalOptions),this.modal}randomHash(){let t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:8;return Array.from({length:t},(()=>Math.floor(36*Math.random()).toString(36))).join("")}}o.allowedEmbedTypes=["embed","youtube","vimeo","instagram","url"],o.allowedMediaTypes=[...o.allowedEmbedTypes,"image","html"],o.defaultSelector='[data-toggle="lightbox"]',o.initialize=function(t){t.preventDefault();new o(this).show()},document.querySelectorAll(o.defaultSelector).forEach((t=>t.addEventListener("click",o.initialize))),"undefined"!=typeof window&&window.bootstrap&&(window.bootstrap.Lightbox=o);var i=o;window.Lightbox=e.default}(); +//# sourceMappingURL=index.bundle.min.js.map \ No newline at end of file diff --git a/pmaweb/static/js/bs5-lightbox/index.bundle.min.js.map b/pmaweb/static/js/bs5-lightbox/index.bundle.min.js.map new file mode 100644 index 00000000..2abe6ee7 --- /dev/null +++ b/pmaweb/static/js/bs5-lightbox/index.bundle.min.js.map @@ -0,0 +1 @@ +{"version":3,"file":"index.bundle.min.js","mappings":";;;;4BACA,IAAIA,EAAsB,CCA1BA,EAAwB,SAASC,EAASC,GACzC,IAAI,IAAIC,KAAOD,EACXF,EAAoBI,EAAEF,EAAYC,KAASH,EAAoBI,EAAEH,EAASE,IAC5EE,OAAOC,eAAeL,EAASE,EAAK,CAAEI,YAAY,EAAMC,IAAKN,EAAWC,IAG3E,ECPAH,EAAwB,SAASS,EAAKC,GAAQ,OAAOL,OAAOM,UAAUC,eAAeC,KAAKJ,EAAKC,EAAO,G,2CCAtG,IAAI,EAA+BI,OAAkB,UCQrD,MAAMC,EAAY,CACjBC,MAAK,QACLC,SAAQA,EAAAA,UAET,MAAMC,EACLC,YAAYC,GAAkB,IAAdC,EAAU,UAAH,6CAAG,CAAC,EAC1BC,KAAKC,KAAOD,KAAKE,aACjBF,KAAKG,SAAWpB,OAAOqB,OAAOrB,OAAOqB,OAAOrB,OAAOqB,OAAO,CAAC,EAAGX,EAAUC,MAAMW,SAAUZ,EAAUE,SAASU,SAAU,CACpHC,UAAU,EACVC,OAAQ,2BACRC,QAAS,GACTC,KAAM,KACNC,WAAW,IAEZV,KAAKG,SAAWpB,OAAOqB,OAAOrB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AAeyC,EAASyB,QAAQC,WACrC9F,KAAK2B,aAAaZ,cAAc,eAAeW,YAAY1B,KAAK4F,iBAChE5F,KAAK2B,aAAayE,iBAAiB,mBAAmB,IAAMpG,KAAK2B,aAAaoF,WAC9E/G,KAAK2B,aAAaZ,cAAc,qBAAqBqF,iBAAiB,SAAS,IAAMpG,KAAK4B,MAAMC,SAChG7B,KAAK4B,MAAQ,IAAInC,EAAUC,MAAMM,KAAK2B,aAAc3B,KAAKW,cAClDX,KAAK4B,KACb,CACA1B,aAAuB,IAAZsD,EAAS,UAAH,6CAAG,EACnB,OAAOT,MAAMG,KAAK,CAAEM,WAAU,IAAMwD,KAAKC,MAAsB,GAAhBD,KAAKE,UAAerE,SAAS,MAAKqB,KAAK,GACvF,EAEDtE,EAASqE,kBAAoB,CAAC,QAAS,UAAW,QAAS,YAAa,OACxErE,EAAS2E,kBAAoB,IAAI3E,EAASqE,kBAAmB,QAAS,QACtErE,EAASuH,gBAAkB,2BAC3BvH,EAASwH,WAAa,SAAUlC,GAC/BA,EAAEmC,iBACe,IAAIzH,EAASI,MACrBwB,MACV,EACAV,SAASqC,iBAAiBvD,EAASuH,iBAAiBG,SAASxH,GAAOA,EAAGsG,iBAAiB,QAASxG,EAASwH,cACpF,oBAAX5H,QAA0BA,OAAOC,YAC3CD,OAAOC,UAAUG,SAAWA,GAE7B,Q","sources":["webpack://Lightbox/webpack/bootstrap","webpack://Lightbox/webpack/runtime/define property getters","webpack://Lightbox/webpack/runtime/hasOwnProperty shorthand","webpack://Lightbox/external window \"bootstrap\"","webpack://Lightbox/./src/index.js"],"sourcesContent":["// The require scope\nvar __webpack_require__ = {};\n\n","// define getter functions for harmony exports\n__webpack_require__.d = function(exports, definition) {\n\tfor(var key in definition) {\n\t\tif(__webpack_require__.o(definition, key) && !__webpack_require__.o(exports, key)) {\n\t\t\tObject.defineProperty(exports, key, { enumerable: true, get: definition[key] });\n\t\t}\n\t}\n};","__webpack_require__.o = function(obj, prop) { return Object.prototype.hasOwnProperty.call(obj, prop); }","var __WEBPACK_NAMESPACE_OBJECT__ = window[\"bootstrap\"];","/**\n * Lightbox for Bootstrap 5\n *\n * @file Creates a modal with a lightbox carousel.\n * @module bs5-lightbox\n */\n\nimport { Modal, Carousel } from 'bootstrap';\nconst bootstrap = {\n\tModal,\n\tCarousel\n};\nclass Lightbox {\n\tconstructor(el, options = {}) {\n\t\tthis.hash = this.randomHash();\n\t\tthis.settings = Object.assign(Object.assign(Object.assign({}, bootstrap.Modal.Default), bootstrap.Carousel.Default), {\n\t\t\tinterval: false,\n\t\t\ttarget: '[data-toggle=\"lightbox\"]',\n\t\t\tgallery: '',\n\t\t\tsize: 'xl',\n\t\t\tconstrain: true\n\t\t});\n\t\tthis.settings = Object.assign(Object.assign({}, this.settings), options);\n\t\tthis.modalOptions = (() => this.setOptionsFromSettings(bootstrap.Modal.Default))();\n\t\tthis.carouselOptions = (() => this.setOptionsFromSettings(bootstrap.Carousel.Default))();\n\t\tif (typeof el === 'string') {\n\t\t\tthis.settings.target = el;\n\t\t\tel = document.querySelector(this.settings.target);\n\t\t}\n\t\tthis.el = el;\n\t\tthis.type = el.dataset.type || '';\n\n\t\tthis.src = this.getSrc(el);\n\t\tthis.sources = this.getGalleryItems();\n\t\tthis.createCarousel();\n\t\tthis.createModal();\n\t}\n\tshow() {\n\t\tdocument.body.appendChild(this.modalElement);\n\t\tthis.modal.show();\n\t}\n\thide() {\n\t\tthis.modal.hide();\n\t}\n\tsetOptionsFromSettings(obj) {\n\t\treturn Object.keys(obj).reduce((p, c) => Object.assign(p, { [c]: this.settings[c] }), {});\n\t}\n\tgetSrc(el) {\n\t\tlet src = el.dataset.src || el.dataset.remote || el.href || 'http://via.placeholder.com/1600x900';\n\t\tif (el.dataset.type === 'html') {\n\t\t\treturn src;\n\t\t}\n\t\tif (!/\\:\\/\\//.test(src)) {\n\t\t\tsrc = window.location.origin + src;\n\t\t}\n\t\tconst url = new URL(src);\n\t\tif (el.dataset.footer || el.dataset.caption) {\n\t\t\turl.searchParams.set('caption', el.dataset.footer || el.dataset.caption);\n\t\t}\n\t\treturn url.toString();\n\t}\n\tgetGalleryItems() {\n\t\tlet galleryTarget;\n\t\tif (this.settings.gallery) {\n\t\t\tif (Array.isArray(this.settings.gallery)) {\n\t\t\t\treturn this.settings.gallery;\n\t\t\t}\n\t\t\tgalleryTarget = this.settings.gallery;\n\t\t} else if (this.el.dataset.gallery) {\n\t\t\tgalleryTarget = this.el.dataset.gallery;\n\t\t}\n\t\tconst gallery = galleryTarget\n\t\t\t? [...new Set(Array.from(document.querySelectorAll(`[data-gallery=\"${galleryTarget}\"]`), (v) => `${v.dataset.type ? v.dataset.type : ''}${this.getSrc(v)}`))]\n\t\t\t: [`${this.type ? this.type : ''}${this.src}`];\n\t\treturn gallery;\n\t}\n\tgetYoutubeId(src) {\n\t\tif (!src) return false;\n\t\tconst matches = src.match(/^.*(youtu.be\\/|v\\/|u\\/\\w\\/|embed\\/|watch\\?v=|&v=)([^#&?]*).*/);\n\t\treturn matches && matches[2].length === 11 ? matches[2] : false;\n\t}\n\tgetYoutubeLink(src) {\n\t\tconst youtubeId = this.getYoutubeId(src);\n\t\tif (!youtubeId) {\n\t\t\treturn false;\n\t\t}\n\n\t\tconst arr = src.split('?');\n\t\tlet params = arr.length > 1 ? '?' + arr[1] : '';\n\t\t\n\t\treturn `https://www.youtube.com/embed/${youtubeId}${params}`;\n\t}\n\tgetInstagramEmbed(src) {\n\t\tif (/instagram/.test(src)) {\n\t\t\tsrc += /\\/embed$/.test(src) ? '' : '/embed';\n\t\t\treturn ``;\n\t\t}\n\t}\n\tisEmbed(src) {\n\t\tconst regex = new RegExp('(' + Lightbox.allowedEmbedTypes.join('|') + ')');\n\t\tconst isEmbed = regex.test(src);\n\t\tconst isImg = /\\.(png|jpe?g|gif|svg|webp)/i.test(src) || this.el.dataset.type === 'image';\n\n\t\treturn isEmbed || !isImg;\n\t}\n\tcreateCarousel() {\n\t\tconst template = document.createElement('template');\n\t\tconst types = Lightbox.allowedMediaTypes.join('|');\n\t\tconst slidesHtml = this.sources\n\t\t\t.map((src, i) => {\n\t\t\t\tsrc = src.replace(/\\/$/, '');\n\t\t\t\tconst regex = new RegExp(`^(${types})`, 'i');\n\t\t\t\tconst isHtml = /^html/.test(src);\n\t\t\t\tconst isForcedImage = /^image/.test(src);\n\n\t\t\t\tif (regex.test(src)) {\n\t\t\t\t\tsrc = src.replace(regex, '');\n\t\t\t\t}\n\t\t\t\tconst imgClasses = this.settings.constrain ? 'mw-100 mh-100 h-auto w-auto m-auto top-0 end-0 bottom-0 start-0' : 'h-100 w-100';\n\t\t\t\tconst params = new URLSearchParams(src.split('?')[1]);\n\t\t\t\tlet caption = '';\n\t\t\t\tlet url = src;\n\t\t\t\tif (params.get('caption')) {\n\t\t\t\t\ttry {\n\t\t\t\t\t\turl = new URL(src);\n\t\t\t\t\t\turl.searchParams.delete('caption');\n\t\t\t\t\t\turl = url.toString();\n\t\t\t\t\t} catch (e) {\n\t\t\t\t\t\turl = src;\n\t\t\t\t\t}\n\t\t\t\t\tcaption = `

${params.get('caption')}

`;\n\t\t\t\t}\n\t\t\t\tlet inner = ``;\n\t\t\t\tlet attributes = '';\n\t\t\t\tconst instagramEmbed = this.getInstagramEmbed(src);\n\t\t\t\tconst youtubeLink = this.getYoutubeLink(src);\n\t\t\t\tif (this.isEmbed(src) && !isForcedImage) {\n\t\t\t\t\tif (youtubeLink) {\n\t\t\t\t\t\tsrc = youtubeLink;\n\t\t\t\t\t\tattributes = 'title=\"YouTube video player\" frameborder=\"0\" allow=\"accelerometer autoplay clipboard-write encrypted-media gyroscope picture-in-picture\"';\n\t\t\t\t\t}\n\t\t\t\t\tinner = instagramEmbed || ``;\n\t\t\t\t}\n\t\t\t\tif (isHtml) {\n\t\t\t\t\tinner = src;\n\t\t\t\t}\n\t\t\t\tconst spinner = `
`;\n\t\t\t\treturn `\n\t\t\t\t
\n\t\t\t\t\t${spinner}\n\t\t\t\t\t
${inner}
\n\t\t\t\t\t${caption}\n\t\t\t\t
`;\n\t\t\t})\n\t\t\t.join('');\n\t\tconst controlsHtml =\n\t\t\tthis.sources.length < 2\n\t\t\t\t? ''\n\t\t\t\t: `\n\t\t\t\n\t\t\t`;\n\t\tlet classes = 'lightbox-carousel carousel slide';\n\t\tif (this.settings.size === 'fullscreen') {\n\t\t\tclasses += ' position-absolute w-100 translate-middle top-50 start-50';\n\t\t}\n\t\tconst html = `\n\t\t\t
\n\t\t\t\t
\n\t\t\t\t\t${slidesHtml}\n\t\t\t\t
\n\t\t\t\t${controlsHtml}\n\t\t\t
`;\n\t\ttemplate.innerHTML = html.trim();\n\t\tthis.carouselElement = template.content.firstChild;\n\t\tconst carouselOptions = Object.assign(Object.assign({}, this.carouselOptions), { keyboard: false });\n\t\tthis.carousel = new bootstrap.Carousel(this.carouselElement, carouselOptions);\n\t\tconst elSrc = this.type && this.type !== 'image' ? this.type + this.src : this.src;\n\t\tthis.carousel.to(this.findGalleryItemIndex(this.sources, elSrc));\n\t\tif (this.carouselOptions.keyboard === true) {\n\t\t\tdocument.addEventListener('keydown', (e) => {\n\t\t\t\tif (e.code === 'ArrowLeft') {\n\t\t\t\t\tconst prev = document.getElementById(`#lightboxCarousel-${this.hash}-prev`);\n\t\t\t\t\tif (prev) {\n\t\t\t\t\t\tprev.click();\n\t\t\t\t\t}\n\t\t\t\t\treturn false;\n\t\t\t\t}\n\t\t\t\tif (e.code === 'ArrowRight') {\n\t\t\t\t\tconst next = document.getElementById(`#lightboxCarousel-${this.hash}-next`);\n\t\t\t\t\tif (next) {\n\t\t\t\t\t\tnext.click();\n\t\t\t\t\t}\n\t\t\t\t\treturn false;\n\t\t\t\t}\n\t\t\t});\n\t\t}\n\t\treturn this.carousel;\n\t}\n\tfindGalleryItemIndex(haystack, needle) {\n\t\tlet index = 0;\n\t\tfor (const item of haystack) {\n\t\t\tif (item.includes(needle)) {\n\t\t\t\treturn index;\n\t\t\t}\n\t\t\tindex++;\n\t\t}\n\t\treturn 0;\n\t}\n\tcreateModal() {\n\t\tconst template = document.createElement('template');\n\t\tconst btnInner =\n\t\t\t'';\n\t\tconst html = `\n\t\t\t
\n\t\t\t\t
\n\t\t\t\t\t
\n\t\t\t\t\t\t
\n\t\t\t\t\t\t\t\n\t\t\t\t\t\t
\n\t\t\t\t\t
\n\t\t\t\t
\n\t\t\t
`;\n\t\ttemplate.innerHTML = html.trim();\n\t\tthis.modalElement = template.content.firstChild;\n\t\tthis.modalElement.querySelector('.modal-body').appendChild(this.carouselElement);\n\t\tthis.modalElement.addEventListener('hidden.bs.modal', () => this.modalElement.remove());\n\t\tthis.modalElement.querySelector('[data-bs-dismiss]').addEventListener('click', () => this.modal.hide());\n\t\tthis.modal = new bootstrap.Modal(this.modalElement, this.modalOptions);\n\t\treturn this.modal;\n\t}\n\trandomHash(length = 8) {\n\t\treturn Array.from({ length }, () => Math.floor(Math.random() * 36).toString(36)).join('');\n\t}\n}\nLightbox.allowedEmbedTypes = ['embed', 'youtube', 'vimeo', 'instagram', 'url'];\nLightbox.allowedMediaTypes = [...Lightbox.allowedEmbedTypes, 'image', 'html'];\nLightbox.defaultSelector = '[data-toggle=\"lightbox\"]';\nLightbox.initialize = function (e) {\n\te.preventDefault();\n\tconst lightbox = new Lightbox(this);\n\tlightbox.show();\n};\ndocument.querySelectorAll(Lightbox.defaultSelector).forEach((el) => el.addEventListener('click', Lightbox.initialize));\nif (typeof window !== 'undefined' && window.bootstrap) {\n\twindow.bootstrap.Lightbox = Lightbox;\n}\nexport default Lightbox;\n"],"names":["__webpack_require__","exports","definition","key","o","Object","defineProperty","enumerable","get","obj","prop","prototype","hasOwnProperty","call","window","bootstrap","Modal","Carousel","Lightbox","constructor","el","options","this","hash","randomHash","settings","assign","Default","interval","target","gallery","size","constrain","modalOptions","setOptionsFromSettings","carouselOptions","document","querySelector","type","dataset","src","getSrc","sources","getGalleryItems","createCarousel","createModal","show","body","appendChild","modalElement","modal","hide","keys","reduce","p","c","remote","href","test","location","origin","url","URL","footer","caption","searchParams","set","toString","galleryTarget","Array","isArray","Set","from","querySelectorAll","v","getYoutubeId","matches","match","length","getYoutubeLink","youtubeId","arr","split","params","getInstagramEmbed","isEmbed","RegExp","allowedEmbedTypes","join","isImg","template","createElement","types","allowedMediaTypes","slidesHtml","map","i","replace","regex","isHtml","isForcedImage","imgClasses","URLSearchParams","delete","e","inner","attributes","instagramEmbed","youtubeLink","controlsHtml","classes","html","innerHTML","trim","carouselElement","content","firstChild","keyboard","carousel","elSrc","to","findGalleryItemIndex","addEventListener","code","prev","getElementById","click","next","haystack","needle","index","item","includes","remove","Math","floor","random","defaultSelector","initialize","preventDefault","forEach"],"sourceRoot":""} \ No newline at end of file