Huge News!Announcing our $40M Series B led by Abstract Ventures.Learn More
Socket
Sign inDemoInstall
Socket

bs5-lightbox

Package Overview
Dependencies
Maintainers
1
Versions
51
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

bs5-lightbox - npm Package Compare versions

Comparing version 1.2.1 to 1.2.2

index.html

8

bs5-lightbox.esm.js

@@ -15,3 +15,3 @@ /**

#types = ['embed', 'youtube', 'vimeo', 'image', 'instagram']
#types = ['embed', 'youtube', 'vimeo', 'instagram']

@@ -78,3 +78,7 @@ #hash = this.#randomHash();

const regex = new RegExp(this.#types.join('|'));
return regex.test(src) || !/\.(png|jpe?g|gif|svg|webp)/.test(src);
const isEmbed = regex.test(src);
console.log(isEmbed);
const isImg = /\.(png|jpe?g|gif|svg|webp)/.test(src);
console.log(isImg)
return isEmbed || !isImg;
}

@@ -81,0 +85,0 @@

@@ -1,1 +0,1 @@

!function(){"use strict";var t=bootstrap;function e(t,e){s(t,e),e.add(t)}function a(t,e,a){s(t,e),e.set(t,a)}function s(t,e){if(e.has(t))throw new TypeError("Cannot initialize the same private elements twice on an object")}function i(t,e){return function(t,e){return e.get?e.get.call(t):e.value}(t,n(t,e,"get"))}function n(t,e,a){if(!e.has(t))throw new TypeError("attempted to "+a+" private field on non-instance");return e.get(t)}function l(t,e,a){if(!e.has(t))throw new TypeError("attempted to get private field on non-instance");return a}var o=new WeakMap,r=new WeakMap,c=new WeakMap,d=new WeakSet,h=new WeakSet,u=new WeakSet,m=new WeakSet,p=new WeakSet,b=new WeakSet,v=new WeakSet,f=new WeakSet;function g(t){return t.dataset.src||t.dataset.remote||t.href||"http://via.placeholder.com/1600x900"}function y(){let t="";if(i(this,o).gallery){if(Array.isArray(i(this,o).gallery))return i(this,o).gallery;t=i(this,o).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?"embed":"").concat(l(this,d,g).call(this,t)))))]:[this.src]}function w(t){if(!t)return!1;let e=t.match(/^.*(youtu.be\/|v\/|u\/\w\/|embed\/|watch\?v=|\&v=)([^#\&\?]*).*/);return!(!e||11!==e[2].length)&&e[2]}function x(t){if(/instagram/.test(t))return t+=/\/embed$/.test(t)?"":"/embed",'<div class="ratio ratio-1x1" style="max-height: 69vh;"><iframe src="'.concat(t,'" class="start-50 translate-middle-x" style="max-width: 500px;" frameborder="0" scrolling="no" allowtransparency="true"></iframe></div>')}function E(t){return new RegExp(i(this,r).join("|")).test(t)||!/\.(png|jpe?g|gif|svg|webp)/.test(t)}function k(){const e=document.createElement("template"),a=this.sources.map(((t,e)=>{t=t.replace(/\/$/,"");let a='<img src="'.concat(t,'" class="d-block w-100" />'),s="";const i=l(this,m,x).call(this,t),n=l(this,u,w).call(this,t);return l(this,p,E).call(this,t)&&(/^embed/.test(t)&&(t=t.substring(5)),n&&(t="https://www.youtube.com/embed/".concat(n),s='title="YouTube video player" frameborder="0" allow="accelerometer; autoplay; clipboard-write; encrypted-media; gyroscope; picture-in-picture"'),a=i||'<div class="ratio ratio-16x9"><iframe src="'.concat(t,'" ').concat(s," allowfullscreen></iframe></div>")),'<div class="carousel-item '.concat(e?"":"active",'">').concat(a,"</div>")})).join(""),s=this.sources.length<2?"":'\n\t\t\t<button class="carousel-control carousel-control-prev h-75 m-auto" type="button" data-bs-target="#lightboxCarousel-'.concat(i(this,c),'" data-bs-slide="prev">\n\t\t\t\t<span class="carousel-control-prev-icon" aria-hidden="true"></span>\n\t\t\t\t<span class="visually-hidden">Previous</span>\n\t\t\t</button>\n\t\t\t<button class="carousel-control carousel-control-next h-75 m-auto" type="button" data-bs-target="#lightboxCarousel-').concat(i(this,c),'" data-bs-slide="next">\n\t\t\t\t<span class="carousel-control-next-icon" aria-hidden="true"></span>\n\t\t\t\t<span class="visually-hidden">Next</span>\n\t\t\t</button>'),n='\n\t\t\t<div id="lightboxCarousel-'.concat(i(this,c),'" class="lightbox-carousel carousel" data-interval="false">\n\t\t\t\t<div class="carousel-inner">\n\t\t\t\t\t').concat(a,"\n\t\t\t\t</div>\n\t\t\t\t").concat(s,"\n\t\t\t</div>");e.innerHTML=n.trim(),this.carouselEl=e.content.firstChild,this.carousel=new t.Carousel(this.carouselEl,{ride:!1,interval:!1}),this.carousel.to(this.sources.includes(this.src)?this.sources.indexOf(this.src):0)}function S(){const e=document.createElement("template"),a='\n\t\t\t<div class="modal lightbox fade" id="lightboxModal-'.concat(i(this,c),'" tabindex="-1" aria-hidden="true">\n\t\t\t\t<div class="modal-dialog modal-dialog-centered modal-xl">\n\t\t\t\t\t<div class="modal-content border-0">\n\t\t\t\t\t\t<div class="modal-body p-0">\n\t\t\t\t\t\t\t<button type="button" class="btn-close position-absolute top-0 end-0 p-3" data-bs-dismiss="modal" aria-label="Close" style="z-index: 2;"></button>\n\t\t\t\t\t\t</div>\n\t\t\t\t\t</div>\n\t\t\t\t</div>\n\t\t\t</div>');e.innerHTML=a.trim(),this.modalEl=e.content.firstChild,this.modalEl.querySelector(".modal-body").appendChild(this.carouselEl),this.modalEl.addEventListener("hidden.bs.modal",(t=>this.modalEl.remove())),document.body.appendChild(this.modalEl),this.modal=new t.Modal(this.modalEl),this.modal.show()}function W(t=8){return Array.from({length:t},(()=>Math.floor(36*Math.random()).toString(36))).join("")}new class{constructor(t={}){var s,w,x;e(this,f),e(this,v),e(this,b),e(this,p),e(this,m),e(this,u),e(this,h),e(this,d),a(this,o,{writable:!0,value:{target:'[data-toggle="lightbox"]'}}),a(this,r,{writable:!0,value:["embed","youtube","vimeo","image","instagram"]}),a(this,c,{writable:!0,value:l(this,f,W).call(this)}),"string"==typeof t&&(i(this,o).target=t,t=void 0!==arguments[1]?arguments[1]:{}),s=this,w=o,x={...i(this,o),...t},function(t,e,a){if(e.set)e.set.call(t,a);else{if(!e.writable)throw new TypeError("attempted to set read only private field");e.value=a}}(s,n(s,w,"set"),x),document.querySelectorAll(i(this,o).target).forEach((t=>{t.addEventListener("click",(e=>{e.preventDefault(),this.el=t,this.type=t.dataset.type||"image",this.src=l(this,d,g).call(this,t),this.src="image"!==this.type?"embed"+this.src:this.src,this.sources=l(this,h,y).call(this),l(this,b,k).call(this),l(this,v,S).call(this)}))}))}}}();
!function(){"use strict";var t=bootstrap;function e(t,e){s(t,e),e.add(t)}function a(t,e,a){s(t,e),e.set(t,a)}function s(t,e){if(e.has(t))throw new TypeError("Cannot initialize the same private elements twice on an object")}function i(t,e){return function(t,e){return e.get?e.get.call(t):e.value}(t,n(t,e,"get"))}function n(t,e,a){if(!e.has(t))throw new TypeError("attempted to "+a+" private field on non-instance");return e.get(t)}function o(t,e,a){if(!e.has(t))throw new TypeError("attempted to get private field on non-instance");return a}var l=new WeakMap,r=new WeakMap,c=new WeakMap,d=new WeakSet,h=new WeakSet,u=new WeakSet,m=new WeakSet,p=new WeakSet,b=new WeakSet,v=new WeakSet,f=new WeakSet;function g(t){return t.dataset.src||t.dataset.remote||t.href||"http://via.placeholder.com/1600x900"}function y(){let t="";if(i(this,l).gallery){if(Array.isArray(i(this,l).gallery))return i(this,l).gallery;t=i(this,l).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?"embed":"").concat(o(this,d,g).call(this,t)))))]:[this.src]}function w(t){if(!t)return!1;let e=t.match(/^.*(youtu.be\/|v\/|u\/\w\/|embed\/|watch\?v=|\&v=)([^#\&\?]*).*/);return!(!e||11!==e[2].length)&&e[2]}function x(t){if(/instagram/.test(t))return t+=/\/embed$/.test(t)?"":"/embed",'<div class="ratio ratio-1x1" style="max-height: 69vh;"><iframe src="'.concat(t,'" class="start-50 translate-middle-x" style="max-width: 500px;" frameborder="0" scrolling="no" allowtransparency="true"></iframe></div>')}function E(t){const e=new RegExp(i(this,r).join("|")).test(t);console.log(e);const a=/\.(png|jpe?g|gif|svg|webp)/.test(t);return console.log(a),e||!a}function k(){const e=document.createElement("template"),a=this.sources.map(((t,e)=>{t=t.replace(/\/$/,"");let a='<img src="'.concat(t,'" class="d-block w-100" />'),s="";const i=o(this,m,x).call(this,t),n=o(this,u,w).call(this,t);return o(this,p,E).call(this,t)&&(/^embed/.test(t)&&(t=t.substring(5)),n&&(t="https://www.youtube.com/embed/".concat(n),s='title="YouTube video player" frameborder="0" allow="accelerometer; autoplay; clipboard-write; encrypted-media; gyroscope; picture-in-picture"'),a=i||'<div class="ratio ratio-16x9"><iframe src="'.concat(t,'" ').concat(s," allowfullscreen></iframe></div>")),'<div class="carousel-item '.concat(e?"":"active",'">').concat(a,"</div>")})).join(""),s=this.sources.length<2?"":'\n\t\t\t<button class="carousel-control carousel-control-prev h-75 m-auto" type="button" data-bs-target="#lightboxCarousel-'.concat(i(this,c),'" data-bs-slide="prev">\n\t\t\t\t<span class="carousel-control-prev-icon" aria-hidden="true"></span>\n\t\t\t\t<span class="visually-hidden">Previous</span>\n\t\t\t</button>\n\t\t\t<button class="carousel-control carousel-control-next h-75 m-auto" type="button" data-bs-target="#lightboxCarousel-').concat(i(this,c),'" data-bs-slide="next">\n\t\t\t\t<span class="carousel-control-next-icon" aria-hidden="true"></span>\n\t\t\t\t<span class="visually-hidden">Next</span>\n\t\t\t</button>'),n='\n\t\t\t<div id="lightboxCarousel-'.concat(i(this,c),'" class="lightbox-carousel carousel" data-interval="false">\n\t\t\t\t<div class="carousel-inner">\n\t\t\t\t\t').concat(a,"\n\t\t\t\t</div>\n\t\t\t\t").concat(s,"\n\t\t\t</div>");e.innerHTML=n.trim(),this.carouselEl=e.content.firstChild,this.carousel=new t.Carousel(this.carouselEl,{ride:!1,interval:!1}),this.carousel.to(this.sources.includes(this.src)?this.sources.indexOf(this.src):0)}function S(){const e=document.createElement("template"),a='\n\t\t\t<div class="modal lightbox fade" id="lightboxModal-'.concat(i(this,c),'" tabindex="-1" aria-hidden="true">\n\t\t\t\t<div class="modal-dialog modal-dialog-centered modal-xl">\n\t\t\t\t\t<div class="modal-content border-0">\n\t\t\t\t\t\t<div class="modal-body p-0">\n\t\t\t\t\t\t\t<button type="button" class="btn-close position-absolute top-0 end-0 p-3" data-bs-dismiss="modal" aria-label="Close" style="z-index: 2;"></button>\n\t\t\t\t\t\t</div>\n\t\t\t\t\t</div>\n\t\t\t\t</div>\n\t\t\t</div>');e.innerHTML=a.trim(),this.modalEl=e.content.firstChild,this.modalEl.querySelector(".modal-body").appendChild(this.carouselEl),this.modalEl.addEventListener("hidden.bs.modal",(t=>this.modalEl.remove())),document.body.appendChild(this.modalEl),this.modal=new t.Modal(this.modalEl),this.modal.show()}function W(t=8){return Array.from({length:t},(()=>Math.floor(36*Math.random()).toString(36))).join("")}new class{constructor(t={}){var s,w,x;e(this,f),e(this,v),e(this,b),e(this,p),e(this,m),e(this,u),e(this,h),e(this,d),a(this,l,{writable:!0,value:{target:'[data-toggle="lightbox"]'}}),a(this,r,{writable:!0,value:["embed","youtube","vimeo","instagram"]}),a(this,c,{writable:!0,value:o(this,f,W).call(this)}),"string"==typeof t&&(i(this,l).target=t,t=void 0!==arguments[1]?arguments[1]:{}),s=this,w=l,x={...i(this,l),...t},function(t,e,a){if(e.set)e.set.call(t,a);else{if(!e.writable)throw new TypeError("attempted to set read only private field");e.value=a}}(s,n(s,w,"set"),x),document.querySelectorAll(i(this,l).target).forEach((t=>{t.addEventListener("click",(e=>{e.preventDefault(),this.el=t,this.type=t.dataset.type||"image",this.src=o(this,d,g).call(this,t),this.src="image"!==this.type?"embed"+this.src:this.src,this.sources=o(this,h,y).call(this),o(this,b,k).call(this),o(this,v,S).call(this)}))}))}}}();
{
"name": "bs5-lightbox",
"version": "1.2.1",
"version": "1.2.2",
"author": {

@@ -5,0 +5,0 @@ "name": "Travis Aaron Wagner",

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc