/*! * elFinder - file manager for web * Version 2.1 (Nightly: e9d48d2) (2013-09-05) * http://elfinder.org * * Copyright 2009-2013, Studio 42 * Licensed under a 3 clauses BSD license */ !function(e){window.elFinder=function(t,i){this.time("load");var n,r,a,o=this,t=e(t),s=e("
").append(t.contents()),d=t.attr("style"),l=t.attr("id")||"",c="elfinder-"+(l||Math.random().toString().substr(2,7)),p="mousedown."+c,u="keydown."+c,h="keypress."+c,f=!0,m=!0,g="",v={path:"",url:"",tmbUrl:"",disabled:[],separator:"/",archives:[],extract:[],copyOverwrite:!0,uploadMaxSize:0,tmb:!1},b={},y=[],w={},x={},k=[],C=[],T=[],F=new o.command(o),I="auto",z=400,P=e(document.createElement("audio")).hide().appendTo("body")[0],A=function(t){if(t.init)b={};else for(var i in b)b.hasOwnProperty(i)&&"directory"!=b[i].mime&&b[i].phash==g&&-1===e.inArray(i,C)&&delete b[i];g=t.cwd.hash,D(t.files),b[g]||D([t.cwd]),o.lastDir(g)},D=function(e){for(var t,i=e.length;i--;)if(t=e[i],t.name&&t.hash&&t.mime){if(!t.phash){var n="volume_"+t.name,r=o.i18n(n);n!=r&&(t.i18=r)}b[t.hash]=t}},M=function(t){var i=t.keyCode,n=!(!t.ctrlKey&&!t.metaKey);f&&(e.each(x,function(e,r){r.type==t.type&&r.keyCode==i&&r.shiftKey==t.shiftKey&&r.ctrlKey==n&&r.altKey==t.altKey&&(t.preventDefault(),t.stopPropagation(),r.callback(t,o),o.debug("shortcut-exec",e+" : "+r.description))}),9!=i||e(t.target).is(":input")||t.preventDefault())},O=new Date;return this.api=null,this.newAPI=!1,this.oldAPI=!1,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}}(),this.options=e.extend(!0,{},this._options,i||{}),i.ui&&(this.options.ui=i.ui),i.commands&&(this.options.commands=i.commands),i.uiOptions&&i.uiOptions.toolbar&&(this.options.uiOptions.toolbar=i.uiOptions.toolbar),e.extend(this.options.contextmenu,i.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.id=l,this.uploadURL=i.urlUpload||i.url,this.namespace=c,this.lang=this.i18[this.options.lang]&&this.i18[this.options.lang].messages?this.options.lang:"en",a="en"==this.lang?this.i18.en:e.extend(!0,{},this.i18.en,this.i18[this.lang]),this.direction=a.direction,this.messages=a.messages,this.dateFormat=this.options.dateFormat||a.dateFormat,this.fancyFormat=this.options.fancyDateFormat||a.fancyDateFormat,this.today=new Date(O.getFullYear(),O.getMonth(),O.getDate()).getTime()/1e3,this.yesterday=this.today-86400,r=this.options.UTCDate?"UTC":"",this.getHours="get"+r+"Hours",this.getMinutes="get"+r+"Minutes",this.getSeconds="get"+r+"Seconds",this.getDate="get"+r+"Date",this.getDay="get"+r+"Day",this.getMonth="get"+r+"Month",this.getFullYear="get"+r+"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.options.cssClass,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"),this.sortStickFolders=null===this.sortStickFolders?!!this.options.sortStickFolders:!!this.sortStickFolders,this.sortRules=e.extend(!0,{},this._sortRules,this.options.sortsRules),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.draggable={appendTo:"body",addClasses:!0,delay:30,revert:!0,refreshPositions:!0,cursor:"move",cursorAt:{left:50,top:47},drag:function(e,t){t.helper.data("locked")||t.helper.toggleClass("elfinder-drag-helper-plus",e.shiftKey||e.ctrlKey||e.metaKey)},start:function(t,i){var n,r,a=e.map(i.helper.data("files")||[],function(e){return e||null});for(n=a.length;n--;)if(r=a[n],b[r].locked){i.helper.addClass("elfinder-drag-helper-plus").data("locked",!0);break}},stop:function(){o.trigger("focus").trigger("dragstop")},helper:function(t){var i,n,r=this.id?e(this):e(this).parents("[id]:first"),a=e('
'),s=function(e){return'
'};return o.trigger("dragstart",{target:r[0],originalEvent:t}),i=r.is("."+o.res("class","cwdfile"))?o.selected():[o.navId2Hash(r.attr("id"))],a.append(s(b[i[0]].mime)).data("files",i).data("locked",!1),(n=i.length)>1&&a.append(s(b[i[n-1]].mime)+''+n+""),a}},this.droppable={tolerance:"pointer",accept:".elfinder-cwd-file-wrapper,.elfinder-navbar-dir,.elfinder-cwd-file",hoverClass:this.res("class","adroppable"),drop:function(t,i){var n,r,a,s=e(this),d=e.map(i.helper.data("files")||[],function(e){return e||null}),l=[],c="class";for(s.is("."+o.res(c,"cwd"))?r=g:s.is("."+o.res(c,"cwdfile"))?r=s.attr("id"):s.is("."+o.res(c,"navdir"))&&(r=o.navId2Hash(s.attr("id"))),n=d.length;n--;)a=d[n],a!=r&&b[a].phash!=r&&l.push(a);l.length&&(i.helper.hide(),o.clipboard(l,!(t.ctrlKey||t.shiftKey||t.metaKey||i.helper.data("locked"))),o.exec("paste",r),o.trigger("drop",{files:d}))}},this.enabled=function(){return t.is(":visible")&&f},this.visible=function(){return t.is(":visible")},this.root=function(e){for(var t,i=b[e||g];i&&i.phash;)i=b[i.phash];if(i)return i.hash;for(;t in b&&b.hasOwnProperty(t);)if(i=b[t],!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,i=[];t=this.file(e);)i.unshift(t.hash),e=t.phash;return i},this.path2array=function(e,t){for(var i,n=[];e&&(i=b[e])&&i.hash;)n.unshift(t&&i.i18?i.i18:i.name),e=i.phash;return n},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 i=b[t];if(!i||!i.read)return"";if(i.url)return i.url;if(v.url)return v.url+e.map(this.path2array(t),function(e){return encodeURIComponent(e)}).slice(1).join("/");var n=e.extend({},this.customData,{cmd:"file",target:i.hash});return this.oldAPI&&(n.cmd="open",n.current=i.phash),this.options.url+(-1===this.options.url.indexOf("?")?"?":"&")+e.param(n,!0)},this.tmb=function(e){var t=b[e],i=t&&t.tmb&&1!=t.tmb?v.tmbUrl+t.tmb:"";return i&&(this.UA.Opera||this.UA.IE)&&(i+="?_="+(new Date).getTime()),i},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 i;for(i in b)if(b.hasOwnProperty(i)&&b[i].phash==t&&b[i].name==e)return b[i]},this.validResponse=function(e,t){return t.error||this.rules[this.rules[e]?e:"defaults"](t)},this.returnBytes=function(e){if("-1"==e&&(e=0),e){e=e.replace(/b$/i,"");var t=e.charAt(e.length-1).toLowerCase();e=e.replace(/[gmk]$/i,""),"g"==t?e=1024*1024*1024*e:"m"==t?e=1024*1024*e:"k"==t&&(e=1024*e)}return e},this.request=function(t){var i,n,r,a=this,o=this.options,s=e.Deferred(),d=e.extend({},o.customData,{mimes:o.onlyMimes},t.data||t),l=d.cmd,c=!(t.preventDefault||t.preventFail),p=!(t.preventDefault||t.preventDone),u=e.extend({},t.notify),h=!!t.raw,f=t.syncOnFail,t=e.extend({url:o.url,async:!0,type:this.requestType,dataType:"json",cache:!1,data:d},t.options||{}),m=function(t){t.warning&&a.error(t.warning),"open"==l&&A(e.extend(!0,{},t)),t.removed&&t.removed.length&&a.remove(t),t.added&&t.added.length&&a.add(t),t.changed&&t.changed.length&&a.change(t),a.trigger(l,t),t.sync&&a.sync()},g=function(e,t){var i;switch(t){case"abort":i=e.quiet?"":["errConnect","errAbort"];break;case"timeout":i=["errConnect","errTimeout"];break;case"parsererror":i=["errResponse","errDataNotJSON"];break;default:i=403==e.status?["errConnect","errAccess"]:404==e.status?["errConnect","errNotFound"]:"errConnect"}s.reject(i,e,t)},b=function(t){return h?s.resolve(t):t?e.isPlainObject(t)?t.error?s.reject(t.error,n):a.validResponse(l,t)?(t=a.normalize(t),a.api||(a.api=t.api||1,a.newAPI=a.api>=2,a.oldAPI=!a.newAPI),t.options&&(v=e.extend({},v,t.options)),t.netDrivers&&(a.netDrivers=t.netDrivers),"open"==l&&d.init&&(a.uplMaxSize=a.returnBytes(t.uplMaxSize),a.uplMaxFile=t.uplMaxFile?parseInt(t.uplMaxFile):20),s.resolve(t),t.debug&&a.debug("backend-debug",t.debug),void 0):s.reject("errResponse",n):s.reject(["errResponse","errDataNotJSON"],n):s.reject(["errResponse","errDataEmpty"],n)};if(p&&s.done(m),s.fail(function(e){e&&(c?a.error(e):a.debug("error",a.i18n(e)))}),!l)return s.reject("errCmdReq");if(f&&s.fail(function(e){e&&a.sync()}),u.type&&u.cnt&&(i=setTimeout(function(){a.notify(u),s.always(function(){u.cnt=-(parseInt(u.cnt)||0),a.notify(u)})},a.notifyDelay),s.always(function(){clearTimeout(i)})),"open"==l)for(;r=T.pop();)"pending"==r.state()&&(r.quiet=!0,r.abort());return delete t.preventFail,n=this.transport.send(t).fail(g).done(b),"open"==l&&(T.unshift(n),s.always(function(){var t=e.inArray(n,T);-1!==t&&T.splice(t,1)})),s},this.diff=function(t){var i={},n=[],r=[],a=[],o=function(e){for(var t=a.length;t--;)if(a[t].hash==e)return!0};return e.each(t,function(e,t){i[t.hash]=t}),e.each(b,function(e){!i[e]&&r.push(e)}),e.each(i,function(t,i){var r=b[t];r?e.each(i,function(e){return i[e]!=r[e]?(a.push(i),!1):void 0}):n.push(i)}),e.each(r,function(t,n){var s=b[n],d=s.phash;d&&"directory"==s.mime&&-1===e.inArray(d,r)&&i[d]&&!o(d)&&a.push(i[d])}),{added:n,removed:r,changed:a}},this.sync=function(){var t=this,i=e.Deferred().done(function(){t.trigger("sync")}),n={data:{cmd:"open",init:1,target:g,tree:this.ui.tree?1:0},preventDefault:!0},r={data:{cmd:"tree",target:g==this.root()?g:this.file(g).phash},preventDefault:!0};return e.when(this.request(n),this.request(r)).fail(function(e){i.reject(e),e&&t.request({data:{cmd:"open",target:t.lastDir(""),tree:1,init:1},notify:{type:"open",cnt:1,hideCnt:!0},preventDefault:!0})}).done(function(e,n){var r=t.diff(e.files.concat(n&&n.tree?n.tree:[]));return r.added.push(e.cwd),r.removed.length&&t.remove(r),r.added.length&&t.add(r),r.changed.length&&t.change(r),i.resolve(r)}),i},this.upload=function(e){return this.transport.upload(e,this)},this.bind=function(e,t){var i;if("function"==typeof t)for(e=(""+e).toLowerCase().split(/\s+/),i=0;i-1&&i.splice(n,1),t=null,this},this.trigger=function(t,i){var n,t=t.toLowerCase(),r=w[t]||[];if(this.debug("event-"+t,i),r.length)for(t=e.Event(t),n=0;n0?r:r.charCodeAt(0):e.ui.keyCode[r],r&&!x[n]&&(x[n]={keyCode:r,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:n});return this},this.shortcuts=function(){var t=[];return e.each(x,function(e,i){t.push([i.pattern,o.i18n(i.description)])}),t},this.clipboard=function(t,i){var n=function(){return e.map(k,function(e){return e.hash})};return void 0!==t&&(k.length&&this.trigger("unlockfiles",{files:n()}),C=[],k=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:!!i}):null}),this.trigger("changeclipboard",{clipboard:k.slice(0,k.length)}),i&&this.trigger("lockfiles",{files:n()})),k.slice(0,k.length)},this.isCommandEnabled=function(t){return this._commands[t]?-1===e.inArray(t,v.disabled):!1},this.exec=function(t,i,n){return this._commands[t]&&this.isCommandEnabled(t)?this._commands[t].exec(i,n):e.Deferred().reject("No such command")},this.dialog=function(i,n){return e("
").append(i).appendTo(t).elfinderdialog(n)},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,i){t.css("width",e).height(i).trigger("resize"),this.trigger("resize",{width:t.width(),height:t.height()})},this.restoreSize=function(){this.resize(I,z)},this.show=function(){t.show(),this.enable().trigger("show")},this.hide=function(){this.disable().trigger("hide"),t.hide()},this.destroy=function(){t&&t[0].elfinder&&(this.trigger("destroy").disable(),w={},x={},e(document).add(t).unbind("."+this.namespace),o.trigger=function(){},t.children().remove(),t.append(s.contents()).removeClass(this.cssClass).attr("style",d),t[0].elfinder=null,n&&clearInterval(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];return 1==arguments.length&&"function"==typeof e?o.bind("error",e):o.trigger("error",{error:e})},e.each(["enable","disable","load","open","reload","select","add","remove","change","dblclick","getfile","lockfiles","unlockfiles","dragstart","dragstop","search","searchend","viewchange"],function(t,i){o[i]=function(){var t=arguments[0];return 1==arguments.length&&"function"==typeof t?o.bind(i,t):o.trigger(i,e.isPlainObject(t)?t:{})}}),this.enable(function(){!f&&o.visible()&&o.ui.overlay.is(":hidden")&&(f=!0,e("texarea:focus,input:focus,button").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 i={cssClass:"elfinder-dialog-error",title:o.i18n(o.i18n("error")),resizable:!1,destroyOnClose:!0,buttons:{}};i.buttons[o.i18n(o.i18n("btnClose"))]=function(){e(this).elfinderdialog("close")},o.dialog(''+o.i18n(t.data.error),i)}).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,i){var n=i.hash;(b[n].width&&!i.width||b[n].height&&!i.height)&&(b[n].width=void 0,b[n].height=void 0),b[n]=b[n]?e.extend(b[n],i):i})}).remove(function(t){for(var i=t.data.removed||[],n=i.length,r=function(t){var i=b[t];i&&("directory"==i.mime&&i.dirs&&e.each(b,function(e,i){i.phash==t&&r(e)}),delete b[t])};n--;)r(i[n])}).bind("search",function(e){D(e.data.files)}).bind("rm",function(){var t=P.canPlayType&&P.canPlayType('audio/wav; codecs="1"');t&&""!=t&&"no"!=t&&e(P).html('')[0].play()}),e.each(this.options.handlers,function(e,t){o.bind(e,t)}),this.history=new this.history(this),"function"==typeof this.options.getFileCallback&&this.commands.getfile&&(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._commands={},e.isArray(this.options.commands)||(this.options.commands=[]),e.each(["open","reload","back","forward","up","home","info","quicklook","getfile","help"],function(t,i){-1===e.inArray(i,o.options.commands)&&o.options.commands.push(i)}),e.each(this.options.commands,function(t,i){var n=o.commands[i];e.isFunction(n)&&!o._commands[i]&&(n.prototype=F,o._commands[i]=new n,o._commands[i].setup(i,o.options.commandsOptions[i]||{}))}),t.addClass(this.cssClass).bind(p,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:{top:"12px",right:"12px"},resizable:!1,autoOpen:!1,title:" ",width:280}),statusbar:e('
').hide().appendTo(t)},e.each(this.options.ui||[],function(i,n){var r="elfinder"+n,a=o.options.uiOptions[n]||{};!o.ui[n]&&e.fn[r]&&(o.ui[n]=e("<"+(a.tag||"div")+"/>").appendTo(t)[r](o,a))}),t[0].elfinder=this,this.options.resizable&&e.fn.resizable&&t.resizable({handles:"se",minWidth:300,minHeight:200}),this.options.width&&(I=this.options.width),this.options.height&&(z=parseInt(this.options.height)),o.resize(I,z),e(document).bind("click."+this.namespace,function(i){f&&!e(i.target).closest(t).length&&o.disable()}).bind(u+" "+h,M),this.trigger("init").request({data:{cmd:"open",target:o.lastDir(),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={},x={},e(document).add(t).unbind("."+this.namespace),o.trigger=function(){}}).done(function(t){o.load().debug("api",o.api),t=e.extend(!0,{},t),A(t),o.trigger("open",t)}),this.one("load",function(){t.trigger("resize"),o.options.sync>1e3&&(n=setInterval(function(){o.sync()},o.options.sync))}),void 0):alert(this.i18n("errURL")):alert(this.i18n("errNode")):alert(this.i18n("errJqui"))},elFinder.prototype={res:function(e,t){return this.resources[e]&&this.resources[e][t]},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:["Jan","Feb","Mar","Apr","May","Jun","Jul","Aug","Sep","Oct","Nov","Dec"],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/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.openxmlformats-officedocument.spreadsheetml.sheet":"MsWord","application/vnd.ms-excel":"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/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","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)?!1:!0},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:{},parseUploadData:function(t){var i;if(!e.trim(t))return{error:["errResponse","errDataEmpty"]};try{i=e.parseJSON(t)}catch(n){return{error:["errResponse","errDataNotJSON"]}}return this.validResponse("upload",i)?(i=this.normalize(i),i.removed=e.map(i.added||[],function(e){return e.hash}),i):{error:["errResponse"]}},iframeCnt:0,uploads:{checkFile:function(t,i){if(t.checked||"files"==t.type)return t.files;if("data"==t.type){var n=e.Deferred(),r=[],a=[],o=[],s=[],d=0,l=function(t){var n=function(e){return Array.prototype.slice.call(e||[])},c=function(t){var i=e.Deferred();return t.isFile?t.file(function(e){i.resolve(e)},function(){i.reject()}):i.reject("dirctory"),i.promise()};t.readEntries(function(e){if(e.length)s=s.concat(n(e)),l(t);else{var p=s.length-1,u=function(e){c(s[e]).done(function(t){"win"==i.OS&&t.name.match(/^(?:desktop\.ini|thumbs\.db)$/i)||"mac"==i.OS&&t.name.match(/^\.ds_store$/i)||(a.push(s[e].fullPath),r.push(t))}).fail(function(t){"dirctory"==t&&o.push(s[e])}).always(function(){d--,p>e&&(d++,u(++e))})};d++,u(0),d--}})},c=function(e,i){var n,c;s=[];for(var p=e.length,u=0;p>u;u++)c=i?e[u]:e[u].getAsEntry?e[u].getAsEntry():e[u].webkitGetAsEntry(),c.isFile?(a.push(""),r.push(t.files.items[u].getAsFile())):c.isDirectory&&(d>0?o.push(c):(d=0,n=c.createReader(),d++,l(n)))};return c(t.files.items),setTimeout(function v(){d>0?setTimeout(v,10):o.length>0?(c([o.shift()],!0),setTimeout(v,10)):n.resolve([r,a])},10),n.promise()}var p,u=[],h=t.files[0];if("html"==t.type){p=/]+src=["']?([^"'> ]+)/gi;for(var f,m=[],g="";m=p.exec(h);)g=m[1].replace(/&/g,"&"),g.match(/^http|data:/)&&-1==e.inArray(g,u)&&u.push(g);f=h.match(/<\/a>/i),f&&1==f.length&&(p=/]+href=["']?([^"'> ]+)((?:.|\s)+)<\/a>/i,(m=p.exec(h))&&(m[2].match(/"{}|\\^\[\]`\s]+)/gi;m=p.exec(h);)g=m[1].replace(/&/g,"&"),-1==e.inArray(g,u)&&u.push(g);return u},iframe:function(t,i){var n,r,a,o,s=i?i:this,d=t.input?t.input:!1,l=d?!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()}),p="iframe-"+s.namespace+ ++s.iframeCnt,u=e('
'),h=this.UA.IE,f=function(){o&&clearTimeout(o),a&&clearTimeout(a),r&&s.notify({type:"upload",cnt:-n}),setTimeout(function(){h&&e('