filesafe/dist/js/album.js.map

1 line
3.8 KiB
Plaintext

{"version":3,"sources":["album.js"],"names":["const","lsKeys","page","lazyLoad","lightbox","lightboxExts","updateImageContainer","element","container","parentNode","classList","contains","sizeElement","querySelector","string","dataset","value","innerHTML","getPrettyBytes","parseInt","dateElement","document","getPrettyDate","Date","window","addEventListener","headerSize","LazyLoad","unobserve_entered","callback_enter","imageExtsRegex","RegExp","map","ext","substring","join","SimpleLightbox","captions","captionSelector","captionType","captionsData","captionPosition","captionDelay","fileExt","preloading","uniqueImages"],"mappings":"AAGAA,IAAMC,OAAS,CAAA,EAETC,KAAO,CACXC,SAAU,KACVC,SAAU,KAIVC,aAAc,CAAC,OAAQ,QAAS,OAAQ,OAAQ,OAAQ,OAAQ,QAAS,QAAS,QAElFC,qBAAoB,SAAEC,GAEpBP,IAAMQ,EAAYD,EAAQE,WAAWA,WACrC,GAAKD,EAAUE,UAAUC,SAAS,mBAAlC,CAEAX,IAAMY,EAAcJ,EAAUK,cAAc,cAC5C,GAAID,EAAa,CACfZ,IAAMc,EAASF,EAAYG,QAAQC,OAASJ,EAAYK,UACxDL,EAAYK,UAAYf,KAAKgB,eAAeC,SAASL,EAAQ,IAC/D,CAEAd,IAAMoB,EAAcC,SAASR,cAAc,cAC3C,GAAIO,EAAa,CACfpB,IAAMc,EAASM,EAAYL,QAAQC,MACnCI,EAAYH,UAAYf,KAAKoB,cAAc,IAAIC,KAA4B,IAAvBJ,SAASL,EAAQ,KACvE,CAZsD,CAaxD,GAGFU,OAAOC,iBAAiB,oBAAkB,WAExCzB,IAAM0B,EAAaL,SAASR,cAAc,qBAC1C,GAAIa,EAAY,CACd1B,IAAMc,EAASY,EAAWX,QAAQC,OAASU,EAAWT,UACtDS,EAAWT,UAAYf,KAAKgB,eAAeC,SAASL,EAAQ,IAC9D,CAGAZ,KAAKC,SAAW,IAAIwB,SAAS,CAC3BC,mBAAmB,EACnBC,eAAgB3B,KAAKI,uBAKvBN,IAAM8B,EAAiB,IAAIC,OAAO,GAAG7B,KAAKG,aAAa2B,KAAG,SAACC,GACzD,OAAOA,EAAIC,UAAU,EACvB,IAAGC,KAAK,KAAQ,KAEhBjC,KAAKE,SAAW,IAAIgC,eAAe,iBAAkB,CACnDC,UAAU,EACVC,gBAAiB,MACjBC,YAAa,OACbC,aAAc,MACdC,gBAAiB,SACjBC,aAAc,IACdC,QAASb,EACTc,YAAY,EACZC,cAAc,GAElB","file":"album.js","sourcesContent":["/* global LazyLoad, SimpleLightbox */\n\n// eslint-disable-next-line no-unused-vars\nconst lsKeys = {}\n\nconst page = {\n lazyLoad: null,\n lightbox: null,\n\n // Array of extensions that will be whitelisted for SimpleLightbox\n // Should only include image extensions that can be rendered directly on browsers\n lightboxExts: ['.gif', '.jpeg', '.jpg', '.png', '.svg', '.tif', '.tiff', '.webp', '.bmp'],\n\n updateImageContainer: element => {\n // Update size & string elements within each individual image container\n const container = element.parentNode.parentNode\n if (!container.classList.contains('image-container')) return\n\n const sizeElement = container.querySelector('.file-size')\n if (sizeElement) {\n const string = sizeElement.dataset.value || sizeElement.innerHTML\n sizeElement.innerHTML = page.getPrettyBytes(parseInt(string, 10))\n }\n\n const dateElement = document.querySelector('.file-date')\n if (dateElement) {\n const string = dateElement.dataset.value\n dateElement.innerHTML = page.getPrettyDate(new Date(parseInt(string, 10) * 1000))\n }\n }\n}\n\nwindow.addEventListener('DOMContentLoaded', () => {\n // Update size string in album header block\n const headerSize = document.querySelector('#count .file-size')\n if (headerSize) {\n const string = headerSize.dataset.value || headerSize.innerHTML\n headerSize.innerHTML = page.getPrettyBytes(parseInt(string, 10))\n }\n\n // Attach callback function to lazyloader\n page.lazyLoad = new LazyLoad({\n unobserve_entered: true,\n callback_enter: page.updateImageContainer\n })\n\n // Build RegExp out of imageExts array\n // SimpleLightbox demands RegExp for configuring supported file extensions\n const imageExtsRegex = new RegExp(`${page.lightboxExts.map(ext => {\n return ext.substring(1) // removes starting dot\n }).join('|')}`, 'i')\n\n page.lightbox = new SimpleLightbox('#table a.image', {\n captions: true,\n captionSelector: 'img',\n captionType: 'attr',\n captionsData: 'alt',\n captionPosition: 'bottom',\n captionDelay: 500,\n fileExt: imageExtsRegex,\n preloading: false,\n uniqueImages: false\n })\n})\n"]}