aboutsummaryrefslogtreecommitdiff
path: root/dist/LightBox.Plugins.min.js
blob: d80cb5b88809830d74a1ee57fd819289d296d283 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
/**
 * Image LightBox Plugins - A touch-friendly image lightbox, without bells and whistles.
 * @version v0.2.0
 * @link https://victorhaggqvist.github.io/touch-imagelightbox
 * @license MIT
 * @author Victor Häggqvist <[email protected]> (https://victorhaggqvist.com/)
 */
var LightBox=LightBox||{};LightBox.ActivityIndicator=function(t){function e(i){if(n[i])return n[i].exports;var r=n[i]={exports:{},id:i,loaded:!1};return t[i].call(r.exports,r,r.exports,e),r.loaded=!0,r.exports}var n={};return e.m=t,e.c=n,e.p="",e(0)}([function(t,e){"use strict";function n(t,e){if(!(t instanceof e))throw new TypeError("Cannot call a class as a function")}var i=function(){function t(t,e){for(var n=0;n<e.length;n++){var i=e[n];i.enumerable=i.enumerable||!1,i.configurable=!0,"value"in i&&(i.writable=!0),Object.defineProperty(t,i.key,i)}}return function(e,n,i){return n&&t(e.prototype,n),i&&t(e,i),e}}();Object.defineProperty(e,"__esModule",{value:!0});var r=function(){function t(){n(this,t),this.element=document.createElement("div"),this.element.id="imagelightbox-loading",this.element.appendChild(document.createElement("div"))}return i(t,[{key:"register",value:function(t){t.addOnLoadStartListener(this.activityIndicatorOn.bind(this)),t.addOnLoadEndListener(this.activityIndicatorOff.bind(this)),t.addOnEndListener(this.activityIndicatorOff.bind(this))}},{key:"activityIndicatorOn",value:function(){document.body.appendChild(this.element)}},{key:"activityIndicatorOff",value:function(){try{document.body.removeChild(this.element)}catch(t){}}}]),t}();e["default"]=r,t.exports=e["default"]}]);
var LightBox=LightBox||{};LightBox.Captions=function(t){function e(i){if(n[i])return n[i].exports;var o=n[i]={exports:{},id:i,loaded:!1};return t[i].call(o.exports,o,o.exports,e),o.loaded=!0,o.exports}var n={};return e.m=t,e.c=n,e.p="",e(0)}([function(t,e){"use strict";function n(t,e){if(!(t instanceof e))throw new TypeError("Cannot call a class as a function")}var i=function(){function t(t,e){for(var n=0;n<e.length;n++){var i=e[n];i.enumerable=i.enumerable||!1,i.configurable=!0,"value"in i&&(i.writable=!0),Object.defineProperty(t,i.key,i)}}return function(e,n,i){return n&&t(e.prototype,n),i&&t(e,i),e}}();Object.defineProperty(e,"__esModule",{value:!0});var o=function(){function t(){n(this,t),this.element=document.createElement("div"),this.element.id="imagelightbox-caption"}return i(t,[{key:"register",value:function(t){this.lightbox=t,t.addOnLoadStartListener(this.hideCaption.bind(this)),t.addOnLoadEndListener(this.showCaption.bind(this)),t.addOnEndListener(this.hideCaption.bind(this))}},{key:"showCaption",value:function(){var t=this.lightbox.target.querySelector("img");if(null!==t){var e=t.getAttribute("alt");null!==e&&e.length>0&&(this.element.innerHTML=t.alt,document.body.appendChild(this.element))}}},{key:"hideCaption",value:function(){try{document.body.removeChild(this.element)}catch(t){}}}]),t}();e["default"]=o,t.exports=e["default"]}]);
var LightBox=LightBox||{};LightBox.CloseButton=function(t){function e(i){if(n[i])return n[i].exports;var o=n[i]={exports:{},id:i,loaded:!1};return t[i].call(o.exports,o,o.exports,e),o.loaded=!0,o.exports}var n={};return e.m=t,e.c=n,e.p="",e(0)}([function(t,e){"use strict";function n(t,e){if(!(t instanceof e))throw new TypeError("Cannot call a class as a function")}var i=function(){function t(t,e){for(var n=0;n<e.length;n++){var i=e[n];i.enumerable=i.enumerable||!1,i.configurable=!0,"value"in i&&(i.writable=!0),Object.defineProperty(t,i.key,i)}}return function(e,n,i){return n&&t(e.prototype,n),i&&t(e,i),e}}();Object.defineProperty(e,"__esModule",{value:!0});var o=function(){function t(){var e=arguments.length<=0||void 0===arguments[0]?!1:arguments[0];n(this,t),this.closeOnDocumentClick=e,this.element=document.createElement("a"),this.element.id="imagelightbox-close",this.element.innerHTML="Close"}return i(t,[{key:"register",value:function(t){this.lightbox=t,t.addOnStartListener(this.showButton.bind(this)),t.addOnEndListener(this.hideButton.bind(this))}},{key:"showButton",value:function(){var t=this;this.lightbox.options.quitOnDocClick=this.closeOnDocumentClick,["click","touchend"].forEach(function(e){t.element.addEventListener(e,t.exitLightbox.bind(t))}),document.body.appendChild(this.element)}},{key:"hideButton",value:function(){document.body.removeChild(this.element)}},{key:"exitLightbox",value:function(){this.lightbox.quitLightbox()}}]),t}();e["default"]=o,t.exports=e["default"]}]);
var LightBox=LightBox||{};LightBox.Navigation=function(t){function i(n){if(e[n])return e[n].exports;var a=e[n]={exports:{},id:n,loaded:!1};return t[n].call(a.exports,a,a.exports,i),a.loaded=!0,a.exports}var e={};return i.m=t,i.c=e,i.p="",i(0)}([function(t,i){"use strict";function e(t,i){if(!(t instanceof i))throw new TypeError("Cannot call a class as a function")}var n=function(){function t(t,i){for(var e=0;e<i.length;e++){var n=i[e];n.enumerable=n.enumerable||!1,n.configurable=!0,"value"in n&&(n.writable=!0),Object.defineProperty(t,n.key,n)}}return function(i,e,n){return e&&t(i.prototype,e),n&&t(i,n),i}}();Object.defineProperty(i,"__esModule",{value:!0});var a=function(){function t(){e(this,t)}return n(t,[{key:"register",value:function(t){this.lightbox=t,t.addOnStartListener(this.showNavigation.bind(this)),t.addOnEndListener(this.hideNavigation.bind(this)),t.addOnLoadEndListener(this.updateNavigation.bind(this))}},{key:"showNavigation",value:function(){var t=this;this.sink=document.createElement("div"),this.sink.id="imagelightbox-nav-sink",this.nav=document.createElement("div"),this.nav.id="imagelightbox-nav",this.sink.appendChild(this.nav),Array.prototype.forEach.call(this.lightbox.targets,function(i){t.nav.appendChild(document.createElement("a"))}),document.body.appendChild(this.sink);var i=this.nav.querySelectorAll("a");Array.prototype.forEach.call(i,function(i,e){["click","touchend"].forEach(function(n){i.addEventListener(n,t.navClick.bind(t,e))})});var e=this.nav.getBoundingClientRect(),n=e.width/2;this.nav.style.marginLeft="-"+n+"px"}},{key:"updateNavigation",value:function(){Array.prototype.forEach.call(this.nav.childNodes,function(t){t.classList.remove("active")});var t=Array.prototype.indexOf.call(this.lightbox.targets,this.lightbox.target);this.nav.childNodes[t].classList.add("active")}},{key:"hideNavigation",value:function(){try{document.body.removeChild(this.sink)}catch(t){}}},{key:"navClick",value:function(t,i){i.stopPropagation(),i.cancelBubble=!0,this.lightbox.switchToIndex(t)}}]),t}();i["default"]=a,t.exports=i["default"]}]);
var LightBox=LightBox||{};LightBox.Overlay=function(e){function t(r){if(n[r])return n[r].exports;var o=n[r]={exports:{},id:r,loaded:!1};return e[r].call(o.exports,o,o.exports,t),o.loaded=!0,o.exports}var n={};return t.m=e,t.c=n,t.p="",t(0)}([function(e,t){"use strict";function n(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}var r=function(){function e(e,t){for(var n=0;n<t.length;n++){var r=t[n];r.enumerable=r.enumerable||!1,r.configurable=!0,"value"in r&&(r.writable=!0),Object.defineProperty(e,r.key,r)}}return function(t,n,r){return n&&e(t.prototype,n),r&&e(t,r),t}}();Object.defineProperty(t,"__esModule",{value:!0});var o=function(){function e(){n(this,e),this.element=document.createElement("div"),this.element.id="imagelightbox-overlay"}return r(e,[{key:"register",value:function(e){e.addOnStartListener(this.overlayOn.bind(this)),e.addOnEndListener(this.overlayOff.bind(this))}},{key:"overlayOn",value:function(){document.body.appendChild(this.element)}},{key:"overlayOff",value:function(){document.body.removeChild(this.element)}}]),e}();t["default"]=o,e.exports=t["default"]}]);