1const defaultOptions={downloadTitle:'Download image'};class PhotoSwipeDownload{constructor(lightbox,options){this.options={...defaultOptions,...options};this.lightbox=lightbox;this.lightbox.on('init',()=>{this.initPlugin(this.lightbox.pswp)})} 2initPlugin(pswp){const downloadSVG='<svg class="pswp__icn" viewBox="0 0 32 32" width="32" height="32">'+'<use class="pswp__icn-shadow" xlink:href="#pswp__icn-download" />'+'<g id="pswp__icn-download">'+'<path d="M 5 18 l 0 8 l 22 0 l 0 -8 l -2 0 l 0 6 l -18 0 l 0 -6 l -2 0 l 0 8" />'+'<path d="M 13 5 l 6 0 l 0 6 l 4 0 l -7 8 l -7 -8 l 4 0 l 0 -6 l 6 0" />'+'</g>'+'</svg>';pswp.on('uiRegister',()=>{pswp.ui.registerElement({name:'download-button',title:this.options.downloadTitle,order:9,isButton:!0,html:downloadSVG,onClick:(event,el)=>{this.download()}})})} 3async download(){const url=pswp.options.dataSource[pswp.currIndex].src;const image=await fetch(url);const imageBlob=await image.blob();const imageURL=URL.createObjectURL(imageBlob);const link=document.createElement('a');link.href=imageURL;link.download=url.split('/').at(-1);document.body.appendChild(link);link.click();document.body.removeChild(link)}} 4export default PhotoSwipeDownload
Line numbers count LF bytes from the start of the resource, as the search results do. Vendor segments are library code the classifier recognised; they are stored but not indexed. Bytes are shown as Latin1 characters, one per byte.