17 lines
7.6 KiB
JavaScript
Executable File
17 lines
7.6 KiB
JavaScript
Executable File
var lightgallery=function(){function N(){if(l.showOverlay){var a=O();s(o,{width:a[0],height:a[1]});o.style.display!=w&&(s(o,{display:w}),x(o,{opacity:l.overlayOpacity},300))}}function W(){x(o,{opacity:0},300,function(){o.style.display=y;C=0})}function G(a,d){var b,c,i,m;i=2*l.minPadding;var e=t.width,f=t.height,g=O(),h=g[2],g=g[3];b=h-i;var k=g-i-u;if(0==a||d&&!a)if(e>b||f>k){i=b;var o=b*f/e;o>k&&(o=k,i=k*e/f);i=j.width=i;m=(j.height=o)+u}else i=j.width=e,m=(j.height=f)+u;else if(1==a)i=j.width=e,
|
|
m=(j.height=f)+u;else if(1>a||1<a)i=j.width*=a,m=(j.height*=a)+u;else{i=m=300;var q=!0}if(b=i>b||m>k+u)c=n.fitScreen,fsClass="LG_fitScreen";else if(j.width!=e||j.height!=f)c=n.fullSize,fsClass="LG_zoomNormal";v.$disabled=!1;j.getAttribute("width")==e?b?(v.id=fsClass,v.setAttribute("title",c)):(v.id="LG_zoom_disabled",v.$disabled=!0):(v.id="LG_zoomNormal",v.setAttribute("title",n.fullSize));i=Math.max(i,P);c=X();var p=(g>m?(g-m)/2:l.minPadding)+c[1],h=(h>i?(h-i)/2:l.minPadding)+c[0];c=i/3;e=m-u-10;
|
|
animCallback=function(){N();Y()};s(D,{width:c,height:e});s(E,{width:c,height:e});l.animate&&!q?l.resizeSync?x(r,{width:i,left:h,height:m,top:p},l.duration,animCallback):x(r,{width:i,left:h},l.duration/2,function(){x(r,{height:m,top:p},l.duration/2,animCallback)}):(s(r,{top:p,left:h,width:i,height:m}),animCallback())}function Y(){innerCont.style.display=w;s(j,{opacity:0});x(j,{opacity:1},l.fadeImage?400:0,function(){H=0})}function Z(){l.enableZoom||(Q=R="");var a=g(k,{id:"LG_container"},F,g(k,{id:"LG_innerCont"},
|
|
g(k,{id:"LG_panel"},Q,R,v,I,g(k,{id:"LG_closeBtn",title:n.close}),g(k,{style:"clear:both"})),j,J,E,D)),d=function(a){a.cancelBubble=!0;a.stopPropagation&&a.stopPropagation();var c=a.target||a.srcElement;if("click"==a.type)a={LG_closeBtn:e.close,LG_zoomNormal:e.zoomNormal,LG_fitScreen:e.zoomNormal,LG_zoomIn:e.zoomIn,LG_zoomOut:e.zoomOut,LG_nextLink:e.next,LG_prevLink:e.prev},c.id in a&&a[c.id].call(e);else if("LG_nextLink"==c.id||"LG_prevLink"==c.id)x(c,{opacity:"mouseout"==a.type?0:1})};A(a,"click",
|
|
d);A(a,"mouseover",d);A(a,"mouseout",d);return a}function $(a){if(C){var a=a||f.event,a=a.keyCode?a.keyCode:a.which?a.which:a.charCode,d={110:e.next,98:e.prev,102:e.zoomNormal,43:e.zoomIn,45:e.zoomOut,27:e.close};d[a]&&d[a]()}}function S(a,d){for(var b in d)a[b]=d[b]}function s(a,d){for(var b in d)setElemStyle(a,b,d[b])}function O(){var a,d,b,c;d=h.documentElement;c=h.body;b="CSS1Compat"===document.compatMode?d:c;f.innerHeight&&f.scrollMaxY?(a=c.scrollWidth,d=f.innerHeight+f.scrollMaxY):c.scrollHeight>
|
|
c.offsetHeight?(a=c.scrollWidth,d=c.scrollHeight):d&&d.scrollHeight>d.offsetHeight?(a=d.scrollWidth,d=d.scrollHeight):(a=c.offsetWidth,d=c.offsetHeight);c=b.clientHeight;b=b.clientWidth;return[a<b?b:a,d<c?c:d,b,c]}function X(){var a=0,d=0,b=h.body,c=h.documentElement;if("number"==typeof f.pageYOffset)d=f.pageYOffset,a=f.pageXOffset;else if(b&&(b.scrollLeft||b.scrollTop))d=b.scrollTop,a=b.scrollLeft;else if(c&&(c.scrollLeft||c.scrollTop))d=c.scrollTop,a=c.scrollLeft;return[a,d]}function g(a,d){var b=
|
|
h.createElement(a),c=2,e,m,f=arguments.length;if(d)for(e in d)m=d[e],typeof m==K&&("class"==e?b.className=m:b.setAttribute(e,m));for(;c<f;c++)typeof arguments[c]==K?b.innerHTML+=arguments[c]:b.appendChild(arguments[c]);return b}function B(){if(!L){if(!h.body)return setTimeout(B,13);L=!0;e.init()}}function aa(){if(!M){M=!0;if("complete"===h.readyState)return B();if(h.addEventListener)h.addEventListener("DOMContentLoaded",function i(){h.removeEventListener("DOMContentLoaded",i,!1);B()},!1);else if(h.attachEvent){h.attachEvent("onreadystatechange",
|
|
function m(){"complete"===document.readyState&&(h.detachEvent("onreadystatechange",m),B())});var a=!1;try{a=null==f.frameElement}catch(d){}if(h.documentElement.doScroll&&a){var b=function(){if(!L){try{h.documentElement.doScroll("left")}catch(a){setTimeout(b,1);return}B()}};b()}}}}var u=!1,P,M,L,H,w="block",y="none",k="div",K="string",f=window,h=document,l={showOverlay:!0,overlayColor:"#000",overlayOpacity:0.85,zoomStep:0.2,animate:!0,duration:800,resizeSync:!1,enableZoom:!0,fadeImage:!0,alias:"lightgallery",
|
|
fullSize:!1,minPadding:15},n={next:"Next",prev:"Previous",zoomIn:"Zoom In",zoomOut:"Zoom Out",fullSize:"Full Size",fitScreen:"Fit screen",close:"Close",image:"Image",of:"of"},T,r,J=g(k,{id:"LG_titleBar"}),j=g("img",{id:"LG_pic"}),E=g(k,{id:"LG_prevLink",title:n.prev}),D=g(k,{id:"LG_nextLink",title:n.next}),v=g(k,{id:"LG_zoomNormal",title:n.fullSize}),Q=g(k,{id:"LG_zoomIn",title:n.zoomIn}),R=g(k,{id:"LG_zoomOut",title:n.zoomOut}),I=g(k,{id:"LG_imgIndex"},n.image+" 20 "+n.of+" 20 "),t=g("img"),z,C,
|
|
q,F=g(k,{id:"LG_loading"}),o=g(k,{id:"LG_overlay"}),p,A=function(){if(f.addEventListener)return function(a,d,b){a.addEventListener(d,b,!1)};if(f.attachEvent)return function(a,d,b){a.attachEvent("on"+d,function(){b.call(a,f.event)})}}(),e={setLangVars:function(a){S(n,a)},init:function(a){a&&S(l,a);if(!M)return aa();/MSIE ([^;]+)/.test(navigator.userAgent)&&(T=parseFloat(RegExp.$1));p=[];for(var a=h.getElementsByTagName("a"),d=RegExp("^"+l.alias+"\\[([a-zA-Z0-9_-]+)\\]|"+l.alias+"$"),b,c=0,i=a.length;c<
|
|
i;c++)if(a[c].rel&&(b=a[c].rel.match(d)))if(A(a[c],"click",e.showImage),b=b[1])a[c].__gallery__=b,p[b]||(p[b]=[]),a[c].__index__=p[b].push(a[c])-1;b=h.body;o.onclick=e.close;b.appendChild(o);b.appendChild(r=Z());innerCont=r.lastChild;A(b.attachEvent?b:f,"keypress",$);t.onload=function(){F.style.display=y;j.src=t.src;G(l.fullSize?1:0,!0);var a=p[z];a&&(a[q+1]&&(g("img").src=a[q+1].href),a[q-1]&&(g("img").src=a[q-1].href))};!1===u&&(u=r.offsetHeight,P=T?200:r.offsetWidth);s(o,{background:l.overlayColor,
|
|
display:y,opacity:l.overlayOpacity})},open:function(){C||(N(),j.style.display=w,G(),s(r,{visibility:"visible",display:w}),C=1)},close:function(){W();s(r,{visibility:"hidden",display:y});t.src=j.src=""},zoomIn:function(){e.Zoom(1+l.zoomStep)},zoomOut:function(){e.Zoom(1-l.zoomStep)},zoomNormal:function(){this.$disabled||e.Zoom(j.width==t.width&&j.height==t.height?0:1)},Zoom:function(a){innerCont.style.display=y;G(a)},showImage:function(a){var d=this.__index__,a=a||f.event;a.returnValue=!1;a.preventDefault&&
|
|
a.preventDefault();this.__gallery__&&-1<d?(z=this.__gallery__,e.show(d)):(z=null,e.showSingle(this))},showSingle:function(a){e.open();innerCont.style.display=y;F.style.display=w;t.src=a.href;J.innerHTML=a.title;I.innerHTML="";E.style.visibility=D.style.visibility="hidden"},show:function(a){if(z&&!(0>a||a>p[z].length-1||l.animate&&H)){e.open();var d=p[z],b=D.style,c=E.style;innerCont.style.display=y;F.style.display=w;H=1;t.src=d[a].href;J.innerHTML=d[a].title;I.innerHTML=n.image+" "+(a+1)+" "+n.of+
|
|
" "+d.length;q=a;q<p[z].length-1?b.visibility="visible":b.visibility="hidden";q?c.visibility="visible":c.visibility="hidden";f.focus()}},next:function(){e.show(q+1)},prev:function(){e.show(q-1)}},U=typeof g("a").style.filter==K,V=function(){return f.requestAnimationFrame||f.webkitRequestAnimationFrame||f.mozRequestAnimationFrame||f.oRequestAnimationFrame||f.msRequestAnimationFrame||function(a){setTimeout(a,16.66)}}();setElemStyle=function(){var a={width:1,height:1,top:1,left:1};return U?function(d,
|
|
b,c){"opacity"==b&&(d.style.filter="alpha(opacity="+100*c+")");d.style[b]=c+(a[b]?"px":"")}:function(d,b,c){d.style[b]=c+(a[b]?"px":"")}}();var x=function(a,d,b,c){var b=l.animate?"number"==typeof b?b:200:0,e=a.currentStyle?a.currentStyle:getComputedStyle(a,null),f,g={},h=+new Date,j=h+b,k=!0,n=0,o,p=function(){if(k){var e=+new Date;V(p);pos=e>j?1:(e-h)/b;for(f in d)setElemStyle(a,f,(g[f]+(d[f]-g[f])*(-Math.cos(pos*Math.PI)/2+0.5)).toFixed(3));e>j&&(k=!1,c&&c())}};for(f in d)"opacity"==f&&U?(o=e.filter.match(/opacity\=(\d+)/))&&
|
|
(n=parseFloat(o[1])/100):n=parseFloat(e[f]),g[f]=n;V(p)};return e}();
|