diff --git a/css/elfinder.full.css b/css/elfinder.full.css index bdcbaf9c52..c52342fe2c 100644 --- a/css/elfinder.full.css +++ b/css/elfinder.full.css @@ -1,6 +1,6 @@ /*! * elFinder - file manager for web - * Version 2.1.12 (2.1-src Nightly: a7de386) (2016-07-11) + * Version 2.1.13 (2016-07-11) * http://elfinder.org * * Copyright 2009-2016, Studio 42 diff --git a/css/elfinder.min.css b/css/elfinder.min.css index 7c907e538f..869046c240 100644 --- a/css/elfinder.min.css +++ b/css/elfinder.min.css @@ -1,6 +1,6 @@ /*! * elFinder - file manager for web - * Version 2.1.12 (2.1-src Nightly: a7de386) (2016-07-11) + * Version 2.1.13 (2016-07-11) * http://elfinder.org * * Copyright 2009-2016, Studio 42 diff --git a/js/elfinder.full.js b/js/elfinder.full.js index 2f0a5ef422..2f30a0f9a6 100644 --- a/js/elfinder.full.js +++ b/js/elfinder.full.js @@ -1,6 +1,6 @@ /*! * elFinder - file manager for web - * Version 2.1.12 (2.1-src Nightly: a7de386) (2016-07-11) + * Version 2.1.13 (2016-07-11) * http://elfinder.org * * Copyright 2009-2016, Studio 42 @@ -5327,7 +5327,7 @@ if (!Object.keys) { * * @type String **/ -elFinder.prototype.version = '2.1.12 (2.1-src Nightly: a7de386)'; +elFinder.prototype.version = '2.1.13'; diff --git a/js/elfinder.min.js b/js/elfinder.min.js index f4225fa9e6..73a695877b 100644 --- a/js/elfinder.min.js +++ b/js/elfinder.min.js @@ -1,6 +1,6 @@ /*! * elFinder - file manager for web - * Version 2.1.12 (2.1-src Nightly: a7de386) (2016-07-11) + * Version 2.1.13 (2016-07-11) * http://elfinder.org * * Copyright 2009-2016, Studio 42 @@ -8,11 +8,11 @@ */ !function(e){window.elFinder=function(t,n){var i,a,r,o=this,t=e(t),s=e("
").append(t.contents()),l=t.attr("style"),d=t.attr("id")||"",c="elfinder-"+(d||Math.random().toString().substr(2,7)),u="mousedown."+c,h="keydown."+c,p="keypress."+c,f=!0,m=!0,g="",v={path:"",url:"",tmbUrl:"",disabled:[],separator:"/",archives:[],extract:[],copyOverwrite:!0,uploadOverwrite:!0,uploadMaxSize:0,jpgQuality:100,tmb:!1},b={},y=[],w={},k={},x=[],C=[],T=[],A=[],I=new o.command(o),z="auto",S=400,U="./sounds/",F=e(document.createElement("audio")).hide().appendTo("body")[0],M="",O=function(t){var n,i,a={},r={};o.api>=2.1?(o.commandMap=t.options.uiCmdMap&&Object.keys(t.options.uiCmdMap).length?t.options.uiCmdMap:{},M!==JSON.stringify(o.commandMap)&&(M=JSON.stringify(o.commandMap),Object.keys(o.commandMap).length&&(i=o.getUI("contextmenu"),i.data("cmdMaps")||i.data("cmdMaps",{}),n=t.cwd?t.cwd.volumeid:null,n&&!i.data("cmdMaps")[n]&&(i.data("cmdMaps")[n]=o.commandMap)))):o.options.sync=0,t.init?b={}:(e.each(Object.keys(b),function(t,n){var i="directory"===b[n].mime,s=b[n].phash;o.res("class","navcollapse");(!i||a[s]||!r[s]&&e("#"+o.navHash2Id(b[n].hash)).is(":hidden")&&e("#"+o.navHash2Id(s)).next(".elfinder-navbar-subtree").children().length>100)&&(i||s===g)&&-1===e.inArray(n,C)?(i&&!a[s]&&(a[s]=!0),delete b[n]):i&&(r[s]=!0)}),e.each(Object.keys(a),function(t,n){var i="elfinder-subtree-loaded "+o.res("class","navexpand");e("#"+o.navHash2Id(n)).removeClass(i).next(".elfinder-navbar-subtree").empty()})),o.sorters=[],g=t.cwd.hash,D(t.files),b[g]||D([t.cwd]),o.lastDir(g),o.autoSync()},D=function(t){var n,i,a={name:!0,perm:!0,date:!0,size:!0,kind:!0},r=0===o.sorters.length,s=t.length;for(i=0;s>i;i++)if(n=t[i],n.name&&n.hash&&n.mime){if(!n.phash){var l="volume_"+n.name,d=o.i18n(l);l!=d&&(n.i18=d),n.volumeid&&(n.disabled&&(o.disabledCmds[n.volumeid]=n.disabled),n.tmbUrl&&(o.tmbUrls[n.volumeid]=n.tmbUrl),o.roots[n.volumeid]=n.hash)}r&&n.phash===g&&(e.each(o.sortRules,function(e){(a[e]||"undefined"!=typeof n[e]||"mode"===e&&"undefined"!=typeof n.perm)&&o.sorters.push(e)}),r=!1),b[n.hash]=n}},P=function(t){var n=t.keyCode,i=!(!t.ctrlKey&&!t.metaKey);f&&(e.each(k,function(e,a){a.type==t.type&&a.keyCode==n&&a.shiftKey==t.shiftKey&&a.ctrlKey==i&&a.altKey==t.altKey&&(t.preventDefault(),t.stopPropagation(),a.callback(t,o),o.debug("shortcut-exec",e+" : "+a.description))}),9!=n||e(t.target).is(":input")||t.preventDefault(),27==n&&o.clipboard().length&&o.clipboard([]))},E=new Date;return this.api=null,this.newAPI=!1,this.oldAPI=!1,this.netDrivers=[],this.OS=-1!==navigator.userAgent.indexOf("Mac")?"mac":-1!==navigator.userAgent.indexOf("Win")?"win":"other",this.UA=function(){var e=!document.uniqueID&&!window.opera&&!window.sidebar&&window.localStorage&&"undefined"==typeof window.orientation;return{ltIE6:"undefined"==typeof window.addEventListener&&"undefined"==typeof document.documentElement.style.maxHeight,ltIE7:"undefined"==typeof window.addEventListener&&"undefined"==typeof document.querySelectorAll,ltIE8:"undefined"==typeof window.addEventListener&&"undefined"==typeof document.getElementsByClassName,IE:document.uniqueID,Firefox:window.sidebar,Opera:window.opera,Webkit:e,Chrome:e&&window.chrome,Safari:e&&!window.chrome,Mobile:"undefined"!=typeof window.orientation,Touch:"undefined"!=typeof window.ontouchstart,iOS:navigator.platform.match(/^iP(?:[ao]d|hone)/)}}(),this.options=e.extend(!0,{},this._options,n||{}),n.ui&&(this.options.ui=n.ui),n.commands&&(this.options.commands=n.commands),n.uiOptions&&n.uiOptions.toolbar&&(this.options.uiOptions.toolbar=n.uiOptions.toolbar),n.uiOptions&&n.uiOptions.cwd&&n.uiOptions.cwd.listView&&n.uiOptions.cwd.listView.columns&&(this.options.uiOptions.cwd.listView.columns=n.uiOptions.cwd.listView.columns),n.uiOptions&&n.uiOptions.cwd&&n.uiOptions.cwd.listView&&n.uiOptions.cwd.listView.columnsCustomName&&(this.options.uiOptions.cwd.listView.columnsCustomName=n.uiOptions.cwd.listView.columnsCustomName),this.options.enableAlways||2!==e("body").children().length||(this.options.enableAlways=!0),function(){var t,i=document.createElement("a");i.href=n.url,n.urlUpload&&n.urlUpload!==n.url&&(t=document.createElement("a"),t.href=n.urlUpload),(window.location.host!==i.host||t&&window.location.host!==t.host)&&(e.isPlainObject(o.options.customHeaders)||(o.options.customHeaders={}),e.isPlainObject(o.options.xhrFields)||(o.options.xhrFields={}),o.options.requestType="post",o.options.customHeaders["X-Requested-With"]="XMLHttpRequest",o.options.xhrFields.withCredentials=!0)}(),e.extend(this.options.contextmenu,n.contextmenu),this.requestType=/^(get|post)$/i.test(this.options.requestType)?this.options.requestType.toLowerCase():"get",this.customData=e.isPlainObject(this.options.customData)?this.options.customData:{},this.customHeaders=e.isPlainObject(this.options.customHeaders)?this.options.customHeaders:{},this.xhrFields=e.isPlainObject(this.options.xhrFields)?this.options.xhrFields:{},this.abortCmdsOnOpen=this.options.abortCmdsOnOpen||["tmb"],this.id=d,this.navPrefix="nav"+(elFinder.prototype.uniqueid?elFinder.prototype.uniqueid:"")+"-",this.cwdPrefix=elFinder.prototype.uniqueid?"cwd"+elFinder.prototype.uniqueid+"-":"",++elFinder.prototype.uniqueid,this.uploadURL=n.urlUpload||n.url,this.namespace=c,this.lang=this.i18[this.options.lang]&&this.i18[this.options.lang].messages?this.options.lang:"en",r="en"==this.lang?this.i18.en:e.extend(!0,{},this.i18.en,this.i18[this.lang]),this.direction=r.direction,this.messages=r.messages,this.dateFormat=this.options.dateFormat||r.dateFormat,this.fancyFormat=this.options.fancyDateFormat||r.fancyDateFormat,this.today=new Date(E.getFullYear(),E.getMonth(),E.getDate()).getTime()/1e3,this.yesterday=this.today-86400,a=this.options.UTCDate?"UTC":"",this.getHours="get"+a+"Hours",this.getMinutes="get"+a+"Minutes",this.getSeconds="get"+a+"Seconds",this.getDate="get"+a+"Date",this.getDay="get"+a+"Day",this.getMonth="get"+a+"Month",this.getFullYear="get"+a+"FullYear",this.cssClass="ui-helper-reset ui-helper-clearfix ui-widget ui-widget-content ui-corner-all elfinder elfinder-"+("rtl"==this.direction?"rtl":"ltr")+(this.UA.Touch?" elfinder-touch"+(this.options.resizable?" touch-punch":""):"")+(this.UA.Mobile?" elfinder-mobile":"")+" "+this.options.cssClass,this.zIndex,this.searchStatus={state:0,query:"",target:"",mime:"",ininc:!1},this.storage=function(){try{return"localStorage"in window&&null!==window.localStorage?o.localStorage:o.cookie}catch(e){return o.cookie}}(),this.viewType=this.storage("view")||this.options.defaultView||"icons",this.sortType=this.storage("sortType")||this.options.sortType||"name",this.sortOrder=this.storage("sortOrder")||this.options.sortOrder||"asc",this.sortStickFolders=this.storage("sortStickFolders"),null===this.sortStickFolders?this.sortStickFolders=!!this.options.sortStickFolders:this.sortStickFolders=!!this.sortStickFolders,this.sortRules=e.extend(!0,{},this._sortRules,this.options.sortRules),e.each(this.sortRules,function(e,t){"function"!=typeof t&&delete o.sortRules[e]}),this.compare=e.proxy(this.compare,this),this.notifyDelay=this.options.notifyDelay>0?parseInt(this.options.notifyDelay):500,this.draggingUiHelper=null,this.draggable={appendTo:"body",addClasses:!0,distance:4,revert:!0,refreshPositions:!1,cursor:"crosshair",cursorAt:{left:50,top:47},scroll:!1,start:function(t,n){var i,a,r,s,l,d=n.helper,c=e.map(d.data("files")||[],function(e){return e||null}),u=!1,h=o.getUI("navbar"),p=o.getUI("cwd").parent(),f={navbarUp:function(){h.scrollTop(Math.max(0,h.scrollTop()-d.data("autoScrVal")))},navbarDown:function(){h.scrollTop(h.scrollTop()+d.data("autoScrVal"))},cwdUp:function(){p.scrollTop(Math.max(0,p.scrollTop()-d.data("autoScrVal")))},cwdDown:function(){p.scrollTop(p.scrollTop()+d.data("autoScrVal"))}};for(o.draggingUiHelper=d,i=c.length;i--;)if(a=c[i],b[a].locked){u=!0,d.data("locked",!0);break}!u&&o.trigger("lockfiles",{files:c}),s=p.offset(),r=o.getUI("workzone"),l=r.offset(),d.data("wzpos",{ltr:"ltr"===o.direction,cwdEdge:"ltr"===o.direction?s.left:s.left+p.width(),wzTop:l.top,wzBottom:l.top+r.height()}),d.data("autoScrTm",setInterval(function(){d.data("autoScr")&&f[d.data("autoScr")]()},50))},drag:function(t,n){var i,a=n.helper,r=a.data("wzpos");(i=r.wzTop>t.pageY)||r.wzBottomt.pageX?a.data("autoScr",(r.ltr?"navbar":"cwd")+(i?"Up":"Down")):a.data("autoScr",(r.ltr?"cwd":"navbar")+(i?"Up":"Down")),a.data("autoScrVal",Math.pow(i?r.wzTop-t.pageY:t.pageY-r.wzBottom,1.3))):a.data("autoScr")&&a.data("refreshPositions",1).data("autoScr",null),a.data("refreshPositions")&&e(this).elfUiWidgetInstance("draggable")&&(a.data("refreshPositions")>0?(e(this).draggable("option",{refreshPositions:!0,elfRefresh:!0}),a.data("refreshPositions",-1)):(e(this).draggable("option",{refreshPositions:!1,elfRefresh:!1}),a.data("refreshPositions",null)))},stop:function(t,n){var i,a=n.helper;e(this).elfUiWidgetInstance("draggable")&&e(this).draggable("option",{refreshPositions:!1}),o.draggingUiHelper=null,o.trigger("focus").trigger("dragstop"),a.data("droped")||(i=e.map(a.data("files")||[],function(e){return e||null}),o.trigger("unlockfiles",{files:i}),o.trigger("selectfiles",{files:i})),o.enable(),a.data("autoScrTm")&&clearInterval(a.data("autoScrTm"))},helper:function(t,n){var i,a,r,s=this.id?e(this):e(this).parents("[id]:first"),l=e('
'),d=function(t){var n,i=t.mime,a=o.tmb(t);return n='
',a&&(n=e(n).addClass(a.className).css("background-image","url('"+a.url+"')").get(0).outerHTML),n};return o.draggingUiHelper&&o.draggingUiHelper.stop(!0,!0),o.trigger("dragstart",{target:s[0],originalEvent:t}),i=s.hasClass(o.res("class","cwdfile"))?o.selected():[o.navId2Hash(s.attr("id"))],l.append(d(b[i[0]])).data("files",i).data("locked",!1).data("droped",!1).data("namespace",c).data("dropover",0),(a=i.length)>1&&l.append(d(b[i[a-1]])+''+a+""),e(document).on(h+" keyup."+c,function(e){var t=e.shiftKey||e.ctrlKey||e.metaKey;r!==t&&(r=t,l.is(":visible")&&l.data("dropover")&&!l.data("droped")&&(l.toggleClass("elfinder-drag-helper-plus",l.data("locked")?!0:r),o.trigger(r?"unlockfiles":"lockfiles",{files:i,helper:l})))}),l}},this.droppable={greedy:!0,tolerance:"pointer",accept:".elfinder-cwd-file-wrapper,.elfinder-navbar-dir,.elfinder-cwd-file,.elfinder-cwd-filename",hoverClass:this.res("class","adroppable"),classes:{"ui-droppable-hover":this.res("class","adroppable")},autoDisable:!0,drop:function(t,n){var i,a,r,s=e(this),l=e.map(n.helper.data("files")||[],function(e){return e||null}),d=[],u=[],h=[],p=n.helper.hasClass("elfinder-drag-helper-plus"),f="class";if(n.helper.data("namespace")!==c||!o.insideWorkzone(t.pageX,t.pageY))return!1;for(a=s.hasClass(o.res(f,"cwdfile"))?o.cwdId2Hash(s.attr("id")):s.hasClass(o.res(f,"navdir"))?o.navId2Hash(s.attr("id")):g,i=l.length;i--;)r=l[i],r!=a&&b[r].phash!=a?d.push(r):(p&&r!==a&&b[a].write?u:h).push(r);return h.length?!1:(n.helper.data("droped",!0),u.length&&(n.helper.hide(),o.exec("duplicate",u)),void(d.length&&(n.helper.hide(),o.clipboard(d,!p),o.exec("paste",a,void 0,a).always(function(){o.trigger("unlockfiles",{files:l})}),o.trigger("drop",{files:l}))))}},this.enabled=function(){return t.is(":visible")&&f},this.visible=function(){return t.is(":visible")},this.root=function(t){t=t||g;for(var n,i=b[t];i&&i.phash;)i=b[i.phash];if(i)return i.hash;if(e.each(o.roots,function(e,n){return 0===t.indexOf(e)?(i=n,!1):void 0}),i)return i;for(;n in b&&b.hasOwnProperty(n);)if(i=b[n],!i.phash&&"directory"==!i.mime&&i.read)return i.hash;return""},this.cwd=function(){return b[g]||{}},this.option=function(e){return v[e]||""},this.file=function(e){return b[e]},this.files=function(){return e.extend(!0,{},b)},this.parents=function(e){for(var t,n=[];t=this.file(e);)n.unshift(t.hash),e=t.phash;return n},this.path2array=function(e,t){for(var n,i=[];e&&(n=b[e])&&n.hash;)i.unshift(t&&n.i18?n.i18:n.name),e=n.phash;return i},this.path=function(e,t){return b[e]&&b[e].path?b[e].path:this.path2array(e,t).join(v.separator)},this.url=function(t){var n=b[t];if(!n||!n.read)return"";if("1"==n.url&&this.request({data:{cmd:"url",target:t},preventFail:!0,options:{async:!1}}).done(function(e){n.url=e.url||""}).fail(function(){n.url=""}),n.url)return n.url;if(v.url&&0===n.hash.indexOf(o.cwd().volumeid))return v.url+e.map(this.path2array(t),function(e){return encodeURIComponent(e)}).slice(1).join("/");var i=e.extend({},this.customData,{cmd:"file",target:n.hash});return this.oldAPI&&(i.cmd="open",i.current=n.phash),this.options.url+(-1===this.options.url.indexOf("?")?"?":"&")+e.param(i,!0)},this.convAbsUrl=function(e){if(e.match(/^http/i))return e;var t,n=window.location.protocol+"//"+window.location.host,i=/[^\/]+\/\.\.\//;for(t="/"===e.substr(0,1)?n+e:n+window.location.pathname+e,t=t.replace("/./","/");i.test(t);)t=t.replace(i,"");return t},this.openUrl=function(t,n){var i=b[t],a="";if(!i||!i.read)return"";if(!n)if(i.url){if(1!=i.url)return i.url}else if(v.url&&0===i.hash.indexOf(o.cwd().volumeid))return v.url+e.map(this.path2array(t),function(e){return encodeURIComponent(e)}).slice(1).join("/");return a=this.options.url,a=a+(-1===a.indexOf("?")?"?":"&")+(this.oldAPI?"cmd=open¤t="+i.phash:"cmd=file")+"&target="+i.hash,n&&(a+="&download=1"),e.each(this.options.customData,function(e,t){a+="&"+encodeURIComponent(e)+"="+encodeURIComponent(t)}),a},this.tmb=function(t){var n=function(t){var n="";return e.each(o.tmbUrls,function(e,i){return 0===t.indexOf(e)?(n=o.tmbUrls[e],!1):void 0}),n},i=o.searchStatus.state&&0!==t.hash.indexOf(o.cwd().volumeid)?n(t.hash):v.tmbUrl,a="elfinder-cwd-bgurl",r="";return e.isPlainObject(t)&&("self"===i&&0===t.mime.indexOf("image/")?(r=o.openUrl(t.hash),a+=" elfinder-cwd-bgself"):(o.oldAPI||i)&&t&&t.tmb&&1!=t.tmb&&(r=i+t.tmb),r)?{url:r,className:a}:!1},this.selected=function(){return y.slice(0)},this.selectedFiles=function(){return e.map(y,function(t){return b[t]?e.extend({},b[t]):null})},this.fileByName=function(e,t){var n;for(n in b)if(b.hasOwnProperty(n)&&b[n].phash==t&&b[n].name==e)return b[n]},this.validResponse=function(e,t){return t.error||this.rules[this.rules[e]?e:"defaults"](t)},this.returnBytes=function(e){var t;return isNaN(e)?(e||(e=""),e=e.replace(/b$/i,""),t=e.charAt(e.length-1).toLowerCase(),e=e.replace(/[tgmk]$/i,""),"t"==t?e=1024*e*1024*1024*1024:"g"==t?e=1024*e*1024*1024:"m"==t?e=1024*e*1024:"k"==t&&(e=1024*e),e=isNaN(e)?0:parseInt(e)):(e=parseInt(e),1>e&&(e=0)),e},this.request=function(t){var n,i,a,r=this,o=this.options,s=e.Deferred(),l=e.extend({},o.customData,{mimes:o.onlyMimes},t.data||t),d=l.cmd,c="open"===d,u=!(t.preventDefault||t.preventFail),h=!(t.preventDefault||t.preventDone),p=e.extend({},t.notify),f=!!t.cancel,m=!!t.raw,b=t.syncOnFail,y=!!t.lazy,w=e.extend({url:o.url,async:!0,type:this.requestType,dataType:"json",cache:!1,data:l,headers:this.customHeaders,xhrFields:this.xhrFields},t.options||{}),k=function(t){t.warning&&r.error(t.warning),c&&O(e.extend(!0,{},t)),t.removed&&t.removed.length&&r.remove(t),t.added&&t.added.length&&r.add(t),t.changed&&t.changed.length&&r.change(t),r.trigger(d,t),t.sync&&r.sync()},x=function(e,t){var n;switch(t){case"abort":n=e.quiet?"":["errConnect","errAbort"];break;case"timeout":n=["errConnect","errTimeout"];break;case"parsererror":n=["errResponse","errDataNotJSON"];break;default:if(403==e.status)n=["errConnect","errAccess"];else if(404==e.status)n=["errConnect","errNotFound"];else{if(414==e.status&&"get"===w.type)return w.type="post",void(s.xhr=e=r.transport.send(w).fail(n).done(C));n=["errConnect","HTTP error "+e.status]}}s.reject(n,e,t)},C=function(t){if(r.currentReqCmd=d,m)return s.resolve(t);if(!t)return s.reject(["errResponse","errDataEmpty"],i);if(!e.isPlainObject(t))return s.reject(["errResponse","errDataNotJSON"],i);if(t.error)return s.reject(t.error,i);if(!r.validResponse(d,t))return s.reject("errResponse",i);var n=function(){t=r.normalize(t),r.api||(r.api=t.api||1,"2.0"==r.api&&"undefined"!=typeof t.options.uploadMaxSize&&(r.api="2.1"),r.newAPI=r.api>=2,r.oldAPI=!r.newAPI),t.options&&(v=e.extend({},v,t.options)),t.netDrivers&&(r.netDrivers=t.netDrivers),c&&l.init&&(r.uplMaxSize=r.returnBytes(t.uplMaxSize),r.uplMaxFile=t.uplMaxFile?parseInt(t.uplMaxFile):20),s.resolve(t),t.debug&&r.debug("backend-debug",t.debug)};y?r.lazy(n):n()},I=function(e){if("autosync"==e.type){if("stop"!=e.data.action)return}else if(!("unload"==e.type||"destroy"==e.type||"openxhrabort"==e.type||e.data.added&&e.data.added.length))return;"pending"==i.state()&&(i.quiet=!0,i.abort(),"unload"!=e.type&&"destroy"!=e.type&&r.autoSync())};if(h&&s.done(k),s.fail(function(e){e&&(u?r.error(e):r.debug("error",r.i18n(e)))}),!d)return s.reject("errCmdReq");if(b&&s.fail(function(e){e&&r.sync()}),p.type&&p.cnt&&(f&&(p.cancel=s),n=setTimeout(function(){r.notify(p),s.always(function(){p.cnt=-(parseInt(p.cnt)||0),r.notify(p)})},r.notifyDelay),s.always(function(){clearTimeout(n)})),c){for(;a=T.pop();)"pending"==a.state()&&(a.quiet=!0,a.abort());if(g!==l.target)for(;a=A.pop();)"pending"==a.state()&&(a.quiet=!0,a.abort())}return-1!==e.inArray(d,(r.cmdsToAdd+" autosync").split(" "))&&r.trigger("openxhrabort"),delete w.preventFail,s.xhr=i=this.transport.send(w).fail(x).done(C),c||l.compare&&"info"===d?(T.unshift(i),!c&&r.bind(r.cmdsToAdd+" autosync openxhrabort",I),s.always(function(){var t=e.inArray(i,T);!c&&r.unbind(r.cmdsToAdd+" autosync openxhrabort",I),-1!==t&&T.splice(t,1)})):-1!==e.inArray(d,this.abortCmdsOnOpen)&&(A.unshift(i),s.always(function(){var t=e.inArray(i,A);-1!==t&&A.splice(t,1)})),r.bind("unload destroy",I),s.always(function(){r.unbind("unload destroy",I)}),s},this.diff=function(t,n){var i={},a=[],r=[],o=[],s=function(e){for(var t=o.length;t--;)if(o[t].hash==e)return!0};return e.each(t,function(e,t){i[t.hash]=t}),e.each(b,function(e,t){n&&t.phash!==n||!i[e]&&r.push(e)}),e.each(i,function(t,n){var i=b[t];i?e.each(n,function(e){return n[e]!=i[e]?(o.push(n),!1):void 0}):a.push(n)}),e.each(r,function(t,n){var a=b[n],l=a.phash;l&&"directory"==a.mime&&-1===e.inArray(l,r)&&i[l]&&!s(l)&&o.push(i[l])}),{added:a,removed:r,changed:o}},this.sync=function(t,n){this.autoSync("stop");var i=this,a=function(){var i="",a=0,r=0;return t&&n&&e.each(b,function(e,n){n.phash&&n.phash===t&&(++a,r=Math.max(r,n.ts)),i=a+":"+r}),i},r=a(),o=e.Deferred().done(function(){i.trigger("sync")}),s={data:{cmd:"open",reload:1,target:g,tree:!t&&this.ui.tree?1:0,compare:r},preventDefault:!0},l={data:{cmd:"parents",target:g},preventDefault:!0};return e.when(this.request(s),t?null:this.request(l)).fail(function(e,t){n?o.reject(e&&0!=t.status?e:void 0):(o.reject(e),e&&i.request({data:{cmd:"open",target:i.lastDir("")||i.root(),tree:1,init:1},notify:{type:"open",cnt:1,hideCnt:!0}}))}).done(function(e,n){if(e.cwd.compare&&r===e.cwd.compare)return o.reject();i.api<2.1&&(n.tree=(n.tree||[]).concat([e.cwd]));var a=i.diff(e.files.concat(n&&n.tree?n.tree:[]),t);return a.added.push(e.cwd),a.removed.length&&i.remove(a),a.added.length&&i.add(a),a.changed.length&&i.change(a),o.resolve(a)}).always(function(){i.autoSync()}),o},this.upload=function(e){return this.transport.upload(e,this)},this.bind=function(e,t){var n;if("function"==typeof t)for(e=(""+e).toLowerCase().split(/\s+/),n=0;n-1&&a.splice(r,1);return n=null,this},this.trigger=function(t,n,i){var a,r,o,t=t.toLowerCase(),s="open"===t,l=w[t]||[];if(this.debug("event-"+t,n),s&&!i&&(o=JSON.stringify(n)),l.length)for(t=e.Event(t),i&&(t.data=n),r=l.length,a=0;r>a;a++){l[a].length&&(i||(t.data=s?JSON.parse(o):e.extend(!0,{},n)));try{if(l[a](t,this)===!1||t.isDefaultPrevented()){this.debug("event-stoped",t.type);break}}catch(d){window.console&&window.console.log&&window.console.log(d)}}return this},this.getListeners=function(e){return e?w[e.toLowerCase()]:w},this.shortcut=function(t){var n,i,a,r,o;if(this.options.allowShortcuts&&t.pattern&&e.isFunction(t.callback))for(n=t.pattern.toUpperCase().split(/\s+/),r=0;r0?a:a.charCodeAt(0):e.ui.keyCode[a],a&&!k[i]&&(k[i]={keyCode:a,altKey:-1!=e.inArray("ALT",o),ctrlKey:-1!=e.inArray("CTRL",o),shiftKey:-1!=e.inArray("SHIFT",o),type:t.type||"keydown",callback:t.callback,description:t.description,pattern:i});return this},this.shortcuts=function(){var t=[];return e.each(k,function(e,n){t.push([n.pattern,o.i18n(n.description)])}),t},this.clipboard=function(t,n){var i=function(){return e.map(x,function(e){return e.hash})};return void 0!==t&&(x.length&&this.trigger("unlockfiles",{files:i()}),C=[],x=e.map(t||[],function(e){var t=b[e];return t?(C.push(e),{hash:e,phash:t.phash,name:t.name,mime:t.mime,read:t.read,locked:t.locked,cut:!!n}):null}),this.trigger("changeclipboard",{clipboard:x.slice(0,x.length)}),n&&this.trigger("lockfiles",{files:i()})),x.slice(0,x.length)},this.isCommandEnabled=function(t,n){var i,a=o.cwd().volumeid||"";return a&&n&&0!==n.indexOf(a)?(i=[],e.each(o.disabledCmds,function(e,t){return 0===n.indexOf(e)?(i=t,!1):void 0})):i=v.disabled,this._commands[t]?-1===e.inArray(t,i):!1},this.exec=function(t,n,i,a){return"open"===t&&((this.searchStatus.state||this.searchStatus.ininc)&&this.trigger("searchend",{noupdate:!0}),this.autoSync("stop")),this._commands[t]&&this.isCommandEnabled(t,a)?this._commands[t].exec(n,i):e.Deferred().reject("No such command")},this.dialog=function(n,i){var a=e("
").append(n).appendTo(t).elfinderdialog(i),r=a.closest(".ui-dialog"),s=function(){!a.data("draged")&&a.is(":visible")&&a.elfinderdialog("posInit")};return r.length&&(o.bind("resize",s),r.on("remove",function(){o.unbind("resize",s)})),a},this.getUI=function(e){return this.ui[e]||t},this.command=function(e){return void 0===e?this._commands:this._commands[e]},this.resize=function(e,n){t.css("width",e).height(n).trigger("resize"),this.trigger("resize",{width:t.width(),height:t.height()})},this.restoreSize=function(){this.resize(z,S)},this.show=function(){t.show(),this.enable().trigger("show")},this.hide=function(){this.disable().trigger("hide"),t.hide()},this.lazy=function(n,i){var a=function(e){var n=t.data("lazycnt");e?n?t.data("lazycnt",++n):(t.data("lazycnt",1),t.addClass("elfinder-processing")):n&&n>1?t.data("lazycnt",--n):(t.data("lazycnt",0),t.removeClass("elfinder-processing"))},r=e.Deferred();return i=i||0,a(!0),t.outerHeight(),setTimeout(function(){n.call(r),a(!1)},i),r},this.destroy=function(){t&&t[0].elfinder&&(this.options.syncStart=!1,this.autoSync("stop"),this.trigger("destroy").disable(),x=[],y=[],w={},k={},e(window).off("."+c),e(document).add(t).off("."+c),o.trigger=function(){},F.remove(),t.children().remove(),t.off(),t.append(s.contents()).removeClass(this.cssClass).attr("style",l),t[0].elfinder=null)},this.autoSync=function(e){var t;if(o.options.sync>=1e3){if(i&&(clearTimeout(i),i=null,o.trigger("autosync",{action:"stop"})),e||!o.options.syncStart)return;t=function(e){var n;v.syncMinMs&&(e||i)&&(e&&o.trigger("autosync",{action:"start"}),n=Math.max(o.options.sync,v.syncMinMs),i&&clearTimeout(i),i=setTimeout(function(){var e,a=!0,r=g;v.syncChkAsTs&&(e=b[r].ts)?o.request({data:{cmd:"info",targets:[r],compare:e,reload:1},preventDefault:!0}).done(function(n){var i;a=!0,n.compare&&(i=n.compare,i==e&&(a=!1)),a?o.sync(r).always(function(){i&&(b[r].ts=i),t()}):t()}).fail(function(e,a){e&&0!=a.status?o.error(e):i=setTimeout(function(){t()},n)}):o.sync(g,!0).always(function(){t()})},n))},t(!0)}},this.insideWorkzone=function(e,t,n){var i=this.getUI("workzone").data("rectangle");return n=n||1,!(ei.left+i.width+n||ti.top+i.height+n)},e.fn.selectable&&e.fn.draggable&&e.fn.droppable?t.length?this.options.url?(e.extend(e.ui.keyCode,{F1:112,F2:113,F3:114,F4:115,F5:116,F6:117,F7:118,F8:119,F9:120}),this.dragUpload=!1,this.xhrUpload=("undefined"!=typeof XMLHttpRequestUpload||"undefined"!=typeof XMLHttpRequestEventTarget)&&"undefined"!=typeof File&&"undefined"!=typeof FormData,this.transport={},"object"==typeof this.options.transport&&(this.transport=this.options.transport,"function"==typeof this.transport.init&&this.transport.init(this)),"function"!=typeof this.transport.send&&(this.transport.send=function(t){return e.ajax(t)}),"iframe"==this.transport.upload?this.transport.upload=e.proxy(this.uploads.iframe,this):"function"==typeof this.transport.upload?this.dragUpload=!!this.options.dragUploadAllow:this.xhrUpload&&this.options.dragUploadAllow?(this.transport.upload=e.proxy(this.uploads.xhr,this),this.dragUpload=!0):this.transport.upload=e.proxy(this.uploads.iframe,this),this.error=function(){var e=arguments[0],t=arguments[1]||null;return 1==arguments.length&&"function"==typeof e?o.bind("error",e):o.trigger("error",{error:e,opts:t})},e.each(["enable","disable","load","open","reload","select","add","remove","change","dblclick","getfile","lockfiles","unlockfiles","selectfiles","unselectfiles","dragstart","dragstop","search","searchend","viewchange"],function(t,n){o[n]=function(){var t=arguments[0];return 1==arguments.length&&"function"==typeof t?o.bind(n,t):o.trigger(n,e.isPlainObject(t)?t:{})}}),this.enable(function(){!f&&o.visible()&&o.ui.overlay.is(":hidden")&&(f=!0,document.activeElement&&document.activeElement.blur(),t.removeClass("elfinder-disabled"))}).disable(function(){m=f,f=!1,t.addClass("elfinder-disabled")}).open(function(){y=[]}).select(function(t){y=e.map(t.data.selected||t.data.value||[],function(e){return b[e]?e:null})}).error(function(t){var n={cssClass:"elfinder-dialog-error",title:o.i18n(o.i18n("error")),resizable:!1,destroyOnClose:!0,buttons:{}};n.buttons[o.i18n(o.i18n("btnClose"))]=function(){e(this).elfinderdialog("close")},t.data.opts&&e.isPlainObject(t.data.opts)&&e.extend(n,t.data.opts),o.dialog(''+o.i18n(t.data.error),n)}).bind("tree parents",function(e){D(e.data.tree||[])}).bind("tmb",function(t){e.each(t.data.images||[],function(e,t){b[e]&&(b[e].tmb=t)})}).add(function(e){D(e.data.added||[])}).change(function(t){e.each(t.data.changed||[],function(t,n){var i=n.hash;b[i]&&e.each(["locked","hidden","width","height"],function(e,t){b[i][t]&&!n[t]&&delete b[i][t]}),b[i]=b[i]?e.extend(b[i],n):n})}).remove(function(t){var n=t.data.removed||[],i=n.length,a={},r=function(t){var n=b[t];n&&("directory"===n.mime&&(a[t]&&delete o.roots[a[t]],e.each(b,function(e,n){n.phash==t&&r(e)})),delete b[t])};for(e.each(o.roots,function(e,t){a[t]=e});i--;)r(n[i])}).bind("searchstart",function(t){e.extend(o.searchStatus,t.data),o.searchStatus.state=1}).bind("search",function(e){o.searchStatus.state=2,D(e.data.files)}).bind("searchend",function(){o.searchStatus.state=0}).bind("rm",function(t){var n=F.canPlayType&&F.canPlayType('audio/wav; codecs="1"');n&&""!=n&&"no"!=n&&e(F).html('')[0].play()}),e.each(this.options.handlers,function(e,t){o.bind(e,t)}),this.history=new this.history(this),this.commands.getfile&&("function"==typeof this.options.getFileCallback?(this.bind("dblclick",function(e){e.preventDefault(),o.exec("getfile").fail(function(){o.exec("open")})}),this.shortcut({pattern:"enter",description:this.i18n("cmdgetfile"),callback:function(){o.exec("getfile").fail(function(){o.exec("mac"==o.OS?"rename":"open")})}}).shortcut({pattern:"ctrl+enter",description:this.i18n("mac"==this.OS?"cmdrename":"cmdopen"),callback:function(){o.exec("mac"==o.OS?"rename":"open")}})):this.options.getFileCallback=null),this.roots={},this._commands={},e.isArray(this.options.commands)||(this.options.commands=[]),e.each(["open","reload","back","forward","up","home","info","quicklook","getfile","help"],function(t,n){var i=e.inArray(n,o.options.commands);return"getfile"!==n||o.options.getFileCallback?void(-1===i&&o.options.commands.push(n)):(-1!==i&&o.options.commands.splice(i,1),!0)}),e.each(this.options.commands,function(t,n){var i=o.commands[n];e.isFunction(i)&&!o._commands[n]&&(i.prototype=I,o._commands[n]=new i,o._commands[n].setup(n,o.options.commandsOptions[n]||{}),o._commands[n].linkedCmds.length&&e.each(o._commands[n].linkedCmds,function(t,n){var i=o.commands[n];e.isFunction(i)&&!o._commands[n]&&(i.prototype=I,o._commands[n]=new i,o._commands[n].setup(n,o.options.commandsOptions[n]||{}))}))}),this.commandMap={},this.disabledCmds={},this.tmbUrls={},t.addClass(this.cssClass).on(u,function(){!f&&o.enable()}),this.ui={workzone:e("
").appendTo(t).elfinderworkzone(this),navbar:e("
").appendTo(t).elfindernavbar(this,this.options.uiOptions.navbar||{}),contextmenu:e("
").appendTo(t).elfindercontextmenu(this),overlay:e("
").appendTo(t).elfinderoverlay({show:function(){o.disable()},hide:function(){m&&o.enable()}}),cwd:e("
").appendTo(t).elfindercwd(this,this.options.uiOptions.cwd||{}),notify:this.dialog("",{cssClass:"elfinder-dialog-notify",position:this.options.notifyDialog.position,resizable:!1,autoOpen:!1,closeOnEscape:!1,title:" ",width:parseInt(this.options.notifyDialog.width)}),statusbar:e('
').hide().appendTo(t)},this.uiAutoHide=[],this.one("open",function(){o.uiAutoHide.length&&setTimeout(function(){o.trigger("uiautohide")},500)}),this.bind("uiautohide",function(){o.uiAutoHide.length&&o.uiAutoHide.shift()()}),e.each(this.options.ui||[],function(n,i){var a="elfinder"+i,r=o.options.uiOptions[i]||{};!o.ui[i]&&e.fn[a]&&(o.ui[i]=e("<"+(r.tag||"div")+"/>").appendTo(t),o.ui[i][a](o,r))}),t[0].elfinder=this,this.options.resizable&&e.fn.resizable&&t.resizable({handles:"se",minWidth:300,minHeight:200}),this.options.width&&(z=this.options.width),this.options.height&&(S=parseInt(this.options.height)),this.options.soundPath&&(U=this.options.soundPath.replace(/\/+$/,"")+"/"),o.resize(z,S),e(document).on("click."+c,function(n){f&&!e(n.target).closest(t).length&&o.disable()}).on(h+" "+p,P),o.options.useBrowserHistory&&e(window).on("popstate."+c,function(t){var n=t.originalEvent.state&&t.originalEvent.state.thash;n&&!e.isEmptyObject(o.files())&&o.request({data:{cmd:"open",target:n,onhistory:1},notify:{type:"open",cnt:1,hideCnt:!0},syncOnFail:!0})}),this.trigger("init").request({data:{cmd:"open",target:o.startDir(),init:1,tree:this.ui.tree?1:0},preventDone:!0,notify:{type:"open",cnt:1,hideCnt:!0},freeze:!0}).fail(function(){o.trigger("fail").disable().lastDir(""),w={},k={},e(document).add(t).off("."+c),o.trigger=function(){}}).done(function(n){var i=t.css("z-index");i&&"auto"!==i&&"inherit"!==i?o.zIndex=i:t.parents().each(function(t,n){var i=e(n).css("z-index");return"auto"!==i&&"inherit"!==i&&(i=parseInt(i))?(o.zIndex=i,!1):void 0}),o.load().debug("api",o.api),n=e.extend(!0,{},n),O(n),o.trigger("open",n)}),this.one("load",function(){t.trigger("resize")}),function(){var n;e(window).on("resize."+c,function(){n&&clearTimeout(n),n=setTimeout(function(){o.trigger("resize",{width:t.width(),height:t.height()})},200)}).on("beforeunload."+c,function(n){var i,a;return t.is(":visible")&&(o.ui.notify.children().length&&-1!==e.inArray("hasNotifyDialog",o.options.windowCloseConfirm)?i=o.i18n("ntfsmth"):t.find("."+o.res("class","editing")).length&&-1!==e.inArray("editingFile",o.options.windowCloseConfirm)?i=o.i18n("editingFile"):(a=Object.keys(o.selected()).length)&&-1!==e.inArray("hasSelectedItem",o.options.windowCloseConfirm)?i=o.i18n("hasSelected",""+a):(a=Object.keys(o.clipboard()).length)&&-1!==e.inArray("hasClipboardData",o.options.windowCloseConfirm)&&(i=o.i18n("hasClipboard",""+a)),i)?(n.returnValue=i,i):void o.trigger("unload")})}(),e(window).on("message."+c,function(e){var t,n,i=e.originalEvent||null;if(i&&0===o.uploadURL.indexOf(i.origin))try{t=JSON.parse(i.data),n=t.data||null,n&&(n.error?o.error(n.error):(n.warning&&o.error(n.warning), n.removed&&n.removed.length&&o.remove(n),n.added&&n.added.length&&o.add(n),n.changed&&n.changed.length&&o.change(n),t.bind&&o.trigger(t.bind,n),n.sync&&o.sync()))}catch(e){o.sync()}}),o.options.enableAlways&&e(window).on("focus."+c,function(e){e.target===this&&o.enable()}),o.dragUpload&&(!function(){var n=function(t){return"TEXTAREA"!==t.target.nodeName&&"INPUT"!==t.target.nodeName&&0===e(t.target).closest("div.ui-dialog-content").length},i=function(e){n(e)&&(e.preventDefault(),e.stopPropagation())},a=function(e){n(e)&&(e.preventDefault(),e.stopPropagation())},r=function(e){n(e)&&(e.preventDefault(),e.stopPropagation(),e.dataTransfer.dropEffect="none")},s=function(e){n(e)&&(e.stopPropagation(),e.preventDefault())};t[0].addEventListener("dragenter",i,!1),t[0].addEventListener("dragleave",a,!1),t[0].addEventListener("dragover",r,!1),t[0].addEventListener("drop",s,!1),o.bind("destroy",function(){t[0].removeEventListener("dragenter",i,!1),t[0].removeEventListener("dragleave",a,!1),t[0].removeEventListener("dragover",r,!1),t[0].removeEventListener("drop",s,!1)})}(),function(){var n="native-drag-enter",i="native-drag-disable",a="class",r=o.res(a,"navdir"),s=(o.res(a,"droppable"),o.res(a,"navcollapse")),l=o.res(a,"navexpand"),c=o.res(a,"adroppable"),u=o.res(a,"navarrow"),h=o.res(a,"adroppable");t.on("dragenter",".native-droppable",function(t){if(t.originalEvent.dataTransfer){var a,d=e(t.currentTarget),p=t.currentTarget.id||null,f=null;if(p)!d.data(n)&&d.hasClass(r)&&d.is("."+s+":not(."+l+")")&&setTimeout(function(){d.is("."+s+"."+c)&&d.children("."+u).click()},500);else{f=o.cwd(),d.data(i,!1);try{e.each(t.originalEvent.dataTransfer.types,function(e,t){"elfinderfrom:"===t.substr(0,13)&&(a=t.substr(13).toLowerCase())})}catch(t){}}f&&(!f.write||a&&a===(window.location.href+f.hash).toLowerCase())?d.data(i,!0):(t.preventDefault(),t.stopPropagation(),d.data(n,!0),d.addClass(h))}}).on("dragleave",".native-droppable",function(t){if(t.originalEvent.dataTransfer){var i=e(t.currentTarget);t.preventDefault(),t.stopPropagation(),i.data(n)?i.data(n,!1):i.removeClass(h)}}).on("dragover",".native-droppable",function(t){if(t.originalEvent.dataTransfer){var a=e(t.currentTarget);t.preventDefault(),t.stopPropagation(),t.originalEvent.dataTransfer.dropEffect=a.data(i)?"none":"copy",a.data(n,!1)}}).on("drop",".native-droppable",function(t){if(t.originalEvent.dataTransfer){var n=e(t.currentTarget);t.preventDefault(),t.stopPropagation(),n.removeClass(h),d=t.currentTarget.id?n.hasClass(r)?o.navId2Hash(t.currentTarget.id):o.cwdId2Hash(t.currentTarget.id):o.cwd().hash,t.originalEvent._target=d,o.directUploadTarget=d,o.exec("upload",{dropEvt:t.originalEvent,target:d}),o.directUploadTarget=null}})}()),void(o.UA.Touch&&!function(){var n,i,a,r,s,l,d=o.getUI("navbar"),u=o.getUI("toolbar"),h=function(e){e.preventDefault()},p=function(){e(document).off("touchmove",h)},f=50;t.on("touchstart touchmove touchend",function(m){if("touchend"===m.type)return n=!1,i=!1,void p();var g,v=m.originalEvent.touches||[{}],b=v[0].pageX||null,y=v[0].pageY||null;if(!(null===b||null===y||"touchstart"===m.type&&v.length>1))if("touchstart"===m.type)a=t.offset(),d&&(n=!1,d.is(":hidden")?(l||(l=Math.max(50,t.width()/10)),("ltr"===o.direction?b-a.left:t.width()+a.left-b)b:b>n)?"navhide":"navshow",Math.abs(n-b)>Math.min("navhide"===g?200:45,.5*t.width())&&(o.getUI("navbar").trigger(g,{handleW:l}),n=!1)),u&&i!==!1&&Math.abs(i-y)>s/3){var w=i>y?"slideUp":"slideDown";u.is("slideDown"===w?":hidden":":visible")&&(u.stop(!0,!0).trigger("toggle",{duration:100,handleH:f}),p()),i=!1}})}())):alert(this.i18n("errURL")):alert(this.i18n("errNode")):alert(this.i18n("errJqui"))},elFinder.prototype={uniqueid:0,res:function(e,t){return this.resources[e]&&this.resources[e][t]},currentReqCmd:"",i18:{en:{translator:"",language:"English",direction:"ltr",dateFormat:"d.m.Y H:i",fancyDateFormat:"$1 H:i",messages:{}},months:["January","February","March","April","May","June","July","August","September","October","November","December"],monthsShort:["msJan","msFeb","msMar","msApr","msMay","msJun","msJul","msAug","msSep","msOct","msNov","msDec"],days:["Sunday","Monday","Tuesday","Wednesday","Thursday","Friday","Saturday"],daysShort:["Sun","Mon","Tue","Wed","Thu","Fri","Sat"]},kinds:{unknown:"Unknown",directory:"Folder",symlink:"Alias","symlink-broken":"AliasBroken","application/x-empty":"TextPlain","application/postscript":"Postscript","application/vnd.ms-office":"MsOffice","application/msword":"MsWord","application/vnd.ms-word":"MsWord","application/vnd.openxmlformats-officedocument.wordprocessingml.document":"MsWord","application/vnd.ms-word.document.macroEnabled.12":"MsWord","application/vnd.openxmlformats-officedocument.wordprocessingml.template":"MsWord","application/vnd.ms-word.template.macroEnabled.12":"MsWord","application/vnd.ms-excel":"MsExcel","application/vnd.openxmlformats-officedocument.spreadsheetml.sheet":"MsExcel","application/vnd.ms-excel.sheet.macroEnabled.12":"MsExcel","application/vnd.openxmlformats-officedocument.spreadsheetml.template":"MsExcel","application/vnd.ms-excel.template.macroEnabled.12":"MsExcel","application/vnd.ms-excel.sheet.binary.macroEnabled.12":"MsExcel","application/vnd.ms-excel.addin.macroEnabled.12":"MsExcel","application/vnd.ms-powerpoint":"MsPP","application/vnd.openxmlformats-officedocument.presentationml.presentation":"MsPP","application/vnd.ms-powerpoint.presentation.macroEnabled.12":"MsPP","application/vnd.openxmlformats-officedocument.presentationml.slideshow":"MsPP","application/vnd.ms-powerpoint.slideshow.macroEnabled.12":"MsPP","application/vnd.openxmlformats-officedocument.presentationml.template":"MsPP","application/vnd.ms-powerpoint.template.macroEnabled.12":"MsPP","application/vnd.ms-powerpoint.addin.macroEnabled.12":"MsPP","application/vnd.openxmlformats-officedocument.presentationml.slide":"MsPP","application/vnd.ms-powerpoint.slide.macroEnabled.12":"MsPP","application/pdf":"PDF","application/xml":"XML","application/vnd.oasis.opendocument.text":"OO","application/vnd.oasis.opendocument.text-template":"OO","application/vnd.oasis.opendocument.text-web":"OO","application/vnd.oasis.opendocument.text-master":"OO","application/vnd.oasis.opendocument.graphics":"OO","application/vnd.oasis.opendocument.graphics-template":"OO","application/vnd.oasis.opendocument.presentation":"OO","application/vnd.oasis.opendocument.presentation-template":"OO","application/vnd.oasis.opendocument.spreadsheet":"OO","application/vnd.oasis.opendocument.spreadsheet-template":"OO","application/vnd.oasis.opendocument.chart":"OO","application/vnd.oasis.opendocument.formula":"OO","application/vnd.oasis.opendocument.database":"OO","application/vnd.oasis.opendocument.image":"OO","application/vnd.openofficeorg.extension":"OO","application/x-shockwave-flash":"AppFlash","application/flash-video":"Flash video","application/x-bittorrent":"Torrent","application/javascript":"JS","application/rtf":"RTF","application/rtfd":"RTF","application/x-font-ttf":"TTF","application/x-font-otf":"OTF","application/x-rpm":"RPM","application/x-web-config":"TextPlain","application/xhtml+xml":"HTML","application/docbook+xml":"DOCBOOK","application/x-awk":"AWK","application/x-gzip":"GZIP","application/x-bzip2":"BZIP","application/x-xz":"XZ","application/zip":"ZIP","application/x-zip":"ZIP","application/x-rar":"RAR","application/x-tar":"TAR","application/x-7z-compressed":"7z","application/x-jar":"JAR","text/plain":"TextPlain","text/x-php":"PHP","text/html":"HTML","text/javascript":"JS","text/css":"CSS","text/rtf":"RTF","text/rtfd":"RTF","text/x-c":"C","text/x-csrc":"C","text/x-chdr":"CHeader","text/x-c++":"CPP","text/x-c++src":"CPP","text/x-c++hdr":"CPPHeader","text/x-shellscript":"Shell","application/x-csh":"Shell","text/x-python":"Python","text/x-java":"Java","text/x-java-source":"Java","text/x-ruby":"Ruby","text/x-perl":"Perl","text/x-sql":"SQL","text/xml":"XML","text/x-comma-separated-values":"CSV","text/x-markdown":"Markdown","image/x-ms-bmp":"BMP","image/jpeg":"JPEG","image/gif":"GIF","image/png":"PNG","image/tiff":"TIFF","image/x-targa":"TGA","image/vnd.adobe.photoshop":"PSD","image/xbm":"XBITMAP","image/pxm":"PXM","audio/mpeg":"AudioMPEG","audio/midi":"AudioMIDI","audio/ogg":"AudioOGG","audio/mp4":"AudioMPEG4","audio/x-m4a":"AudioMPEG4","audio/wav":"AudioWAV","audio/x-mp3-playlist":"AudioPlaylist","video/x-dv":"VideoDV","video/mp4":"VideoMPEG4","video/mpeg":"VideoMPEG","video/x-msvideo":"VideoAVI","video/quicktime":"VideoMOV","video/x-ms-wmv":"VideoWM","video/x-flv":"VideoFlash","video/x-matroska":"VideoMKV","video/ogg":"VideoOGG"},rules:{defaults:function(t){return!(!t||t.added&&!e.isArray(t.added)||t.removed&&!e.isArray(t.removed)||t.changed&&!e.isArray(t.changed))},open:function(t){return t&&t.cwd&&t.files&&e.isPlainObject(t.cwd)&&e.isArray(t.files)},tree:function(t){return t&&t.tree&&e.isArray(t.tree)},parents:function(t){return t&&t.tree&&e.isArray(t.tree)},tmb:function(t){return t&&t.images&&(e.isPlainObject(t.images)||e.isArray(t.images))},upload:function(t){return t&&(e.isPlainObject(t.added)||e.isArray(t.added))},search:function(t){return t&&t.files&&e.isArray(t.files)}},commands:{},cmdsToAdd:"archive duplicate extract mkdir mkfile paste rm upload",parseUploadData:function(t){var n;if(!e.trim(t))return{error:["errResponse","errDataEmpty"]};try{n=e.parseJSON(t)}catch(i){return{error:["errResponse","errDataNotJSON"]}}return this.validResponse("upload",n)?(n=this.normalize(n),n.removed=e.merge(n.removed||[],e.map(n.added||[],function(e){return e.hash})),n):{error:["errResponse"]}},iframeCnt:0,uploads:{xhrUploading:!1,checkExists:function(t,n,i){var a,r,o=e.Deferred(),s=function(){for(var e=t.length;--e>-1;)t[e]._remove=!0},l=function(){var l=[],d={},c=[],u=[],h=function(e){var n=e==u.length-1,a={title:i.i18n("cmdupload"),text:["errExists",u[e].name,"confirmRepl"],all:!n,accept:{label:"btnYes",callback:function(t){n||t?o.resolve(l,d):h(++e)}},reject:{label:"btnNo",callback:function(i){var a;if(i)for(a=u.length;e0&&delete a.reject,i.confirm(a)};a=e.map(t,function(e,t){return e.name?{i:t,name:e.name}:null}),r=e.map(a,function(e){return e.name}),i.request({data:{cmd:"ls",target:n,intersect:r},notify:{type:"preupload",cnt:1,hideCnt:!0},preventFail:!0}).done(function(t){var r,l;t&&(t.error?s():i.option("uploadOverwrite")&&!i.UA.iOS&&t.list&&(e.isArray(t.list)?c=t.list||[]:(r=[],c=e.map(t.list,function(e){return"string"==typeof e?e:(r=r.concat(e),null)}),r.length&&(c=c.concat(r)),d=t.list),u=e.map(a,function(t){return-1!==e.inArray(t.name,c)?t:null}),c.length&&n==i.cwd().hash&&(l=e.map(i.files(),function(e){return e.phash==n?e.name:null}),e.map(c,function(e){return-1===l.indexOf(e)?!0:null}).length&&i.sync()))),u.length>0?h(0):o.resolve([])}).fail(function(e){s(),o.resolve([]),e&&i.error(e)})};return i.api>=2.1&&"object"==typeof t[0]?(l(),o):o.resolve([])},checkFile:function(t,n,i){if(t.checked||"files"==t.type)return t.files;if("data"==t.type){var a,r=e.Deferred(),o=[],s=[],l=0,d=[],c=function(e){for(var t,i,a=[],r=function(e){return Array.prototype.slice.call(e||[],0)},u=e.length,h=0;u>h;h++)if(i=e[h])if(i.isFile)l++,i.file(function(e){"win"==n.OS&&e.name.match(/^(?:desktop\.ini|thumbs\.db)$/i)||"mac"==n.OS&&e.name.match(/^\.ds_store$/i)||(s.push(i.fullPath||""),o.push(e)),l--});else if(i.isDirectory&&n.api>=2.1){l++,d.push(i.fullPath),t=i.createReader();var a=[],p=function(){t.readEntries(function(e){if(e.length)a=a.concat(r(e)),p();else{for(var t=0;t0?(n.uploads.checkExists(a,i,n).done(function(t,u){var h,p=[];n.option("uploadOverwrite")&&!n.UA.iOS&&(a=e.map(a,function(a){var r,o,s,l;return a.isDirectory&&(r=e.inArray(a.name,t),-1!==r&&(t.splice(r,1),o=n.uniqueName(a.name+n.options.backupSuffix,null,""),e.each(u,function(e,t){return a.name==t?(s=e,!1):void 0}),s||(s=n.fileByName(a.name,i).hash),n.lockfiles({files:[s]}),l=n.request({data:{cmd:"rename",target:s,name:o},notify:{type:"rename",cnt:1}}).fail(function(e){a._remove=!0,n.sync()}).always(function(){n.unlockfiles({files:[s]})}),p.push(l))),a._remove?null:a})),e.when.apply(e,p).done(function(){a.length>0?(h=setTimeout(function(){n.notify({type:"readdir",cnt:1,hideCnt:!0})},n.options.notifyDelay),c(a),setTimeout(function e(){l>0?setTimeout(e,10):(h&&clearTimeout(h),n.notify({type:"readdir",cnt:-1}),r.resolve([o,s,t,u,d]))},10)):r.reject()})}),r.promise()):r.reject()}var u=[],h=[],p=t.files[0];if("html"==t.type){var f,m=e("").append(e.parseHTML(p));e("img[src]",m).each(function(){var t,n,i=e(this),a=i.closest("a");a&&a.attr("href")&&a.attr("href").match(/\.(?:jpe?g|gif|bmp|png)/i)&&(n=a.attr("href")),t=i.attr("src"),t&&(n?(-1==e.inArray(n,u)&&u.push(n),-1==e.inArray(t,h)&&h.push(t)):-1==e.inArray(t,u)&&u.push(t))}),f=e("a[href]",m),f.each(function(){var t,n=function(e){var t=document.createElement("a");return t.href=e,t};e(this).text()&&(t=n(e(this).attr("href")),!t.href||1!==f.length&&t.pathname.match(/(?:\.html?|\/[^\/.]*)$/i)||-1==e.inArray(t.href,u)&&-1==e.inArray(t.href,h)&&u.push(t.href))})}else{var g,v,b;for(g=/(http[^<>"{}|\\^\[\]`\s]+)/gi;v=g.exec(p);)b=v[1].replace(/&/g,"&"),-1==e.inArray(b,u)&&u.push(b)}return u},xhr:function(t,n){var i,a=n?n:this,r=a.getUI(),o=new XMLHttpRequest,s=null,l=null,d=t.checked,c=t.isDataType||"data"==t.type,u=-1!=a.option("uploadMaxConn"),h=Math.min(5,Math.max(1,a.option("uploadMaxConn"))),p=0,f=e.Deferred().fail(function(e){if(a.uploads.xhrUploading){setTimeout(function(){a.sync()},5e3),a.uploads.xhrUploading=!1;var t=v.length?c?v[0][0]:v[0]:{};t._cid&&(m=new FormData,v=[{_chunkfail:!0}],m.append("chunk",t._chunk),m.append("cid",t._cid),c=!1,U(v))}v=null,e&&a.error(e)}).done(function(e){o=null,v=null,e&&(e.warning&&a.error(e.warning),e.removed&&a.remove(e),e.added&&a.add(e),e.changed&&a.change(e),a.trigger("upload",e),e.sync&&a.sync())}).always(function(){r.off("uploadabort",T),e(window).off("unload",T),s&&clearTimeout(s),l&&clearTimeout(l),d&&!t.multiupload&&C()&&a.notify({type:"upload",cnt:-b,progress:0,size:0}),S&&a.ui.notify.children(".elfinder-notify-chunkmerge").length&&a.notify({type:"chunkmerge",cnt:-1})}),m=new FormData,g=t.target||a.cwd().hash,v=t.input?t.input.files:a.uploads.checkFile(t,a,g),b=t.checked&&c?v[0].length:v.length,y=0,w=0,k=!1,x=!1,C=function(){return k=k||a.ui.notify.children(".elfinder-notify-upload").length},T=function(){x=!0,o&&(o.quiet=!0,o.abort())},A=function(e){return e||(e=w),setTimeout(function(){k=!0,a.notify({type:"upload",cnt:b,progress:y-i,size:e,cancel:function(){r.trigger("uploadabort")}}),i=y},a.options.notifyDelay)},I=t.renames||null,z=t.hashes||null,S=!1;if(r.one("uploadabort",T),e(window).one("unload."+n.namespace,T),!S&&(i=y),!c&&!b)return f.reject(["errUploadNoFiles"]);o.addEventListener("error",function(){f.reject("errConnect")},!1),o.addEventListener("abort",function(){f.reject(["errConnect","errAbort"])},!1),o.addEventListener("load",function(e){var n,r=o.status,d=0,u="";if(r>=400?u=r>500?"errResponse":"errConnect":(4!=o.readyState&&(u=["errConnect","errTimeout"]),o.responseText||(u=["errResponse","errDataEmpty"])),u){if(S||p++>3){var h=c?v[0][0]:v[0];return f.reject(h._cid?null:u)}return w=0,o.open("POST",a.uploadURL,!0),void o.send(m)}if(y=w,C()&&(d=y-i)&&a.notify({type:"upload",cnt:0,progress:d,size:0}),n=a.parseUploadData(o.responseText),n._chunkmerged){m=new FormData;var g=[{_chunkmerged:n._chunkmerged,_name:n._name,_mtime:n._mtime}];return S=!0,l=setTimeout(function(){a.notify({type:"chunkmerge",cnt:1})},a.options.notifyDelay),void(c?U(g,v[1]):U(g))}n._multiupload=!!t.multiupload,n.error?n._chunkfailure?(x=!0,a.uploads.xhrUploading=!1,s&&clearTimeout(s),a.ui.notify.children(".elfinder-notify-upload").length?(a.notify({type:"upload",cnt:-b,progress:0,size:0}),f.reject(n.error)):f.reject()):f.reject(n.error):f.resolve(n)},!1),o.upload.addEventListener("loadstart",function(e){!S&&e.lengthComputable&&(y=e.loaded,p&&(y=0),w=e.total,y||(y=parseInt(.05*w)),C()&&(a.notify({type:"upload",cnt:0,progress:y-i,size:t.multiupload?0:w}),i=y))},!1),o.upload.addEventListener("progress",function(e){var n;e.lengthComputable&&!S&&(y=e.loaded,!t.checked&&y>0&&!s&&(s=A(o._totalSize-y)),w||(p&&(y=0),w=e.total,y||(y=parseInt(.05*w))),n=y-i,C()&&n/e.total>=.05&&(a.notify({type:"upload",cnt:0,progress:n,size:0}),i=y))},!1);var U=function(i,r){var l,p,v,y,w,k,T,S,U,F,M,O,D=0,P=1,E=[],j=0,H=b,R=0,q=[],_=(new Date).getTime().toString().substr(-9),N=Math.min((n.uplMaxSize?n.uplMaxSize:2097152)-8190,n.options.uploadMaxChunkSize),L=u?!1:"",W=function(i,r){var o,l=[];if(!x){for(;i.length&&l.length=2.1&&("slice"in T?L="slice":"mozSlice"in T?L="mozSlice":"webkitSlice"in T&&(L="webkitSlice"))),l&&p>l||!L&&n.uplMaxSize&&p>n.uplMaxSize)a.error(a.i18n("errUploadFile",T.name)+" "+a.i18n("errUploadFileSize")),b--,H--;else if(L&&p>N){for(y=0,w=N,k=-1,H=Math.floor(p/N),R+=p,q[_]=0;p>=y;)S=T[L](y,w),S._chunk=T.name+"."+ ++k+"_"+H+".part",S._cid=_,S._range=y+","+S.size+","+p,q[_]++,D&&j++,"undefined"==typeof E[j]&&(E[j]=[],c&&(E[j][0]=[],E[j][1]=[])),D=N,P=1,c?(E[j][0].push(S),E[j][1].push(r[v])):E[j].push(S),y=w,w=y+N;null==S?(a.error(a.i18n("errUploadFile",T.name)+" "+a.i18n("errUploadFileSize")),b--,H--):H+=k}else(n.uplMaxSize&&D+p>=n.uplMaxSize||P>n.uplMaxFile)&&(D=0,P=1,j++),"undefined"==typeof E[j]&&(E[j]=[],c&&(E[j][0]=[],E[j][1]=[])),c?(E[j][0].push(T),E[j][1].push(r[v])):E[j].push(T),D+=p,R+=p,P++;if(0==E.length)return t.checked=!0,!1;if(E.length>1)return s=A(R),U=[],F=0,M=E.length,O=[],V(),!0;c?(i=E[0][0],r=E[0][1]):i=E[0]}return d||(n.UA.Safari&&t.files?o._totalSize=R:s=A(R)),d=!0,i.length||f.reject(["errUploadNoFiles"]),o.open("POST",a.uploadURL,!0),n.customHeaders&&e.each(n.customHeaders,function(e){o.setRequestHeader(e,this)}),n.xhrFields&&e.each(n.xhrFields,function(e){e in o&&(o[e]=this)}),m.append("cmd","upload"),m.append(a.newAPI?"target":"current",g),I&&I.length&&(e.each(I,function(e,t){m.append("renames[]",t)}),m.append("suffix",n.options.backupSuffix)),z&&e.each(z,function(e,t){m.append("hashes["+e+"]",t)}),e.each(a.options.customData,function(e,t){m.append(e,t)}),e.each(a.options.onlyMimes,function(e,t){m.append("mimes["+e+"]",t)}),e.each(i,function(e,t){t._chunkmerged?(m.append("chunk",t._chunkmerged),m.append("upload[]",t._name),m.append("mtime[]",t._mtime)):(t._chunkfail?(m.append("upload[]","chunkfail"),m.append("mimes","chunkfail")):m.append("upload[]",t),t._chunk&&(m.append("chunk",t._chunk),m.append("cid",t._cid),m.append("range",t._range)),m.append("mtime[]",t.lastModified?Math.round(t.lastModified/1e3):0)),n.UA.iOS&&m.append("overwrite",0)}),c&&e.each(r,function(e,t){m.append("upload_path[]",t)}),o.onreadystatechange=function(){if(4==o.readyState&&0==o.status)if(x)f.reject();else{var n=["errAbort"];!c&&t.files&&e.map(t.files,function(e){return 0===e.size?e:null}).length&&n.push("errFolderUpload"),f.reject(n)}},o.send(m),!0};return c?d?U(v[0],v[1]):v.done(function(t){if(I=[],b=t[0].length){if(t[4]&&t[4].length)return void n.request({data:{cmd:"mkdir",target:g,dirs:t[4]},notify:{type:"mkdir",cnt:t[4].length}}).fail(function(e){e=e||["errUnknown"],"errCmdParams"===e[0]?h=1:(h=0,f.reject(e))}).done(function(n){n.hashes&&(t[1]=e.map(t[1],function(e){return e=e.replace(/\/[^\/]*$/,""),""===e?g:n.hashes[e]}))}).always(function(e){h&&(I=t[2],z=t[3],U(t[0],t[1]))});t[1]=e.map(t[1],function(){return g}),I=t[2],z=t[3],U(t[0],t[1])}else f.reject(["errUploadNoFiles"])}).fail(function(){f.reject()}):v.length>0?null==I?(I=[],z={},a.uploads.checkExists(v,g,n).done(function(t,i){n.option("uploadOverwrite")&&!n.UA.iOS&&(I=t,z=i,v=e.map(v,function(e){return e._remove?null:e})),b=v.length,b>0?U(v)||f.reject():f.reject()})):U(v)||f.reject():f.reject(),f},iframe:function(t,n){var i,a,r,o,s=n?n:this,l=t.input?t.input:!1,d=l?!1:s.uploads.checkFile(t,s),c=e.Deferred().fail(function(e){e&&s.error(e)}).done(function(e){e.warning&&s.error(e.warning),e.removed&&s.remove(e),e.added&&s.add(e),e.changed&&s.change(e),s.trigger("upload",e),e.sync&&s.sync()}),u="iframe-"+namespace+ ++s.iframeCnt,h=e('
'),p=this.UA.IE,f=function(){o&&clearTimeout(o),r&&clearTimeout(r),a&&s.notify({type:"upload",cnt:-i}),setTimeout(function(){p&&e('