New Case Study:See how Anthropic automated 95% of dependency reviews with Socket.Learn More
Socket
Sign inDemoInstall
Socket

imagelightbox

Package Overview
Dependencies
Maintainers
1
Versions
31
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

imagelightbox - npm Package Compare versions

Comparing version 1.0.2 to 1.1.0

6

CHANGELOG.md

@@ -10,2 +10,8 @@ # Changelog

## [1.1.0] - 2020-06-13
### Added
- Added the option to explicitly specify video dimensions (@marekdedic)
## [1.0.2] - 2019-06-26

@@ -12,0 +18,0 @@

2

dist/imagelightbox.min.js

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

!function(M,D,R){"use strict";var z=M("<div/>").attr("class","imagelightbox-loading").append(M("<div/>")),t=M("<button/>",{type:"button",class:"imagelightbox-arrow imagelightbox-arrow-left"}),e=M("<button/>",{type:"button",class:"imagelightbox-arrow imagelightbox-arrow-right"}),X=t.add(e),j=M("<div/>",{class:"imagelightbox-caption",html:"&nbsp;"}),N=M("<button/>",{type:"button",class:"imagelightbox-close"}),U=M("<div/>",{class:"imagelightbox-overlay"}),V=M("<a/>",{href:"#",class:"imagelightbox-navitem"}),K=M("<div/>",{class:"imagelightbox-nav"}),Y=M("<div/>",{class:"imagelightbox-wrapper"}),_=M("body"),o=function(){var t=R.body||R.documentElement;return""===(t=t.style).transition?"":""===t.WebkitTransition?"-webkit-":""===t.MozTransition?"-moz-":""===t.OTransition&&"-o-"},H=!1!==o(),W=function(t,e,i){var n={},a=o();n[a+"transform"]="translateX("+e+") translateY(-50%)",n[a+"transition"]=a+"transform "+i+"s ease-in",t.css(n)},$="ontouchstart"in D,B=D.navigator.pointerEnabled||D.navigator.msPointerEnabled,Q=function(t){if($)return!0;if(!B||void 0===t||void 0===t.pointerType)return!1;if(void 0!==t.MSPOINTER_TYPE_MOUSE){if(t.MSPOINTER_TYPE_MOUSE!==t.pointerType)return!0}else if("mouse"!==t.pointerType)return!0;return!1},A=!!(R.fullscreenEnabled||R.webkitFullscreenEnabled||R.mozFullScreenEnabled||R.msFullscreenEnabled),G=!(!D.history||!history.pushState);M.fn.imageLightbox=function(t){var i="",s=M([]),u=M(),d=M([]),r=-1,g=M(),f=0,h=!1,n=0,p=M.extend({selector:"a[data-imagelightbox]",id:"imagelightbox",allowedTypes:"png|jpg|jpeg|gif",animationSpeed:250,activity:!1,arrows:!1,button:!1,caption:!1,enableKeyboard:!0,history:!1,fullscreen:!1,gutter:10,offsetY:0,navigation:!1,overlay:!1,preloadNext:!0,quitOnEnd:!1,quitOnImgClick:!1,quitOnDocClick:!0,quitOnEscKey:!0},t),b=function(){p.activity&&y(),p.arrows&&X.css("display","block")},a=function(t,e,i){var n=e+"="+i,a="?"+n;if(t){var o=new RegExp("([?&])"+e+"=[^&]*");a=null!==t.match(o)?t.replace(o,"$1"+n):t+"&"+n}return a},o=function(){if(G&&p.history){var t=s[r].dataset.ilb2Id;t||(t=r);var e={imageLightboxIndex:t},i=s[r].dataset.imagelightbox;i&&(e.imageLightboxSet=i);var n=a(R.location.search,"imageLightboxIndex",t);i&&(n=a(n,"imageLightboxSet",i)),D.history.pushState(e,"",R.location.pathname+n)}},e=function(t,e){var i=t;if(i){var n=new RegExp("\\?"+e+"=[^&]*"),a=new RegExp("&"+e+"=[^&]*");i=(i=i.replace(n,"?")).replace(a,"")}return i},l=function(t){var e=new RegExp("[?&]"+t+"(=([^&#]*)|&|#|$)").exec(R.location.search);if(e&&e[2])return decodeURIComponent(e[2].replace(/\+/g," "))},c=function(){if(G&&p.history){var t=l("imageLightboxIndex");if(t){var e=s.filter('[data-ilb2-id="'+t+'"]');0<e.length?r=s.index(e):e=M(s[r=t]);var i=l("imageLightboxSet");!e[0]||i&&i!==e[0].dataset.imagelightbox||T(e,!0)}}},m=function(){if(--r<0){if(!0===p.quitOnEnd)return void L();r=s.length-1}u=s.eq(r),o(),Y.trigger("previous.ilb2",u),O(1)},v=function(){if(++r>=s.length){if(!0===p.quitOnEnd)return void L();r=0}o(),u=s.eq(r),Y.trigger("next.ilb2",u),O(-1)},x=function(){Y.append(z)},y=function(){M(".imagelightbox-loading").remove()},E=function(){Y.append(U)},w=function(){N.appendTo(Y).on("click.ilb7",function(){return L(),!1})},S=function(){j.css("opacity","0"),j.html("&nbsp;"),M(u).data("ilb2-caption")?(j.css("opacity","1"),j.html(M(u).data("ilb2-caption"))):M(u).find("img").attr("alt")&&(j.css("opacity","1"),j.html(M(u).find("img").attr("alt")))},q=function(){if(s.length){for(var t=0;t<s.length;t++)K.append(V.clone());var e=K.children("a");e.eq(s.index(u)).addClass("active"),Y.on("previous.ilb2 next.ilb2",function(){e.removeClass("active").eq(s.index(u)).addClass("active")}),Y.append(K),K.on("click.ilb7 touchend.ilb7",function(){return!1}).on("click.ilb7 touchend.ilb7","a",function(){var t=M(this);if(s.eq(t.index()).attr("href")!==M(".imagelightbox").attr("src")){var e=s.eq(t.index());e.length&&(n=s.index(u),u=e,O(t.index()<n?-1:1))}t.addClass("active").siblings().removeClass("active")})}},I=function(){Y.append(X),X.on("click.ilb7 touchend.ilb7",function(t){return t.stopImmediatePropagation(),t.preventDefault(),M(this).hasClass("imagelightbox-arrow-left")?m():v(),!1})},k=function(){if(!g.length)return!0;var t=p.caption?j.outerHeight():0,r=M(D).width(),l=M(D).height()-t,c=Math.abs(1-p.gutter/100);function e(t,e){if(r<t||l<e){var i=r/l<t/e?t/r:e/l;t/=i,e/=i}var n=e*c,a=t*c,o=(M(D).width()-a)/2;g.css({width:a+"px",height:n+"px",left:o+"px"})}if(void 0===g.get(0).videoWidth){var i=new Image;i.src=g.attr("src"),i.onload=function(){e(i.width,i.height)}}else e(g.get(0).videoWidth,g.get(0).videoHeight)},O=function(c){if(h)return!1;if(g.length){var t={opacity:0};H?W(g,100*c-f+"px",p.animationSpeed/1e3):t.left=parseInt(g.css("left"))+100*c+"px",g.animate(t,p.animationSpeed,function(){C()}),f=0}h=!0,p.activity&&x(),p.caption&&S(),setTimeout(function(){var t,e,i=u.attr("href"),n=0,a=0,o=0,r=u.data("ilb2Video");function l(){var t={opacity:1};if(g.appendTo(Y),k(),g.css("opacity",0),H)W(g,-100*c+"px",0),setTimeout(function(){W(g,"0px",p.animationSpeed/1e3)},50);else{var e=parseInt(g.css("left"));t.left=e+"px",g.css("left",e-100*c+"px")}if(g.animate(t,p.animationSpeed,function(){h=!1,b()}),p.preloadNext){var i=s.eq(s.index(u)+1);i.length||(i=s.eq(0)),M("<img />").attr("src",i.attr("href"))}Y.trigger("loaded.ilb2")}r?d.each(function(){this.i===u.data("ilb2VideoId")&&(t=this.l,e=this.e,this.a&&(!1===t&&e.attr("autoplay",this.a),!0===t&&e.get(0).play()))}):e=M("<img id='"+p.id+"' />").attr("src",i),g=e.on("load.ilb7",l).on("error.ilb7",function(){b()}).on("touchstart.ilb7 pointerdown.ilb7 MSPointerDown.ilb7",function(t){if(!Q(t.originalEvent)||p.quitOnImgClick)return!0;H&&(o=parseInt(g.css("left"))),n=t.originalEvent.pageX||t.originalEvent.touches[0].pageX}).on("touchmove.ilb7 pointermove.ilb7 MSPointerMove.ilb7",function(t){if(!B&&"pointermove"===t.type||!Q(t.originalEvent)||p.quitOnImgClick)return!0;t.preventDefault(),a=t.originalEvent.pageX||t.originalEvent.touches[0].pageX,f=n-a,H?W(g,-f+"px",0):g.css("left",o-f+"px")}).on("touchend.ilb7 touchcancel.ilb7 pointerup.ilb7 pointercancel.ilb7 MSPointerUp.ilb7 MSPointerCancel.ilb7",function(t){if(!Q(t.originalEvent)||p.quitOnImgClick)return!0;50<Math.abs(f)?f<0?m():v():H?W(g,"0px",p.animationSpeed/1e3):g.animate({left:o+"px"},p.animationSpeed/2)}),!0===t&&l(),!1===t&&(g=g.on("loadedmetadata.ilb7",l)),r||(g=g.on(B?"pointerup.ilb7 MSPointerUp.ilb7":"click.ilb7",function(t){if(t.preventDefault(),p.quitOnImgClick)return L(),!1;if(Q(t.originalEvent))return!0;var e=(t.pageX||t.originalEvent.pageX)-t.target.offsetLeft;t.target.width/2>e?m():v()}))},p.animationSpeed+100)},C=function(){if(!g.length)return!1;g.remove(),g=M()},T=function(t,e){if(h)return!1;h=!1,u=t,r=s.index(u),e||o(),function(){p.arrows&&I(this),p.navigation&&q(),p.overlay&&E(),p.button&&w(),p.caption&&Y.append(j)}(),_.append(Y).addClass("imagelightbox-open"),Y.trigger("start.ilb2",t),O(0)},L=function(t){if(r=-1,t||function(){if(G&&p.history){var t=e(R.location.search,"imageLightboxIndex");t=e(t,"imageLightboxSet"),D.history.pushState({},"",R.location.pathname+t)}}(),Y.trigger("quit.ilb2"),_.removeClass("imagelightbox-open"),!g.length)return!1;g.animate({opacity:0},p.animationSpeed,function(){C(),h=!1,Y.remove().find("*").remove()})},P=function(e){e.each(function(){s=e.add(M(this))}),e.on("click.ilb7",{set:i},function(t){t.preventDefault(),i=M(t.currentTarget).data("imagelightbox"),e.filter(function(){return M(this).data("imagelightbox")===i}).filter(function(){return function(t){return"a"===M(t).prop("tagName").toLowerCase()&&(new RegExp(".("+p.allowedTypes+")$","i").test(M(t).attr("href"))||M(t).data("ilb2Video"))}(M(this))}).each(function(){s=s.add(M(this))}),s.length<1?L():T(M(this))})},F=function(t){t.each(function(){var t=M(this).data("ilb2Video");if(t){var e=M(this).data("ilb2Id");e||(e="a"+(65536*(1+Math.random())|0).toString(16)),M(this).data("ilb2VideoId",e);var n={e:M("<video id='"+p.id+"' preload='metadata'>"),i:e,l:!1,a:void 0};M.each(t,function(t,e){"autoplay"===t?n.a=e:"sources"!==t&&(n.e=n.e.attr(t,e))}),t.sources&&M.each(t.sources,function(t,e){var i=M("<source>");M.each(e,function(t,e){i=i.attr(t,e)}),n.e.append(i)}),n.e.on("loadedmetadata.ilb7",function(){n.l=!0}),d=d.add(n)}})};return M(D).on("resize.ilb7",k),G&&p.history&&M(D).on("popstate",function(t){var e=t.originalEvent.state;if(e){var i=e.imageLightboxIndex;if(void 0!==i){var n=s.filter('[data-ilb2-id="'+i+'"]');if(0<n.length)var a=s.index(n);else n=M(s[a=i]);if(n[0]&&(!e.imageLightboxSet||e.imageLightboxSet===n[0].dataset.imagelightbox))if(r<0)T(n,!0);else{var o=1;r<a&&(o=-1),u=n,r=a,O(o)}}else L(!0)}else L(!0)}),M(R).ready(function(){p.quitOnDocClick&&M(R).on($?"touchend.ilb7":"click.ilb7",function(t){g.length&&!M(t.target).is(g)&&(t.preventDefault(),L())}),p.fullscreen&&A&&M(R).on("keydown.ilb7",function(t){if(!g.length)return!0;-1<[9,32,38,40].indexOf(t.which)&&(t.stopPropagation(),t.preventDefault()),-1<[13].indexOf(t.which)&&(t.stopPropagation(),t.preventDefault(),function(){var t=D.document,e=R.getElementById(p.id).parentElement,i=e.requestFullscreen||e.mozRequestFullScreen||e.webkitRequestFullScreen||e.msRequestFullscreen,n=t.exitFullscreen||t.mozCancelFullScreen||t.webkitExitFullscreen||t.msExitFullscreen;t.fullscreenElement||t.mozFullScreenElement||t.webkitFullscreenElement||t.msFullscreenElement?n.call(t):i.call(e)}())}),p.enableKeyboard&&M(R).on("keydown.ilb7",function(t){if(!g.length)return!0;-1<[27].indexOf(t.which)&&p.quitOnEscKey&&(t.stopPropagation(),t.preventDefault(),L()),-1<[37].indexOf(t.which)&&(t.stopPropagation(),t.preventDefault(),m()),-1<[39].indexOf(t.which)&&(t.stopPropagation(),t.preventDefault(),v())})}),M(R).off("click",p.selector),P(M(this)),c(),F(s),this.addToImageLightbox=function(t){P(t),F(t)},this.openHistory=function(){c()},this.loadPreviousImage=function(){m()},this.loadNextImage=function(){v()},this.quitImageLightbox=function(){return L(),this},this.startImageLightbox=function(t){t?t.trigger("click.ilb7"):M(this).trigger("click.ilb7")},this}}("object"==typeof module&&"object"==typeof module.exports?require("jquery"):jQuery,window,document);
!function(M,D,R){"use strict";var z=M("<div/>").attr("class","imagelightbox-loading").append(M("<div/>")),t=M("<button/>",{type:"button",class:"imagelightbox-arrow imagelightbox-arrow-left"}),e=M("<button/>",{type:"button",class:"imagelightbox-arrow imagelightbox-arrow-right"}),X=t.add(e),j=M("<div/>",{class:"imagelightbox-caption",html:"&nbsp;"}),N=M("<button/>",{type:"button",class:"imagelightbox-close"}),V=M("<div/>",{class:"imagelightbox-overlay"}),U=M("<a/>",{href:"#",class:"imagelightbox-navitem"}),K=M("<div/>",{class:"imagelightbox-nav"}),Y=M("<div/>",{class:"imagelightbox-wrapper"}),_=M("body"),o=function(){var t=R.body||R.documentElement;return""===(t=t.style).transition?"":""===t.WebkitTransition?"-webkit-":""===t.MozTransition?"-moz-":""===t.OTransition&&"-o-"},H=!1!==o(),W=function(t,e,i){var n={},a=o();n[a+"transform"]="translateX("+e+") translateY(-50%)",n[a+"transition"]=a+"transform "+i+"s ease-in",t.css(n)},$="ontouchstart"in D,B=D.navigator.pointerEnabled||D.navigator.msPointerEnabled,Q=function(t){if($)return!0;if(!B||void 0===t||void 0===t.pointerType)return!1;if(void 0!==t.MSPOINTER_TYPE_MOUSE){if(t.MSPOINTER_TYPE_MOUSE!==t.pointerType)return!0}else if("mouse"!==t.pointerType)return!0;return!1},A=!!(R.fullscreenEnabled||R.webkitFullscreenEnabled||R.mozFullScreenEnabled||R.msFullscreenEnabled),G=!(!D.history||!history.pushState);M.fn.imageLightbox=function(t){var i="",s=M([]),u=M(),d=M([]),r=-1,g=M(),f=0,h=!1,n=0,p=M.extend({selector:"a[data-imagelightbox]",id:"imagelightbox",allowedTypes:"png|jpg|jpeg|gif",animationSpeed:250,activity:!1,arrows:!1,button:!1,caption:!1,enableKeyboard:!0,history:!1,fullscreen:!1,gutter:10,offsetY:0,navigation:!1,overlay:!1,preloadNext:!0,quitOnEnd:!1,quitOnImgClick:!1,quitOnDocClick:!0,quitOnEscKey:!0},t),b=function(){p.activity&&y(),p.arrows&&X.css("display","block")},a=function(t,e,i){var n=e+"="+i,a="?"+n;if(t){var o=new RegExp("([?&])"+e+"=[^&]*");a=null!==t.match(o)?t.replace(o,"$1"+n):t+"&"+n}return a},o=function(){if(G&&p.history){var t=s[r].dataset.ilb2Id;t||(t=r);var e={imageLightboxIndex:t},i=s[r].dataset.imagelightbox;i&&(e.imageLightboxSet=i);var n=a(R.location.search,"imageLightboxIndex",t);i&&(n=a(n,"imageLightboxSet",i)),D.history.pushState(e,"",R.location.pathname+n)}},e=function(t,e){var i=t;if(i){var n=new RegExp("\\?"+e+"=[^&]*"),a=new RegExp("&"+e+"=[^&]*");i=(i=i.replace(n,"?")).replace(a,"")}return i},l=function(t){var e=new RegExp("[?&]"+t+"(=([^&#]*)|&|#|$)").exec(R.location.search);if(e&&e[2])return decodeURIComponent(e[2].replace(/\+/g," "))},c=function(){if(G&&p.history){var t=l("imageLightboxIndex");if(t){var e=s.filter('[data-ilb2-id="'+t+'"]');0<e.length?r=s.index(e):e=M(s[r=t]);var i=l("imageLightboxSet");!e[0]||i&&i!==e[0].dataset.imagelightbox||T(e,!0)}}},m=function(){if(--r<0){if(!0===p.quitOnEnd)return void L();r=s.length-1}u=s.eq(r),o(),Y.trigger("previous.ilb2",u),O(1)},v=function(){if(++r>=s.length){if(!0===p.quitOnEnd)return void L();r=0}o(),u=s.eq(r),Y.trigger("next.ilb2",u),O(-1)},x=function(){Y.append(z)},y=function(){M(".imagelightbox-loading").remove()},w=function(){Y.append(V)},E=function(){N.appendTo(Y).on("click.ilb7",function(){return L(),!1})},S=function(){j.css("opacity","0"),j.html("&nbsp;"),M(u).data("ilb2-caption")?(j.css("opacity","1"),j.html(M(u).data("ilb2-caption"))):M(u).find("img").attr("alt")&&(j.css("opacity","1"),j.html(M(u).find("img").attr("alt")))},k=function(){if(s.length){for(var t=0;t<s.length;t++)K.append(U.clone());var e=K.children("a");e.eq(s.index(u)).addClass("active"),Y.on("previous.ilb2 next.ilb2",function(){e.removeClass("active").eq(s.index(u)).addClass("active")}),Y.append(K),K.on("click.ilb7 touchend.ilb7",function(){return!1}).on("click.ilb7 touchend.ilb7","a",function(){var t=M(this);if(s.eq(t.index()).attr("href")!==M(".imagelightbox").attr("src")){var e=s.eq(t.index());e.length&&(n=s.index(u),u=e,O(t.index()<n?-1:1))}t.addClass("active").siblings().removeClass("active")})}},I=function(){Y.append(X),X.on("click.ilb7 touchend.ilb7",function(t){return t.stopImmediatePropagation(),t.preventDefault(),M(this).hasClass("imagelightbox-arrow-left")?m():v(),!1})},q=function(){if(!g.length)return!0;var t=p.caption?j.outerHeight():0,r=M(D).width(),l=M(D).height()-t,c=Math.abs(1-p.gutter/100);function e(t,e){if(r<t||l<e){var i=r/l<t/e?t/r:e/l;t/=i,e/=i}var n=e*c,a=t*c,o=(M(D).width()-a)/2;g.css({width:a+"px",height:n+"px",left:o+"px"})}var i=g.data("ilb2VideoId"),n=!1;if(d.each(function(){i===this.i&&(e(this.w,this.h),n=!0)}),!n)if(void 0===g.get(0).videoWidth){var a=new Image;a.src=g.attr("src"),a.onload=function(){e(a.width,a.height)}}else e(g.get(0).videoWidth,g.get(0).videoHeight)},O=function(c){if(h)return!1;if(g.length){var t={opacity:0};H?W(g,100*c-f+"px",p.animationSpeed/1e3):t.left=parseInt(g.css("left"))+100*c+"px",g.animate(t,p.animationSpeed,function(){C()}),f=0}h=!0,p.activity&&x(),p.caption&&S(),setTimeout(function(){var t,e,i=u.attr("href"),n=0,a=0,o=0,r=u.data("ilb2Video");function l(){var t={opacity:1};if(g.appendTo(Y),q(),g.css("opacity",0),H)W(g,-100*c+"px",0),setTimeout(function(){W(g,"0px",p.animationSpeed/1e3)},50);else{var e=parseInt(g.css("left"));t.left=e+"px",g.css("left",e-100*c+"px")}if(g.animate(t,p.animationSpeed,function(){h=!1,b()}),p.preloadNext){var i=s.eq(s.index(u)+1);i.length||(i=s.eq(0)),M("<img />").attr("src",i.attr("href"))}Y.trigger("loaded.ilb2")}r?d.each(function(){this.i===u.data("ilb2VideoId")&&(t=this.l,e=this.e,this.a&&(!1===t&&e.attr("autoplay",this.a),!0===t&&e.get(0).play()))}):e=M("<img id='"+p.id+"' />").attr("src",i),g=e.on("load.ilb7",l).on("error.ilb7",function(){b()}).on("touchstart.ilb7 pointerdown.ilb7 MSPointerDown.ilb7",function(t){if(!Q(t.originalEvent)||p.quitOnImgClick)return!0;H&&(o=parseInt(g.css("left"))),n=t.originalEvent.pageX||t.originalEvent.touches[0].pageX}).on("touchmove.ilb7 pointermove.ilb7 MSPointerMove.ilb7",function(t){if(!B&&"pointermove"===t.type||!Q(t.originalEvent)||p.quitOnImgClick)return!0;t.preventDefault(),a=t.originalEvent.pageX||t.originalEvent.touches[0].pageX,f=n-a,H?W(g,-f+"px",0):g.css("left",o-f+"px")}).on("touchend.ilb7 touchcancel.ilb7 pointerup.ilb7 pointercancel.ilb7 MSPointerUp.ilb7 MSPointerCancel.ilb7",function(t){if(!Q(t.originalEvent)||p.quitOnImgClick)return!0;50<Math.abs(f)?f<0?m():v():H?W(g,"0px",p.animationSpeed/1e3):g.animate({left:o+"px"},p.animationSpeed/2)}),!0===t&&l(),!1===t&&(g=g.on("loadedmetadata.ilb7",l)),r||(g=g.on(B?"pointerup.ilb7 MSPointerUp.ilb7":"click.ilb7",function(t){if(t.preventDefault(),p.quitOnImgClick)return L(),!1;if(Q(t.originalEvent))return!0;var e=(t.pageX||t.originalEvent.pageX)-t.target.offsetLeft;t.target.width/2>e?m():v()}))},p.animationSpeed+100)},C=function(){if(!g.length)return!1;g.remove(),g=M()},T=function(t,e){if(h)return!1;h=!1,u=t,r=s.index(u),e||o(),function(){p.arrows&&I(this),p.navigation&&k(),p.overlay&&w(),p.button&&E(),p.caption&&Y.append(j)}(),_.append(Y).addClass("imagelightbox-open"),Y.trigger("start.ilb2",t),O(0)},L=function(t){if(r=-1,t||function(){if(G&&p.history){var t=e(R.location.search,"imageLightboxIndex");t=e(t,"imageLightboxSet"),D.history.pushState({},"",R.location.pathname+t)}}(),Y.trigger("quit.ilb2"),_.removeClass("imagelightbox-open"),!g.length)return!1;g.animate({opacity:0},p.animationSpeed,function(){C(),h=!1,Y.remove().find("*").remove()})},P=function(e){e.each(function(){s=e.add(M(this))}),e.on("click.ilb7",{set:i},function(t){t.preventDefault(),i=M(t.currentTarget).data("imagelightbox"),e.filter(function(){return M(this).data("imagelightbox")===i}).filter(function(){return function(t){return"a"===M(t).prop("tagName").toLowerCase()&&(new RegExp(".("+p.allowedTypes+")$","i").test(M(t).attr("href"))||M(t).data("ilb2Video"))}(M(this))}).each(function(){s=s.add(M(this))}),s.length<1?L():T(M(this))})},F=function(t){t.each(function(){var t=M(this).data("ilb2Video");if(t){var e=M(this).data("ilb2Id");e||(e="a"+(65536*(1+Math.random())|0).toString(16)),M(this).data("ilb2VideoId",e);var n={e:M("<video id='"+p.id+"' preload='metadata' data-ilb2-video-id='"+e+"'>"),i:e,l:!1,a:void 0,h:void 0,w:void 0};M.each(t,function(t,e){switch(t){case"autoplay":n.a=e;break;case"height":n.h=e;break;case"sources":break;case"width":n.w=e;break;default:n.e=n.e.attr(t,e)}}),t.sources&&M.each(t.sources,function(t,e){var i=M("<source>");M.each(e,function(t,e){i=i.attr(t,e)}),n.e.append(i)}),n.e.on("loadedmetadata.ilb7",function(){n.l=!0}),d=d.add(n)}})};return M(D).on("resize.ilb7",q),G&&p.history&&M(D).on("popstate",function(t){var e=t.originalEvent.state;if(e){var i=e.imageLightboxIndex;if(void 0!==i){var n=s.filter('[data-ilb2-id="'+i+'"]');if(0<n.length)var a=s.index(n);else n=M(s[a=i]);if(n[0]&&(!e.imageLightboxSet||e.imageLightboxSet===n[0].dataset.imagelightbox))if(r<0)T(n,!0);else{var o=1;r<a&&(o=-1),u=n,r=a,O(o)}}else L(!0)}else L(!0)}),M(R).ready(function(){p.quitOnDocClick&&M(R).on($?"touchend.ilb7":"click.ilb7",function(t){g.length&&!M(t.target).is(g)&&(t.preventDefault(),L())}),p.fullscreen&&A&&M(R).on("keydown.ilb7",function(t){if(!g.length)return!0;-1<[9,32,38,40].indexOf(t.which)&&(t.stopPropagation(),t.preventDefault()),-1<[13].indexOf(t.which)&&(t.stopPropagation(),t.preventDefault(),function(){var t=D.document,e=R.getElementById(p.id).parentElement,i=e.requestFullscreen||e.mozRequestFullScreen||e.webkitRequestFullScreen||e.msRequestFullscreen,n=t.exitFullscreen||t.mozCancelFullScreen||t.webkitExitFullscreen||t.msExitFullscreen;t.fullscreenElement||t.mozFullScreenElement||t.webkitFullscreenElement||t.msFullscreenElement?n.call(t):i.call(e)}())}),p.enableKeyboard&&M(R).on("keydown.ilb7",function(t){if(!g.length)return!0;-1<[27].indexOf(t.which)&&p.quitOnEscKey&&(t.stopPropagation(),t.preventDefault(),L()),-1<[37].indexOf(t.which)&&(t.stopPropagation(),t.preventDefault(),m()),-1<[39].indexOf(t.which)&&(t.stopPropagation(),t.preventDefault(),v())})}),M(R).off(".ilb7 .ilb2",p.selector),P(M(this)),c(),F(s),this.addToImageLightbox=function(t){P(t),F(t)},this.openHistory=function(){c()},this.loadPreviousImage=function(){m()},this.loadNextImage=function(){v()},this.quitImageLightbox=function(){return L(),this},this.startImageLightbox=function(t){t?t.trigger("click.ilb7"):M(this).trigger("click.ilb7")},this}}("object"==typeof module&&"object"==typeof module.exports?require("jquery"):jQuery,window,document);

