Files

1 line
56 KiB
JavaScript
Raw Permalink Normal View History

!function(n,i){"object"==typeof exports&&"undefined"!=typeof module?module.exports=i():"function"==typeof define&&define.amd?define(i):(n=n||self).GLightbox=i()}(this,function(){"use strict";function K(e){return(K="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(t){return typeof t}:function(t){return t&&"function"==typeof Symbol&&t.constructor===Symbol&&t!==Symbol.prototype?"symbol":typeof t})(e)}function J(n,e){if(!(n instanceof e))throw TypeError("Cannot call a class as a function")}function Q(l,e){for(var t,s=0;s<e.length;s++)t=e[s],t.enumerable=t.enumerable||!1,t.configurable=!0,"value"in t&&(t.writable=!0),Object.defineProperty(l,t.key,t)}function t(i,e,t){return e&&Q(i.prototype,e),t&&Q(i,t),i}function ee(){var l={},e=!0,d=0,a=arguments.length;for("[object Boolean]"===Object.prototype.toString.call(arguments[0])&&(e=arguments[0],d++);d<a;d++){var n=arguments[d];!function(t){for(var n in t)Object.prototype.hasOwnProperty.call(t,n)&&(e&&"[object Object]"===Object.prototype.toString.call(t[n])?l[n]=ee(!0,l[n],t[n]):l[n]=t[n])}(n)}return l}function te(l,d){if((f(l)||l===window||l===document)&&(l=[l]),o(l)||r(l)||(l=[l]),0!=S(l))if(o(l)&&!r(l))for(var t=l.length,i=0;i<t&&!1!==d.call(l[i],l[i],i,l);i++);else if(r(l))for(var a in l)if(T(l,a)&&!1===d.call(l[a],l[a],a,l))break}function n(s){var d=1<arguments.length&&void 0!==arguments[1]?arguments[1]:null,t=2<arguments.length&&void 0!==arguments[2]?arguments[2]:null,e=s[X]=s[X]||[],i={all:e,evt:null,found:null};return d&&t&&0<S(e)&&te(e,function(l,e){if(l.eventName==d&&l.fn.toString()==t.toString())return i.found=!0,i.evt=e,!1}),i}function ne(o){function r(t){x(i)&&i.call(c,t,this),a&&r.destroy()}var e=1<arguments.length&&void 0!==arguments[1]?arguments[1]:{},t=e.onElement,i=e.withCallback,p=e.avoidDuplicate,s=void 0===p||p,l=e.once,a=void 0!==l&&l,h=e.useCapture,d=void 0!==h&&h,c=2<arguments.length?arguments[2]:void 0,u=t||[];return m(u)&&(u=document.querySelectorAll(u)),r.destroy=function(){te(u,function(e){var t=n(e,o,r);t.found&&t.all.splice(t.evt,1),e.removeEventListener&&e.removeEventListener(o,r,d)})},te(u,function(e){var t=n(e,o,r);(e.addEventListener&&s&&!t.found||!s)&&(e.addEventListener(o,r,d),t.all.push({eventName:o,fn:r}))}),r}function ie(n,e){te(e.split(" "),function(e){return n.classList.add(e)})}function h(n,e){te(e.split(" "),function(e){return n.classList.remove(e)})}function le(n,e){return n.classList.contains(e)}function d(n,i){for(;n!==document.body;){if(!(n=n.parentElement))return!1;if("function"==typeof n.matches?n.matches(i):n.msMatchesSelector(i))return n}}function u(l){var e=1<arguments.length&&void 0!==arguments[1]?arguments[1]:"",d=2<arguments.length&&void 0!==arguments[2]&&arguments[2];if(!l||""===e)return!1;if("none"===e)return x(d)&&d(),!1;var t=function(){var e,l=document.createElement("fakeelement"),i={animation:"animationend",OAnimation:"oAnimationEnd",MozAnimation:"animationend",WebkitAnimation:"webkitAnimationEnd"};for(e in i)if(void 0!==l.style[e])return i[e]}(),i=e.split(" ");te(i,function(e){ie(l,"g"+e)}),ne(t,{onElement:l,avoidDuplicate:!1,once:!0,withCallback:function(e,t){te(i,function(n){h(t,"g"+n)}),x(d)&&d()}})}function a(n){var e=1<arguments.length&&void 0!==arguments[1]?arguments[1]:"";return""===e?(n.style.webkitTransform="",n.style.MozTransform="",n.style.msTransform="",n.style.OTransform="",n.style.transform="",!1):void(n.style.webkitTransform=e,n.style.MozTransform=e,n.style.msTransform=e,n.style.OTransform=e,n.style.transform=e)}function c(t){t.style.display="block"}function g(t){t.style.display="none"}function p(n){var e=document.createDocumentFragment(),t=document.createElement("div");for(t.innerHTML=n;t.firstChild;)e.appendChild(t.firstChild);return e}function se(){return{width:window.innerWidth||document.documentElement.clientWidth||document.body.clientWidth,height:window.innerHeight||document.documentElement.clientHeight||document.body.clientHeight}}function y(d,e,t,a){if(d())return void e();t||(t=100);var n,o=setInterval(function(){d()&&(clearInterval(o),n&&clearTimeout(n),e())},t);a&&(n=setTimeo