@@ -415,2 +415,13 @@ (function (factory) {

var videoId = image.data('ilb2VideoId');
var videoHasDimensions = false;
videos.each(function() {
if( videoId === this.i ) {
setSizes(this.w, this.h);
videoHasDimensions = true;
}
});
if (videoHasDimensions) {
return;
}
if(image.get(0).videoWidth !== undefined) {

@@ -664,7 +675,17 @@ setSizes(image.get(0).videoWidth, image.get(0).videoHeight);

$(this).data('ilb2VideoId', id);
var container = {e: $('<video id=\'' + options.id + '\' preload=\'metadata\'>'), i: id, l: false, a: undefined}; // e = element, i = id, l = is metadata loaded, a = autoplay
var container = {e: $('<video id=\'' + options.id + '\' preload=\'metadata\' data-ilb2-video-id=\'' + id + '\'>'), i: id, l: false, a: undefined, h: undefined, w: undefined}; // e = element, i = id, l = is metadata loaded, a = autoplay, h = height, w = width
$.each(videoOptions, function(key, value) {
if(key === 'autoplay') {
switch(key) {
case 'autoplay':
container.a = value;
} else if(key !== 'sources') {
break;
case 'height':
container.h = value;
break;
case 'sources':
break;
case 'width':
container.w = value;
break;
default:
container.e = container.e.attr(key, value);

@@ -762,3 +783,3 @@ }

$(document).off('click', options.selector);
$(document).off('.ilb7 .ilb2', options.selector);

@@ -765,0 +786,0 @@ _addTargets($(this));

@@ -7,3 +7,2 @@ var gulp = require('gulp'),

eslint = require('gulp-eslint'),
lintspaces = require('gulp-lintspaces'),
rename = require('gulp-rename'),

@@ -26,3 +25,2 @@ uglify = require('gulp-uglify');

.pipe(autoprefixer({
browsers: ['last 2 versions', 'ie >= 9', 'Firefox ESR', 'Android >= 2.3'],
cascade: false

@@ -35,8 +33,2 @@ }))

gulp.task('editorconfig', function() {
return gulp.src('src/imagelightbox.js')
.pipe(lintspaces({editorconfig: './.editorconfig'}))
.pipe(lintspaces.reporter());
});
gulp.task('eslint', function() {

@@ -49,3 +41,3 @@ return gulp.src('src/imagelightbox.js')

gulp.task('copy:js', gulp.series('editorconfig', 'eslint', function() {
gulp.task('copy:js', gulp.series('eslint', function() {
return gulp.src('src/imagelightbox.js')

@@ -52,0 +44,0 @@ .pipe(gulp.dest('docs/javascripts/'));

{
"name": "imagelightbox",
"version": "1.0.2",
"version": "1.1.0",
"description": "Image Lightbox, Responsive and Touch‑friendly",

@@ -17,12 +17,11 @@ "homepage": "https://marekdedic.github.io/imagelightbox",

"gulp": "^4.0.2",
"gulp-autoprefixer": "^6.1.0",
"gulp-autoprefixer": "^7.0.0",
"gulp-clean-css": "^4.2.0",
"gulp-connect": "^5.7.0",
"gulp-csslint": "^1.0.1",
"gulp-eslint": "^5.0.0",
"gulp-lintspaces": "^1.0.1",
"gulp-rename": "^1.4.0",
"gulp-eslint": "^6.0.0",
"gulp-rename": "^2.0.0",
"gulp-uglify": "^3.0.2",
"mocha": "^6.1.4",
"puppeteer": "^1.18.0"
"mocha": "^8.0.1",
"puppeteer": "^3.0.0"
},

@@ -40,3 +39,9 @@ "keywords": [

"test:js": "eslint src/**/*.js"
}
},
"browserslist": [
"last 2 versions",
"IE >= 9",
"Firefox ESR",
"Android >= 2.3"
]
}

@@ -114,3 +114,3 @@ imagelightbox

````html
<a data-ilb2-video='{"controls":"controls", "autoplay":"autoplay", "sources":[{"src":"images/video.m4v", "type":"video/mp4"}]}' data-imagelightbox="x">
<a data-ilb2-video='{"controls":"controls", "autoplay":"autoplay", "sources":[{"src":"images/video.m4v", "type":"video/mp4"}], "width": 1920, "height": 1080}' data-imagelightbox="x">
<img src="images/video-thumb.jpg">

@@ -117,0 +117,0 @@ </a>

@@ -415,2 +415,13 @@ (function (factory) {

var videoId = image.data('ilb2VideoId');
var videoHasDimensions = false;
videos.each(function() {
if( videoId === this.i ) {
setSizes(this.w, this.h);
videoHasDimensions = true;
}
});
if (videoHasDimensions) {
return;
}
if(image.get(0).videoWidth !== undefined) {

@@ -664,7 +675,17 @@ setSizes(image.get(0).videoWidth, image.get(0).videoHeight);

$(this).data('ilb2VideoId', id);
var container = {e: $('<video id=\'' + options.id + '\' preload=\'metadata\'>'), i: id, l: false, a: undefined}; // e = element, i = id, l = is metadata loaded, a = autoplay
var container = {e: $('<video id=\'' + options.id + '\' preload=\'metadata\' data-ilb2-video-id=\'' + id + '\'>'), i: id, l: false, a: undefined, h: undefined, w: undefined}; // e = element, i = id, l = is metadata loaded, a = autoplay, h = height, w = width
$.each(videoOptions, function(key, value) {
if(key === 'autoplay') {
switch(key) {
case 'autoplay':
container.a = value;
} else if(key !== 'sources') {
break;
case 'height':
container.h = value;
break;
case 'sources':
break;
case 'width':
container.w = value;
break;
default:
container.e = container.e.attr(key, value);

@@ -762,3 +783,3 @@ }

$(document).off('click', options.selector);
$(document).off('.ilb7 .ilb2', options.selector);

@@ -765,0 +786,0 @@ _addTargets($(this));

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