window.Finder=function(a,b){this.time("load");var c=this;a=$(a);var d=$("<div/>").append(a.contents()),e=a.attr("style"),g=a.attr("id")||"",f="finder-"+(g||Math.random().toString().substr(2,7)),h="mousedown."+f,k="keydown."+f,m="keypress."+f,l=!0,q=!0,p="",t={path:"",url:"",tmbUrl:"",disabled:[],separator:"/",archives:[],extract:[],copyOverwrite:!0,tmb:!1},n={},u=[],w={},y={},E=[],O=[],N=[],T=new c.command(c),B="auto",D=400,P,J=function(a){if(a.init)n={};else for(var b in n)n.hasOwnProperty(b)&&"directory"!=
n[b].mime&&n[b].phash==p&&-1===$.inArray(b,O)&&delete n[b];p=a.cwd.hash;F(a.files);n[p]||F([a.cwd]);c.lastDir(p)},F=function(a){for(var c=a.length,b;c--;)b=a[c],b.name&&b.hash&&b.mime&&(n[b.hash]=b)},H=new Date;this.OS=-1!==navigator.userAgent.indexOf("Mac")?"mac":-1!==navigator.userAgent.indexOf("Win")?"win":"other";this.UA=function(){var a=!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:a,Chrome:a&&window.chrome,Safari:a&&!window.chrome,Mobile:"undefined"!=typeof window.orientation}}();this.options=$.extend(!0,{},this._options,b||{});b.ui&&(this.options.ui=
b.ui);b.commands&&(this.options.commands=b.commands);b.uiOptions&&b.uiOptions.toolbar&&(this.options.uiOptions.toolbar=b.uiOptions.toolbar);$.extend(this.options.contextmenu,b.contextmenu);this.requestType=/^(get|post)$/i.test(this.options.requestType)?this.options.requestType.toLowerCase():"post";this.customData=$.isPlainObject(this.options.customData)?this.options.customData:{};this.id=g;this.uploadURL=b.urlUpload||b.url;this.namespace=f;this.lang=this.i18[this.options.lang]&&this.i18[this.options.lang].messages?
this.options.lang:"en";g="en"==this.lang?this.i18.en:$.extend(!0,{},this.i18.en,this.i18[this.lang]);this.direction=g.direction;this.messages=g.messages;this.dateFormat=this.options.dateFormat||g.dateFormat;this.fancyFormat=this.options.fancyDateFormat||g.fancyDateFormat;this.today=(new Date(H.getFullYear(),H.getMonth(),H.getDate())).getTime()/1E3;this.yesterday=this.today-86400;H=this.options.UTCDate?"UTC":"";this.getHours="get"+H+"Hours";this.getMinutes="get"+H+"Minutes";this.getSeconds="get"+H+
"Seconds";this.getDate="get"+H+"Date";this.getDay="get"+H+"Day";this.getMonth="get"+H+"Month";this.getFullYear="get"+H+"FullYear";this.cssClass="ui-helper-reset ui-helper-clearfix ui-widget ui-widget-content ui-corner-all finder finder-"+("rtl"==this.direction?"rtl":"ltr")+" "+this.options.cssClass;var v;try{v="localStorage"in window&&null!==window.localStorage?c.localStorage:c.cookie}catch(L){v=c.cookie}this.storage=v;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=$.extend(!0,{},this._sortRules,this.options.sortsRules);$.each(this.sortRules,function(a,b){"function"!=typeof b&&delete c.sortRules[a]});this.compare=$.proxy(this.compare,this);this.notifyDelay=0<
this.options.notifyDelay?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(a,c){c.helper.data("locked")||c.helper.toggleClass("finder-drag-helper-plus",a.shiftKey||a.ctrlKey||a.metaKey)},start:function(a,c){var b=$.map(c.helper.data("files")||[],function(a){return a||null}),d,e;for(d=b.length;d--;)if(e=b[d],n[e].locked){c.helper.addClass("finder-drag-helper-plus").data("locked",
!0);break}},stop:function(){c.trigger("focus").trigger("dragstop")},helper:function(a,b){var d=this.id?$(this):$(this).parents("[id]:first"),e=$('<div class="finder-drag-helper"><span class="finder-drag-helper-icon-plus"/></div>'),g=function(a){return'<div class="finder-cwd-icon '+c.mime2class(a)+' ui-corner-all"/>'},f;c.trigger("dragstart",{target:d[0],originalEvent:a});d=d.is("."+c.res("class","cwdfile"))?c.selected():[c.navId2Hash(d.attr("id"))];e.append(g(n[d[0]].mime)).data("files",d).data("locked",
!1);1<(f=d.length)&&e.append(g(n[d[f-1]].mime)+'<span class="finder-drag-num">'+f+"</span>");return e}};this.droppable={tolerance:"pointer",accept:".finder-cwd-file-wrapper,.finder-navbar-dir,.finder-cwd-file",hoverClass:this.res("class","adroppable"),drop:function(a,b){var d=$(this),e=$.map(b.helper.data("files")||[],function(a){return a||null}),g=[],f,k;d.is("."+c.res("class","cwd"))?f=p:d.is("."+c.res("class","cwdfile"))?f=d.attr("id"):d.is("."+c.res("class","navdir"))&&(f=c.navId2Hash(d.attr("id")));
for(d=e.length;d--;)k=e[d],k!=f&&n[k].phash!=f&&g.push(k);g.length&&(b.helper.hide(),c.clipboard(g,!(a.ctrlKey||a.shiftKey||a.metaKey||b.helper.data("locked"))),c.exec("paste",f),c.trigger("drop",{files:e}))}};this.enabled=function(){return a.is(":visible")&&l};this.visible=function(){return a.is(":visible")};this.root=function(a){for(a=n[a||p];a&&a.phash;)a=n[a.phash];if(a)return a.hash;for(;void 0 in n&&n.hasOwnProperty(void 0);)if(a=n[void 0],!a.phash&&"directory"==!a.mime&&a.read)return a.hash;
return""};this.cwd=function(){return n[p]||{}};this.option=function(a){return t[a]||""};this.file=function(a){return n[a]};this.files=function(){return $.extend(!0,{},n)};this.parents=function(a){for(var c=[];a=this.file(a);)c.unshift(a.hash),a=a.phash;return c};this.path2array=function(a){for(var c,b=[];a&&(c=n[a])&&c.hash;)b.unshift(c.name),a=c.phash;return b};this.path=function(a){return n[a]&&n[a].path?n[a].path:this.path2array(a).join(t.separator)};this.url=function(a){var c=n[a];if(!c||!c.read)return"";
if(c.url)return c.url;if(t.url)return t.url+$.map(this.path2array(a),function(a){return encodeURIComponent(a)}).slice(1).join("/");a=$.extend({},this.customData,{cmd:"file",target:c.hash});return this.options.url+(-1===this.options.url.indexOf("?")?"?":"&")+$.param(a,!0)};this.tmb=function(a){(a=(a=n[a])&&a.tmb&&1!=a.tmb?t.tmbUrl+a.tmb:"")&&(this.UA.Opera||this.UA.IE)&&(a+="?_="+(new Date).getTime());return a};this.selected=function(){return u.slice(0)};this.selectedFiles=function(){return $.map(u,
function(a){return n[a]?$.extend({},n[a]):null})};this.fileByName=function(a,c){for(var b in n)if(n.hasOwnProperty(b)&&n[b].phash==c&&n[b].name==a)return n[b]};this.validResponse=function(a,c){return c.error||this.rules[this.rules[a]?a:"defaults"](c)};this.request=function(a){var c=this,b=this.options,d=$.Deferred(),e=$.extend({},b.customData,{mimes:b.onlyMimes},a.data||a),g=e.cmd,f=!(a.preventDefault||a.preventFail),k=!(a.preventDefault||a.preventDone),h=$.extend({},a.notify),m=a.syncOnFail,l;a=
$.extend({url:b.url,async:!0,type:this.requestType,dataType:"json",cache:!1,data:e},a.options||{});var b=function(a){a.warning&&c.error(a.warning);"netmount"==g&&(g="open");"open"==g&&J($.extend(!0,{},a));a.removed&&a.removed.length&&c.remove(a);a.added&&a.added.length&&c.add(a);a.changed&&a.changed.length&&c.change(a);c.trigger(g,a);a.sync&&c.sync()},p;k&&d.done(b);d.fail(function(a){a&&(f?c.error(a):c.debug("error",c.i18n(a)))});if(!g)return d.reject("errCmdReq");m&&d.fail(function(a){a&&c.sync()});
h.type&&h.cnt&&(l=setTimeout(function(){c.notify(h);d.always(function(){h.cnt=-(parseInt(h.cnt)||0);c.notify(h)})},c.notifyDelay),d.always(function(){clearTimeout(l)}));if("open"==g)for(;k=N.pop();)"pending"==k.state()&&(k.quiet=!0,k.abort());delete a.preventFail;p=this.transport.send(a).fail(function(a,c){var b;switch(c){case "abort":b=a.quiet?"":["errConnect","errAbort"];break;case "timeout":b=["errConnect","errTimeout"];break;case "parsererror":b="";"string"==typeof a.responseText&&(b="Response: "+
a.responseText.substr(0,300));b=["errResponse","errDataNotJSON","",b];break;default:b=403==a.status?["errConnect","errAccess"]:404==a.status?["errConnect","errNotFound"]:"errConnect"}d.reject(b,a,c)}).done(function(a){if(a)if($.isPlainObject(a)){if(a.error)return d.reject(a.error,p);if(!c.validResponse(g,a))return d.reject("errResponse",p)}else return d.reject(["errResponse","errDataNotJSON"],p);else return d.reject(["errResponse","errDataEmpty"],p);a.options&&(t=$.extend({},t,a.options));a.netDrivers&&
(c.netDrivers=a.netDrivers);d.resolve(a);a.debug&&c.debug("backend-debug",a.debug)});"open"==g&&(N.unshift(p),d.always(function(){var a=$.inArray(p,N);-1!==a&&N.splice(a,1)}));return d};this.diff=function(a){var c={},b=[],d=[],e=[];$.each(a,function(a,b){c[b.hash]=b});$.each(n,function(a,b){!c[a]&&d.push(a)});$.each(c,function(a,c){var d=n[a];d?$.each(c,function(a){if(c[a]!=d[a])return e.push(c),!1}):b.push(c)});$.each(d,function(a,b){var g=n[b],f=g.phash;if(g=f&&"directory"==g.mime&&-1===$.inArray(f,
d)&&c[f]){a:{for(g=e.length;g--;)if(e[g].hash==f){g=!0;break a}g=void 0}g=!g}g&&e.push(c[f])});return{added:b,removed:d,changed:e}};this.sync=function(){var a=this,c=$.Deferred().done(function(){a.trigger("sync")}),b={data:{cmd:"open",init:1,target:p,tree:this.ui.tree?1:0},preventDefault:!0},d={data:{cmd:"tree",target:p==this.root()?p:this.file(p).phash},preventDefault:!0};$.when(this.request(b),this.request(d)).fail(function(b){c.reject(b);b&&a.request({data:{cmd:"open",target:a.lastDir(""),tree:1,
init:1},notify:{type:"open",cnt:1,hideCnt:!0}})}).done(function(b,d){var e=a.diff(b.files.concat(d&&d.tree?d.tree:[]));e.added.push(b.cwd);e.removed.length&&a.remove(e);e.added.length&&a.add(e);e.changed.length&&a.change(e);return c.resolve(e)});return c};this.upload=function(a){return this.transport.upload(a,this)};this.bind=function(a,c){var b;if("function"==typeof c)for(a=(""+a).toLowerCase().split(/\s+/),b=0;b<a.length;b++)void 0===w[a[b]]&&(w[a[b]]=[]),w[a[b]].push(c);return this};this.unbind=
function(a,c){var b=w[(""+a).toLowerCase()]||[],d=b.indexOf(c);-1<d&&b.splice(d,1);return this};this.trigger=function(a,c){a=a.toLowerCase();var b=w[a]||[],d;if(b.length)for(a=$.Event(a),d=0;d<b.length;d++){a.data=$.extend(!0,{},c);try{if(!1===b[d](a,this)||a.isDefaultPrevented()){this.debug("event-stoped",a.type);break}}catch(e){window.console&&window.console.log&&window.console.log(e)}}return this};this.shortcut=function(a){var c,b,d,e,g;if(this.options.allowShortcuts&&a.pattern&&$.isFunction(a.callback))for(c=
a.pattern.toUpperCase().split(/\s+/),e=0;e<c.length;e++)b=c[e],g=b.split("+"),(d=1==(d=g.pop()).length?0<d?d:d.charCodeAt(0):$.ui.keyCode[d])&&!y[b]&&(y[b]={keyCode:d,altKey:-1!=$.inArray("ALT",g),ctrlKey:-1!=$.inArray("CTRL",g),shiftKey:-1!=$.inArray("SHIFT",g),type:a.type||"keydown",callback:a.callback,description:a.description,pattern:b});return this};this.shortcuts=function(){var a=[];$.each(y,function(b,d){a.push([d.pattern,c.i18n(d.description)])});return a};this.clipboard=function(a,c){var b=
function(){return $.map(E,function(a){return a.hash})};void 0!==a&&(E.length&&this.trigger("unlockfiles",{files:b()}),O=[],E=$.map(a||[],function(a){var b=n[a];return b?(O.push(a),{hash:a,phash:b.phash,name:b.name,mime:b.mime,read:b.read,locked:b.locked,cut:!!c}):null}),this.trigger("changeclipboard",{clipboard:E.slice(0,E.length)}),c&&this.trigger("lockfiles",{files:b()}));return E.slice(0,E.length)};this.isCommandEnabled=function(a){return this._commands[a]?-1===$.inArray(a,t.disabled):!1};this.exec=
function(a,c,b){return this._commands[a]&&this.isCommandEnabled(a)?this._commands[a].exec(c,b):$.Deferred().reject("No such command")};this.dialog=function(c,b){return $("<div/>").append(c).appendTo(a).finderdialog(b)};this.getUI=function(c){return this.ui[c]||a};this.command=function(a){return void 0===a?this._commands:this._commands[a]};this.resize=function(c,b){a.css("width",c).height(b).trigger("resize");this.trigger("resize",{width:a.width(),height:a.height()})};this.restoreSize=function(){this.resize(B,
D)};this.show=function(){a.show();this.enable().trigger("show")};this.hide=function(){this.disable().trigger("hide");a.hide()};this.destroy=function(){a&&a[0].finder&&(this.trigger("destroy").disable(),w={},y={},$(document).add(a).unbind("."+this.namespace),c.trigger=function(){},a.children().remove(),a.append(d.contents()).removeClass(this.cssClass).attr("style",e),a[0].finder=null,P&&clearInterval(P))};if(!($.fn.selectable&&$.fn.draggable&&$.fn.droppable))return alert(this.i18n("errJqui"));if(!a.length)return alert(this.i18n("errNode"));
if(!this.options.url)return alert(this.i18n("errURL"));$.extend($.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 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(a){return $.ajax(a)});
"iframe"==this.transport.upload?this.transport.upload=$.proxy(this.uploads.iframe,this):"function"==typeof this.transport.upload?this.dragUpload=!!this.options.dragUploadAllow:this.xhrUpload?(this.transport.upload=$.proxy(this.uploads.xhr,this),this.dragUpload=!0):this.transport.upload=$.proxy(this.uploads.iframe,this);this.error=function(){var a=arguments[0];return 1==arguments.length&&"function"==typeof a?c.bind("error",a):c.trigger("error",{error:a})};$.each("enable disable load open reload select add remove change dblclick getfile lockfiles unlockfiles dragstart dragstop search searchend viewchange".split(" "),
function(a,b){c[b]=function(){var a=arguments[0];return 1==arguments.length&&"function"==typeof a?c.bind(b,a):c.trigger(b,$.isPlainObject(a)?a:{})}});this.enable(function(){!l&&c.visible()&&c.ui.overlay.is(":hidden")&&(l=!0,$("texarea:focus,input:focus,button").blur(),a.removeClass("finder-disabled"))}).disable(function(){q=l;l=!1;a.addClass("finder-disabled")}).open(function(){u=[]}).select(function(a){u=$.map(a.data.selected||a.data.value||[],function(a){return n[a]?a:null})}).error(function(a){var b=
{cssClass:"finder-dialog-error",title:c.i18n(c.i18n("error")),resizable:!1,destroyOnClose:!0,buttons:{}};b.buttons[c.i18n(c.i18n("btnClose"))]=function(){$(this).finderdialog("close")};c.dialog('<span class="finder-dialog-icon finder-dialog-icon-error"/>'+c.i18n(a.data.error),b)}).bind("tree parents",function(a){F(a.data.tree||[])}).bind("tmb",function(a){$.each(a.data.images||[],function(a,b){n[a]&&(n[a].tmb=b)})}).add(function(a){F(a.data.added||[])}).change(function(a){$.each(a.data.changed||[],
function(a,b){var c=b.hash;n[c]=n[c]?$.extend(n[c],b):b})}).remove(function(a){a=a.data.removed||[];for(var b=a.length,c=function(a){var b=n[a];b&&("directory"==b.mime&&b.dirs&&$.each(n,function(b,d){d.phash==a&&c(b)}),delete n[a])};b--;)c(a[b])}).bind("search",function(a){F(a.data.files)});$.each(this.options.handlers,function(a,b){c.bind(a,b)});this.history=new this.history(this);"function"==typeof this.options.getFileCallback&&this.commands.getfile&&(this.bind("dblclick",function(a){a.preventDefault();
c.exec("getfile").fail(function(){c.exec("open")})}),this.shortcut({pattern:"enter",description:this.i18n("cmdgetfile"),callback:function(){c.exec("getfile").fail(function(){c.exec("mac"==c.OS?"rename":"open")})}}).shortcut({pattern:"ctrl+enter",description:this.i18n("mac"==this.OS?"cmdrename":"cmdopen"),callback:function(){c.exec("mac"==c.OS?"rename":"open")}}));this._commands={};$.isArray(this.options.commands)||(this.options.commands=[]);$.each("open reload back forward up home info quicklook getfile help".split(" "),
function(a,b){-1===$.inArray(b,c.options.commands)&&c.options.commands.push(b)});$.each(this.options.commands,function(a,b){var d=c.commands[b];$.isFunction(d)&&!c._commands[b]&&(d.prototype=T,c._commands[b]=new d,c._commands[b].setup(b,c.options.commandsOptions[b]||{}))});a.addClass(this.cssClass).bind(h,function(){!l&&c.enable()});this.ui={workzone:$("<div/>").appendTo(a).finderworkzone(this),navbar:$("<div/>").appendTo(a).findernavbar(this,this.options.uiOptions.navbar||{}),contextmenu:$("<div/>").appendTo(a).findercontextmenu(this),
overlay:$("<div/>").appendTo(a).finderoverlay({show:function(){c.disable()},hide:function(){q&&c.enable()}}),cwd:$("<div/>").appendTo(a).findercwd(this,this.options.uiOptions.cwd||{}),notify:this.dialog("",{cssClass:"finder-dialog-notify",position:{top:"12px",right:"12px"},resizable:!1,autoOpen:!1,title:"&nbsp;",width:280}),statusbar:$('<div class="ui-widget-header ui-helper-clearfix ui-corner-bottom finder-statusbar"/>').hide().appendTo(a)};$.each(this.options.ui||[],function(b,d){var e="finder"+
d,g=c.options.uiOptions[d]||{};!c.ui[d]&&$.fn[e]&&(c.ui[d]=$("<"+(g.tag||"div")+"/>").appendTo(a)[e](c,g))});a[0].finder=this;this.options.resizable&&$.fn.resizable&&a.resizable({handles:"se",minWidth:300,minHeight:200});this.options.width&&(B=this.options.width);this.options.height&&(D=this.options.height);c.resize(B,D);$(document).bind("click."+this.namespace,function(b){l&&!$(b.target).closest(a).length&&c.disable()}).bind(k+" "+m,function(a){var b=a.keyCode,d=!(!a.ctrlKey&&!a.metaKey);l&&($.each(y,
function(e,g){g.type==a.type&&g.keyCode==b&&g.shiftKey==a.shiftKey&&g.ctrlKey==d&&g.altKey==a.altKey&&(a.preventDefault(),a.stopPropagation(),g.callback(a,c),c.debug("shortcut-exec",e+" : "+g.description))}),9!=b||$(a.target).is(":input")||a.preventDefault())});this.trigger("init").request({data:{cmd:"open",target:c.lastDir(),init:1,tree:this.ui.tree?1:0},preventDone:!0,notify:{type:"open",cnt:1,hideCnt:!0},freeze:!0}).fail(function(){c.trigger("fail").disable().lastDir("");w={};y={};$(document).add(a).unbind("."+
this.namespace);c.trigger=function(){}}).done(function(a){c.load();a=$.extend(!0,{},a);J(a);c.trigger("open",a)});this.one("load",function(){a.trigger("resize");1E3<c.options.sync&&(P=setInterval(function(){c.sync()},c.options.sync))})};
Finder.prototype={res:function(a,b){return this.resources[a]&&this.resources[a][b]},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".split(" "),monthsShort:"Jan Feb Mar Apr May Jun Jul Aug Sep Oct Nov Dec".split(" "),days:"Sunday Monday Tuesday Wednesday Thursday Friday Saturday".split(" "),daysShort:"Sun Mon Tue Wed Thu Fri Sat".split(" ")},
rules:{defaults:function(a){return!a||a.added&&!$.isArray(a.added)||a.removed&&!$.isArray(a.removed)||a.changed&&!$.isArray(a.changed)?!1:!0},open:function(a){return a&&a.cwd&&a.files&&$.isPlainObject(a.cwd)&&$.isArray(a.files)},tree:function(a){return a&&a.tree&&$.isArray(a.tree)},parents:function(a){return a&&a.tree&&$.isArray(a.tree)},tmb:function(a){return a&&a.images&&($.isPlainObject(a.images)||$.isArray(a.images))},upload:function(a){return a&&($.isPlainObject(a.added)||$.isArray(a.added))},
search:function(a){return a&&a.files&&$.isArray(a.files)}},commands:{},parseUploadData:function(a){var b;if(!$.trim(a))return{error:["errResponse","errDataEmpty"]};try{b=$.parseJSON(a)}catch(c){return{error:["errResponse","errDataNotJSON"]}}if(!this.validResponse("upload",b))return{error:["errResponse"]};b.removed=$.map(b.added||[],function(a){return a.hash});return b},iframeCnt:0,uploads:{iframe:function(a,b){var c=b?b:this,d=a.input,e=$.Deferred().fail(function(a){a&&c.error(a)}).done(function(a){a.warning&&
c.error(a.warning);a.removed&&c.remove(a);a.added&&c.add(a);a.changed&&c.change(a);c.trigger("upload",a);a.sync&&c.sync()}),g="iframe-"+c.namespace+ ++c.iframeCnt,f=$('<form action="'+c.uploadURL+'" method="post" enctype="multipart/form-data" encoding="multipart/form-data" target="'+g+'" style="display:none"><input type="hidden" name="cmd" value="upload" /></form>'),h=this.UA.IE,k=function(){t&&clearTimeout(t);p&&clearTimeout(p);q&&c.notify({type:"upload",cnt:-l});setTimeout(function(){h&&$('<iframe src="javascript:false;"/>').appendTo(f);
f.remove();m.remove()},100)},m=$('<iframe src="'+(h?"javascript:false;":"about:blank")+'" name="'+g+'" style="position:absolute;left:-1000px;top:-1000px" />').bind("load",function(){m.unbind("load").bind("load",function(){var a=c.parseUploadData(m.contents().text());k();a.error?e.reject(a.error):e.resolve(a)});p=setTimeout(function(){q=!0;c.notify({type:"upload",cnt:l})},c.options.notifyDelay);0<c.options.iframeTimeout&&(t=setTimeout(function(){k();e.reject([errors.connect,errors.timeout])},c.options.iframeTimeout));
f.submit()}),l,q,p,t;if(d&&$(d).is(":file")&&$(d).val())f.append(d);else return e.reject();l=d.files?d.files.length:1;f.append('<input type="hidden" name="target" value="'+c.cwd().hash+'"/>').append('<input type="hidden" name="html" value="1"/>').append($(d).attr("name","upload[]"));$.each(c.options.onlyMimes||[],function(a,b){f.append('<input type="hidden" name="mimes[]" value="'+b+'"/>')});$.each(c.options.customData,function(a,b){f.append('<input type="hidden" name="'+a+'" value="'+b+'"/>')});
f.appendTo("body");m.appendTo("body");return e},xhr:function(a,b){var c=b?b:this,d=$.Deferred().fail(function(a){a&&c.error(a)}).done(function(a){a.warning&&c.error(a.warning);a.removed&&c.remove(a);a.added&&c.add(a);a.changed&&c.change(a);c.trigger("upload",a);a.sync&&c.sync()}).always(function(){q&&clearTimeout(q);m&&c.notify({type:"upload",cnt:-h,progress:100*h})}),e=new XMLHttpRequest,g=new FormData,f=a.input?a.input.files:a.files,h=f.length,k=5,m=!1,l=function(){return setTimeout(function(){m=
!0;c.notify({type:"upload",cnt:h,progress:k*h})},c.options.notifyDelay)},q;if(!h)return d.reject();e.addEventListener("error",function(){d.reject("errConnect")},!1);e.addEventListener("abort",function(){d.reject(["errConnect","errAbort"])},!1);e.addEventListener("load",function(){var a=e.status;if(500<a)return d.reject("errResponse");if(200!=a)return d.reject("errConnect");if(4!=e.readyState)return d.reject(["errConnect","errTimeout"]);if(!e.responseText)return d.reject(["errResponse","errDataEmpty"]);
a=c.parseUploadData(e.responseText);a.error?d.reject(a.error):d.resolve(a)},!1);e.upload.addEventListener("progress",function(a){var b=k;a.lengthComputable&&(a=parseInt(100*a.loaded/a.total),0<a&&!q&&(q=l()),4<a-b&&(k=a,m&&c.notify({type:"upload",cnt:0,progress:(k-b)*h})))},!1);e.open("POST",c.uploadURL,!0);g.append("cmd","upload");g.append("target",c.cwd().hash);$.each(c.options.customData,function(a,b){g.append(a,b)});$.each(c.options.onlyMimes,function(a,b){g.append("mimes["+a+"]",b)});$.each(f,
function(a,b){g.append("upload[]",b)});e.onreadystatechange=function(){4==e.readyState&&0==e.status&&d.reject(["errConnect","errAbort"])};e.send(g);this.UA.Safari&&a.files||(q=l());return d}},one:function(a,b){var c=this,d=$.proxy(b,function(a){setTimeout(function(){c.unbind(a.type,d)},3);return b.apply(this,arguments)});return this.bind(a,d)},localStorage:function(a,b){var c=window.localStorage;a="finder-"+a+this.id;if(null===b)return c.removeItem(a);if(void 0!==b)try{c.setItem(a,b)}catch(d){c.clear(),
c.setItem(a,b)}return c.getItem(a)},cookie:function(a,b){var c,d;a="finder-"+a+this.id;if(void 0===b){if(document.cookie&&""!=document.cookie)for(c=document.cookie.split(";"),a+="=",d=0;d<c.length;d++)if(c[d]=$.trim(c[d]),c[d].substring(0,a.length)==a)return decodeURIComponent(c[d].substring(a.length));return""}d=$.extend({},this.options.cookie);null===b&&(b="",d.expires=-1);"number"==typeof d.expires&&(c=new Date,c.setTime(c.getTime()+864E5*d.expires),d.expires=c);document.cookie=a+"="+encodeURIComponent(b)+
"; expires="+d.expires.toUTCString()+(d.path?"; path="+d.path:"")+(d.domain?"; domain="+d.domain:"")+(d.secure?"; secure":"");return b},lastDir:function(a){return this.options.rememberLastDir?this.storage("lastdir",a):""},_node:$("<span/>"),escape:function(a){return this._node.text(a).html()},setSort:function(a,b,c){this.storage("sortType",this.sortType=this.sortRules[a]?a:"name");this.storage("sortOrder",this.sortOrder=/asc|desc/.test(b)?b:"asc");this.storage("sortStickFolders",(this.sortStickFolders=
!!c)?1:"");this.trigger("sortchange")},_sortRules:{name:function(a,b){return a.name.toLowerCase().localeCompare(b.name.toLowerCase())},size:function(a,b){var c=parseInt(a.size)||0,d=parseInt(b.size)||0;return c==d?0:c>d?1:-1},kind:function(a,b){return a.mime.localeCompare(b.mime)},date:function(a,b){var c=a.ts||a.date,d=b.ts||b.date;return c==d?0:c>d?1:-1}},compare:function(a,b){var c=this.sortType,d="asc"==this.sortOrder,e=this.sortRules,g=e[c],f="directory"==a.mime,h="directory"==b.mime;if(this.sortStickFolders){if(f&&
!h)return-1;if(!f&&h)return 1}g=d?g(a,b):g(b,a);return"name"!=c&&0==g?d?e.name(a,b):e.name(b,a):g},sortFiles:function(a){return a.sort(this.compare)},notify:function(a){var b=a.type,c=this.messages["ntf"+b]?this.i18n("ntf"+b):this.i18n("ntfsmth"),d=this.ui.notify,e=d.children(".finder-notify-"+b),g=a.cnt,f=0<=a.progress&&100>=a.progress?a.progress:0,h;if(!b)return this;e.length||(e=$('<div class="finder-notify finder-notify-{type}"><span class="finder-dialog-icon finder-dialog-icon-{type}"/><span class="finder-notify-msg">{msg}</span> <span class="finder-notify-cnt"/><div class="finder-notify-progressbar"><div class="finder-notify-progress"/></div></div>'.replace(/\{type\}/g,
b).replace(/\{msg\}/g,c)).appendTo(d).data("cnt",0),f&&e.data({progress:0,total:0}));b=g+parseInt(e.data("cnt"));0<b?(!a.hideCnt&&e.children(".finder-notify-cnt").text("("+b+")"),d.is(":hidden")&&d.finderdialog("open"),e.data("cnt",b),100>f&&0<=e.data("total")&&0<=(h=e.data("progress"))&&(a=g+parseInt(e.data("total")),h=f+h,f=parseInt(h/a),e.data({progress:h,total:a}),d.find(".finder-notify-progress").animate({width:(100>f?f:100)+"%"},20))):(e.remove(),!d.children().length&&d.finderdialog("close"));
return this},confirm:function(a){var b=!1,c={cssClass:"finder-dialog-confirm",modal:!0,resizable:!1,title:this.i18n(a.title||"confirmReq"),buttons:{},close:function(){!b&&a.cancel.callback();$(this).finderdialog("destroy")}},d=this.i18n("apllyAll"),e;a.reject&&(c.buttons[this.i18n(a.reject.label)]=function(){a.reject.callback(!(!e||!e.prop("checked")));b=!0;$(this).finderdialog("close")});c.buttons[this.i18n(a.accept.label)]=function(){a.accept.callback(!(!e||!e.prop("checked")));b=!0;$(this).finderdialog("close")};
c.buttons[this.i18n(a.cancel.label)]=function(){$(this).finderdialog("close")};a.all&&(a.reject&&(c.width=370),c.create=function(){e=$('<input type="checkbox" />');$(this).next().children().before($("<label>"+d+"</label>").prepend(e))},c.open=function(){var a=$(this).next(),b=parseInt(a.children(":first").outerWidth()+a.children(":last").outerWidth());b>parseInt(a.width())&&$(this).closest(".finder-dialog").width(b+30)});return this.dialog('<span class="finder-dialog-icon finder-dialog-icon-confirm"/>'+
this.i18n(a.text),c)},uniqueName:function(a,b){var c=0,d="",e;a=this.i18n(a);b=b||this.cwd().hash;-1!=(e=a.indexOf(".txt"))&&(d=".txt",a=a.substr(0,e));e=a+d;if(!this.fileByName(e,b))return e;for(;1E4>c;)if(e=a+" "+ ++c+d,!this.fileByName(e,b))return e;return a+Math.random()+d},i18n:function(){var a=this,b=this.messages,c=[],d=[],e=function(b){var c;return 0===b.indexOf("#")&&(c=a.file(b.substr(1)))?c.name:b},g,f,h;for(g=0;g<arguments.length;g++)if(h=arguments[g],"string"==typeof h)c.push(e(h));else if($.isArray(h))for(f=
0;f<h.length;f++)"string"==typeof h[f]&&c.push(e(h[f]));for(g=0;g<c.length;g++)-1===$.inArray(g,d)&&(h=c[g],h=b[h]||h,h=h.replace(/\$(\d+)/g,function(a,b){b=g+parseInt(b);0<b&&c[b]&&d.push(b);return c[b]||""}),c[g]=h);return $.map(c,function(a,b){return-1===$.inArray(b,d)?a:null}).join("<br>")},formatDate:function(a,b){var c=this;b=b||a.ts;var d=c.i18,e,g,f,h,k,m,l,q,p;return c.options.clientFormatDate&&0<b?(e=new Date(1E3*b),m=e[c.getHours](),l=12<m?m-12:m,q=e[c.getMinutes](),p=e[c.getSeconds](),
g=e[c.getDate](),f=e[c.getDay](),h=e[c.getMonth]()+1,k=e[c.getFullYear](),e=b>=this.yesterday?this.fancyFormat:this.dateFormat,e=e.replace(/[a-z]/gi,function(a){switch(a){case "d":return 9<g?g:"0"+g;case "j":return g;case "D":return c.i18n(d.daysShort[f]);case "l":return c.i18n(d.days[f]);case "m":return 9<h?h:"0"+h;case "n":return h;case "M":return c.i18n(d.monthsShort[h-1]);case "F":return c.i18n(d.months[h-1]);case "Y":return k;case "y":return(""+k).substr(2);case "H":return 9<m?m:"0"+m;case "G":return m;
case "g":return l;case "h":return 9<l?l:"0"+l;case "a":return 12<m?"pm":"am";case "A":return 12<m?"PM":"AM";case "i":return 9<q?q:"0"+q;case "s":return 9<p?p:"0"+p}return a}),b>=this.yesterday?e.replace("$1",this.i18n(b>=this.today?"Today":"Yesterday")):e):a.date?a.date.replace(/([a-z]+)\s/i,function(a,b){return c.i18n(b)+" "}):c.i18n("dateUnknown")},perms2class:function(a){var b="";a.read||a.write?a.read?a.write||(b="finder-ro"):b="finder-wo":b="finder-na";return b},formatPermissions:function(a){var b=
[];a.read&&b.push(this.i18n("read"));a.write&&b.push(this.i18n("write"));return b.length?b.join(" "+this.i18n("and")+" "):this.i18n("noaccess")},formatSize:function(a){var b=1,c="b";if("unknown"==a)return this.i18n("unknown");1073741824<a?(b=1073741824,c="GB"):1048576<a?(b=1048576,c="MB"):1024<a&&(b=1024,c="KB");a/=b;return(0<a?1048576<=b?a.toFixed(2):Math.round(a):0)+" "+c},navHash2Id:function(a){return"nav-"+a},navId2Hash:function(a){return"string"==typeof a?a.substr(4):!1},log:function(a){window.console&&
window.console.log&&window.console.log(a);return this},debug:function(a,b){var c=this.options.debug;("all"==c||!0===c||$.isArray(c)&&-1!=$.inArray(a,c))&&window.console&&window.console.log&&window.console.log("finder debug: ["+a+"] ["+this.id+"]",b);return this},time:function(a){window.console&&window.console.time&&window.console.time(a)},timeEnd:function(a){window.console&&window.console.timeEnd&&window.console.timeEnd(a)}};Finder.prototype.version="2.2.1";
$.fn.finder=function(a){return"instance"==a?this.getFinder():this.each(function(){var b="string"==typeof a?a:"";this.finder||new Finder(this,"object"==typeof a?a:{});switch(b){case "close":case "hide":this.finder.hide();break;case "open":case "show":this.finder.show();break;case "destroy":this.finder.destroy()}})};$.fn.getFinder=function(){var a;this.each(function(){if(this.finder)return a=this.finder,!1});return a};
Finder.prototype._options={url:"",requestType:"post",transport:{},urlUpload:"",dragUploadAllow:"auto",iframeTimeout:0,customData:{},handlers:{},lang:"en",cssClass:"",commands:"open reload home up back forward getfile quicklook download rm duplicate rename mkdir mkfile upload copy cut paste edit extract archive search info view help resize sort netmount unmount".split(" "),commandsOptions:{getfile:{multiple:!1,folders:!1,oncomplete:""},upload:{ui:"uploadbutton"},quicklook:{autoplay:!0,jplayer:"extensions/jplayer"},
edit:{mimes:[],editors:[]},help:{view:["about","shortcuts","help"]}},getFileCallback:null,defaultView:"icons",ui:["toolbar","places","tree","path","stat"],uiOptions:{toolbar:[["back","forward","up","reload"],["home","netmount"],["mkdir","mkfile","upload"],["open","download","getfile"],["info","quicklook"],["copy","cut","paste"],["rm"],["duplicate","rename","edit","resize"],["extract","archive"],["view","sort"],["help"],["search"]],tree:{openRootOnLoad:!0,syncTree:!0},navbar:{minWidth:150,maxWidth:500},
cwd:{oldSchool:!1}},onlyMimes:[],sortRules:{},sortType:"name",sortOrder:"asc",sortStickFolders:!0,clientFormatDate:!0,UTCDate:!1,dateFormat:"",fancyDateFormat:"",width:"auto",height:400,resizable:!0,notifyDelay:500,allowShortcuts:!0,rememberLastDir:!0,showFiles:30,showThreshold:50,validName:!1,sync:0,loadTmbs:5,cookie:{expires:30,domain:"",path:"/",secure:!1},contextmenu:{navbar:"open | copy cut paste duplicate | rm | info | unmount".split(" "),cwd:"reload back | upload mkdir mkfile paste | sort | info".split(" "),
files:"getfile | open quicklook | download | copy cut paste duplicate | rm | edit rename resize | archive extract | info".split(" ")},debug:["error","warning","event-destroy"]};
Finder.prototype.history=function(a){var b=this,c=!0,d=[],e,g=function(){d=[a.cwd().hash];e=0;c=!0},f=function(f){return f&&b.canForward()||!f&&b.canBack()?(c=!1,a.exec("open",d[f?++e:--e]).fail(g)):$.Deferred().reject()};this.canBack=function(){return 0<e};this.canForward=function(){return e<d.length-1};this.back=f;this.forward=function(){return f(!0)};a.open(function(b){b=d.length;var g=a.cwd().hash;c&&(0<=e&&b>e+1&&d.splice(e+1),d[d.length-1]!=g&&d.push(g),e=d.length-1);c=!0}).reload(g)};
Finder.prototype.command=function(a){this.fm=a;this.title=this.name="";this.state=-1;this.disableOnSearch=this._disabled=this.alwaysEnabled=!1;this.updateOnSelect=!0;this._handlers={enable:function(){this.update(void 0,this.value)},disable:function(){this.update(-1,this.value)},"open reload load":function(a){this._disabled=!(this.alwaysEnabled||this.fm.isCommandEnabled(this.name));this.update(void 0,this.value);this.change()}};this.handlers={};this.shortcuts=[];this.options={ui:"button"};this.setup=
function(a,c){var d=this,e=this.fm,g,f;this.name=a;this.title=e.messages["cmd"+a]?e.i18n("cmd"+a):a;this.options=$.extend({},this.options,c);this.listeners=[];this.updateOnSelect&&(this._handlers.select=function(){this.update(void 0,this.value)});$.each($.extend({},d._handlers,d.handlers),function(a,b){e.bind(a,$.proxy(b,d))});for(g=0;g<this.shortcuts.length;g++)f=this.shortcuts[g],f.callback=$.proxy(f.callback||function(){this.exec()},this),!f.description&&(f.description=this.title),e.shortcut(f);
this.disableOnSearch&&e.bind("search searchend",function(a){d._disabled="search"==a.type;d.update(void 0,d.value)});this.init()};this.init=function(){};this.exec=function(a,c){return $.Deferred().reject()};this.disabled=function(){return 0>this.state};this.enabled=function(){return-1<this.state};this.active=function(){return 0<this.state};this.getstate=function(){return-1};this.update=function(a,c){var d=this.state,e=this.value;this.state=this._disabled?-1:void 0!==a?a:this.getstate();this.value=
c;d==this.state&&e==this.value||this.change()};this.change=function(a){var c;if("function"===typeof a)this.listeners.push(a);else for(c=0;c<this.listeners.length;c++){a=this.listeners[c];try{a(this.state,this.value)}catch(d){this.fm.debug("error",d)}}return this};this.hashes=function(b){return b?$.map($.isArray(b)?b:[b],function(b){return a.file(b)?b:null}):a.selected()};this.files=function(a){var c=this.fm;return a?$.map($.isArray(a)?a:[a],function(a){return c.file(a)||null}):c.selectedFiles()}};
Finder.prototype.resources={"class":{hover:"ui-state-hover",active:"ui-state-active",disabled:"ui-state-disabled",draggable:"ui-draggable",droppable:"ui-droppable",adroppable:"finder-droppable-active",cwdfile:"finder-cwd-file",cwd:"finder-cwd",tree:"finder-tree",treeroot:"finder-navbar-root",navdir:"finder-navbar-dir",navdirwrap:"finder-navbar-dir-wrapper",navarrow:"finder-navbar-arrow",navsubtree:"finder-navbar-subtree",navcollapse:"finder-navbar-collapsed",navexpand:"finder-navbar-expanded",treedir:"finder-tree-dir",
placedir:"finder-place-dir",searchbtn:"finder-button-search"},tpl:{perms:'<span class="finder-perms"/>',symlink:'<span class="finder-symlink"/>',navicon:'<span class="finder-nav-icon"/>',navspinner:'<span class="finder-navbar-spinner"/>',navdir:'<div class="finder-navbar-wrapper"><span id="{id}" class="ui-corner-all finder-navbar-dir {cssclass}"><span class="finder-navbar-arrow"/><span class="finder-navbar-icon"/>{symlink}{permissions}{name}</span><div class="finder-navbar-subtree"/></div>'},mimes:{text:"application/x-empty application/javascript application/xhtml+xml audio/x-mp3-playlist application/x-web-config application/docbook+xml application/x-php application/x-perl application/x-awk application/x-config application/x-csh application/xml".split(" ")},
mixin:{make:function(){var a=this.fm,b=this.name,c=a.getUI("cwd"),d=$.Deferred().fail(function(b){c.trigger("unselectall");b&&a.error(b)}).always(function(){k.remove();h.remove();a.enable()}),e="tmp_"+parseInt(1E5*Math.random()),g=a.cwd().hash,f=new Date,f={hash:e,name:a.uniqueName(this.prefix),mime:this.mime,read:!0,write:!0,date:"Today "+f.getHours()+":"+f.getMinutes()},h=c.trigger("create."+a.namespace,f).find("#"+e),k=$('<input type="text"/>').keydown(function(a){a.stopImmediatePropagation();
a.keyCode==$.ui.keyCode.ESCAPE?d.reject():a.keyCode==$.ui.keyCode.ENTER&&k.blur()}).mousedown(function(a){a.stopPropagation()}).blur(function(){var c=$.trim(k.val()),f=k.parent();if(f.length){if(!c)return d.reject("errInvName");if(a.fileByName(c,g))return d.reject(["errExists",c]);f.html(a.escape(c));a.lockfiles({files:[e]});a.request({data:{cmd:b,name:c,target:g},notify:{type:b,cnt:1},preventFail:!0,syncOnFail:!0}).fail(function(a){d.reject(a)}).done(function(a){d.resolve(a)})}});if(this.disabled()||
!h.length)return d.reject();a.disable();h.find(".finder-cwd-filename").empty("").append(k.val(f.name));k.select().focus();return d}}};
Finder.prototype.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"};Finder.prototype.mime2kind=function(a){var b="object"==typeof a?a.mime:a;a=a.alias?"Alias":this.kinds[b]?this.kinds[b]:0===b.indexOf("text")?"Text":0===b.indexOf("image")?"Image":0===b.indexOf("audio")?"Audio":0===b.indexOf("video")?"Video":0===b.indexOf("application")?"App":b;return this.messages["kind"+a]?this.i18n("kind"+a):b};
Finder.prototype.mime2class=function(a){a=a.split("/");return"finder-cwd-icon-"+a[0]+("image"!=a[0]&&a[1]?" finder-cwd-icon-"+a[1].replace(/(\.|\+)/g,"-"):"")};
$.fn.dialogfinder=function(a){this.not(".finder").each(function(){$(document);var b=$('<div class="ui-widget-header dialogfinder-drag ui-corner-top">'+(a.title||"Files")+"</div>");$('<a href="#" class="dialogfinder-drag-close ui-corner-all"><span class="ui-icon ui-icon-closethick"/></a>').appendTo(b).click(function(a){a.preventDefault();c.dialogfinder("close")});var c=$(this).addClass("dialogfinder").css("position","absolute").hide().appendTo("body").draggable({handle:".dialogfinder-drag"}).finder(a).prepend(b);
c.finder("instance");c.width(parseInt(c.width())||840).data("finderDestroyOnClose",!!a.destroyOnClose).find(".finder-toolbar").removeClass("ui-corner-top");a.position&&c.data("finderPosition",a.position);!1!==a.autoOpen&&$(this).dialogfinder("open")});if("open"==a){var b=$(this),c=b.data("finderPosition")||{top:parseInt($(document).scrollTop()+($(window).height()<b.height()?2:($(window).height()-b.height())/2)),left:parseInt($(document).scrollLeft()+($(window).width()<b.width()?2:($(window).width()-
b.width())/2))},d=100;b.is(":hidden")&&($("body").find(":visible").each(function(){var a=$(this),c;this!==b[0]&&"absolute"==a.css("position")&&(c=parseInt(a.zIndex()))>d&&(d=c+1)}),b.zIndex(d).css(c).show().trigger("resize"),setTimeout(function(){b.trigger("resize").mousedown()},200))}else if("close"==a)b=$(this),b.is(":visible")&&(b.data("finderDestroyOnClose")?b.finder("destroy").remove():b.finder("close"));else if("instance"==a)return $(this).getFinder();return this};
Finder&&Finder.prototype&&"object"==typeof Finder.prototype.i18&&(Finder.prototype.i18.en={translator:"Troex Nevelin &lt;troex@fury.scancode.ru&gt;",language:"English",direction:"ltr",dateFormat:"M d, Y h:i A",fancyDateFormat:"$1 h:i A",messages:{error:"Error",errUnknown:"Unknown error.",errUnknownCmd:"Unknown command.",errJqui:"Invalid jQuery UI configuration. Selectable, draggable and droppable components must be included.",errNode:"gpFinder requires DOM Element to be created.",errURL:"Invalid gpFinder configuration! URL option is not set.",
errAccess:"Access denied.",errConnect:"Unable to connect to backend.",errAbort:"Connection aborted.",errTimeout:"Connection timeout.",errNotFound:"Backend not found.",errResponse:"Invalid backend response.",errConf:"Invalid backend configuration.",errJSON:"PHP JSON module not installed.",errNoVolumes:"Readable volumes not available.",errCmdParams:'Invalid parameters for command "$1".',errDataNotJSON:"Data is not JSON.",errDataEmpty:"Data is empty.",errCmdReq:"Backend request requires command name.",
errOpen:'Unable to open "$1".',errNotFolder:"Object is not a folder.",errNotFile:"Object is not a file.",errRead:'Unable to read "$1".',errWrite:'Unable to write into "$1".',errPerm:"Permission denied.",errLocked:'"$1" is locked and can not be renamed, moved or removed.',errExists:'File named "$1" already exists.',errInvName:"Invalid file name.",errFolderNotFound:"Folder not found.",errFileNotFound:"File not found.",errTrgFolderNotFound:'Target folder "$1" not found.',errPopup:"Browser prevented opening popup window. To open file enable it in browser options.",
errMkdir:'Unable to create folder "$1".',errMkfile:'Unable to create file "$1".',errRename:'Unable to rename "$1".',errCopyFrom:'Copying files from volume "$1" not allowed.',errCopyTo:'Copying files to volume "$1" not allowed.',errUpload:"Upload error.",errUploadFile:'Unable to upload "$1".',errUploadNoFiles:"No files found for upload.",errUploadTotalSize:"Data exceeds the maximum allowed size.",errUploadFileSize:"File exceeds maximum allowed size.",errUploadMime:"File type not allowed.",errUploadTransfer:'"$1" transfer error.',
errNotReplace:'Object "$1" already exists at this location and can not be replaced by object with another type.',errReplace:'Unable to replace "$1".',errSave:'Unable to save "$1".',errCopy:'Unable to copy "$1".',errMove:'Unable to move "$1".',errCopyInItself:'Unable to copy "$1" into itself.',errRm:'Unable to remove "$1".',errRmSrc:"Unable remove source file(s).",errExtract:'Unable to extract files from "$1".',errArchive:"Unable to create archive.",errArcType:"Unsupported archive type.",errNoArchive:"File is not archive or has unsupported archive type.",
errCmdNoSupport:"Backend does not support this command.",errReplByChild:"The folder \u201c$1\u201d can\u2019t be replaced by an item it contains.",errArcSymlinks:"For security reason denied to unpack archives contains symlinks or files with not allowed names.",errArcMaxSize:"Archive files exceeds maximum allowed size.",errResize:'Unable to resize "$1".',errUsupportType:"Unsupported file type.",errNotUTF8Content:'File "$1" is not in UTF-8 and cannot be edited.',errNetMount:'Unable to mount "$1".',
errNetMountNoDriver:"Unsupported protocol.",errNetMountFailed:"Mount failed.",errNetMountHostReq:"Host required.",cmdarchive:"Create archive",cmdback:"Back",cmdcopy:"Copy",cmdcut:"Cut",cmddownload:"Download",cmdduplicate:"Duplicate",cmdedit:"Edit file",cmdextract:"Extract files from archive",cmdforward:"Forward",cmdgetfile:"Select files",cmdhelp:"About this software",cmdhome:"Home",cmdinfo:"Get info",cmdmkdir:"New folder",cmdmkfile:"New text file",cmdopen:"Open",cmdpaste:"Paste",cmdquicklook:"Preview",
cmdreload:"Reload",cmdrename:"Rename",cmdrm:"Delete",cmdsearch:"Find files",cmdup:"Go to parent directory",cmdupload:"Upload files",cmdview:"View",cmdresize:"Resize & Rotate",cmdsort:"Sort",cmdnetmount:"Mount network volume",btnClose:"Close",btnSave:"Save",btnRm:"Remove",btnApply:"Apply",btnCancel:"Cancel",btnNo:"No",btnYes:"Yes",btnMount:"Mount",ntfopen:"Open folder",ntffile:"Open file",ntfreload:"Reload folder content",ntfmkdir:"Creating directory",ntfmkfile:"Creating files",ntfrm:"Delete files",
ntfcopy:"Copy files",ntfmove:"Move files",ntfprepare:"Prepare to copy files",ntfrename:"Rename files",ntfupload:"Uploading files",ntfdownload:"Downloading files",ntfsave:"Save files",ntfarchive:"Creating archive",ntfextract:"Extracting files from archive",ntfsearch:"Searching files",ntfresize:"Resizing images",ntfsmth:"Loading",ntfloadimg:"Loading image",ntfnetmount:"Mounting network volume",dateUnknown:"unknown",Today:"Today",Yesterday:"Yesterday",Jan:"Jan",Feb:"Feb",Mar:"Mar",Apr:"Apr",May:"May",
Jun:"Jun",Jul:"Jul",Aug:"Aug",Sep:"Sep",Oct:"Oct",Nov:"Nov",Dec:"Dec",sortname:"by name",sortkind:"by kind",sortsize:"by size",sortdate:"by date",sortFoldersFirst:"Folders first",confirmReq:"Confirmation required",confirmRm:"Are you sure you want to remove files?<br/>This cannot be undone!",confirmRepl:"Replace old file with new one?",apllyAll:"Apply to all",name:"Name",size:"Size",perms:"Permissions",modify:"Modified",kind:"Kind",read:"read",write:"write",noaccess:"no access",and:"and",unknown:"unknown",
selectall:"Select all files",selectfiles:"Select file(s)",selectffile:"Select first file",selectlfile:"Select last file",viewlist:"List view",viewicons:"Icons view",places:"Places",calc:"Calculate",path:"Path",aliasfor:"Alias for",locked:"Locked",dim:"Dimensions",files:"Files",folders:"Folders",items:"Items",yes:"yes",no:"no",link:"Link",searcresult:"Search results",selected:"selected items",about:"About",shortcuts:"Shortcuts",help:"Help",webfm:"Web file manager",ver:"Version",homepage:"Project home",
docs:"Documentation",github:"Fork us on Github",twitter:"Follow us on twitter",facebook:"Join us on facebook",team:"Team",chiefdev:"chief developer",developer:"developer",contributor:"contributor",maintainer:"maintainer",translator:"translator",icons:"Icons",dontforget:"and don't forget to take your towel",shortcutsof:"Shortcuts disabled",dropFiles:"Drop files here",or:"or",selectForUpload:"Select files to upload",moveFiles:"Move files",copyFiles:"Copy files",rmFromPlaces:"Remove from places",aspectRatio:"Aspect ratio",
scale:"Scale",width:"Width",height:"Height",resize:"Resize",crop:"Crop",rotate:"Rotate","rotate-cw":"Rotate 90 degrees CW","rotate-ccw":"Rotate 90 degrees CCW",degree:"\u00b0",netMountDialogTitle:"Mount network volume",protocol:"Protocol",host:"Host",port:"Port",user:"User",pass:"Password",kindUnknown:"Unknown",kindFolder:"Folder",kindAlias:"Alias",kindAliasBroken:"Broken alias",kindApp:"Application",kindPostscript:"Postscript document",kindMsOffice:"Microsoft Office document",kindMsWord:"Microsoft Word document",
kindMsExcel:"Microsoft Excel document",kindMsPP:"Microsoft Powerpoint presentation",kindOO:"Open Office document",kindAppFlash:"Flash application",kindPDF:"Portable Document Format (PDF)",kindTorrent:"Bittorrent file",kind7z:"7z archive",kindTAR:"TAR archive",kindGZIP:"GZIP archive",kindBZIP:"BZIP archive",kindZIP:"ZIP archive",kindRAR:"RAR archive",kindJAR:"Java JAR file",kindTTF:"True Type font",kindOTF:"Open Type font",kindRPM:"RPM package",kindText:"Text document",kindTextPlain:"Plain text",kindPHP:"PHP source",
kindCSS:"Cascading style sheet",kindHTML:"HTML document",kindJS:"Javascript source",kindRTF:"Rich Text Format",kindC:"C source",kindCHeader:"C header source",kindCPP:"C++ source",kindCPPHeader:"C++ header source",kindShell:"Unix shell script",kindPython:"Python source",kindJava:"Java source",kindRuby:"Ruby source",kindPerl:"Perl script",kindSQL:"SQL source",kindXML:"XML document",kindAWK:"AWK source",kindCSV:"Comma separated values",kindDOCBOOK:"Docbook XML document",kindImage:"Image",kindBMP:"BMP image",
kindJPEG:"JPEG image",kindGIF:"GIF Image",kindPNG:"PNG Image",kindTIFF:"TIFF image",kindTGA:"TGA image",kindPSD:"Adobe Photoshop image",kindXBITMAP:"X bitmap image",kindPXM:"Pixelmator image",kindAudio:"Audio media",kindAudioMPEG:"MPEG audio",kindAudioMPEG4:"MPEG-4 audio",kindAudioMIDI:"MIDI audio",kindAudioOGG:"Ogg Vorbis audio",kindAudioWAV:"WAV audio",AudioPlaylist:"MP3 playlist",kindVideo:"Video media",kindVideoDV:"DV movie",kindVideoMPEG:"MPEG movie",kindVideoMPEG4:"MPEG-4 movie",kindVideoAVI:"AVI movie",
kindVideoMOV:"Quick Time movie",kindVideoWM:"Windows Media movie",kindVideoFlash:"Flash movie",kindVideoMKV:"Matroska movie",kindVideoOGG:"Ogg movie"}});"use strict";
$.fn.finderbutton=function(a){return this.each(function(){var b=a.fm,c=b.res("class","disabled"),d=b.res("class","active"),e=b.res("class","hover"),g,f=$(this).addClass("ui-state-default finder-button").attr("title",a.title).append('<span class="finder-button-icon finder-button-icon-'+a.name+'"/>').hover(function(a){!f.is("."+c)&&f["mouseleave"==a.type?"removeClass":"addClass"](e)}).click(function(b){f.is("."+c)||(g&&1<a.variants.length?(g.is(":hidden")&&a.fm.getUI().click(),b.stopPropagation(),g.slideToggle(100)):
a.exec())}),b=function(){g.hide()};$.isArray(a.variants)&&(f.addClass("finder-menubutton"),g=$('<div class="ui-widget ui-widget-content finder-button-menu ui-corner-all"/>').hide().appendTo(f).zIndex(12+f.zIndex()).delegate(".finder-button-menu-item",{"mouseenter mouseleave":function(){$(this).toggleClass(e)},click:function(b){b.preventDefault();b.stopPropagation();f.removeClass(e);a.exec(a.fm.selected(),$(this).data("value"))}}),a.fm.bind("disable select",b).getUI().click(b),a.change(function(){g.html("");
$.each(a.variants,function(b,c){$('<div class="finder-button-menu-item">'+c[1]+"</div>").data("value",c[0]).addClass(c[0]==a.value?"finder-button-menu-item-selected":"").appendTo(g)})}));a.change(function(){a.disabled()?f.removeClass(d+" "+e).addClass(c):(f.removeClass(c),f[a.active()?"addClass":"removeClass"](d))}).change()})};"use strict";
$.fn.findercontextmenu=function(a){return this.each(function(){var b=$(this).addClass("ui-helper-reset ui-widget ui-state-default ui-corner-all finder-contextmenu finder-contextmenu-"+a.direction).hide().appendTo("body").delegate(".finder-contextmenu-item","mouseenter mouseleave",function(){$(this).toggleClass("ui-state-hover")}),c="ltr"==a.direction?"left":"right",d=$.extend({},a.options.contextmenu),e=function(a,b,c){return $('<div class="finder-contextmenu-item"><span class="finder-button-icon {icon} finder-contextmenu-icon"/><span>{label}</span></div>'.replace("{icon}",
b?"finder-button-icon-"+b:"").replace("{label}",a)).click(function(a){a.stopPropagation();a.stopPropagation();c()})},g=function(){b.hide().empty()},f=function(c,f){var h=!1;$.each(d[c]||[],function(c,d){var k,n,u;if("|"==d&&h)b.append('<div class="finder-contextmenu-separator"/>'),h=!1;else if((k=a.command(d))&&-1!=k.getstate(f)){if(k.variants){if(!k.variants.length)return;n=e(k.title,k.name,function(){});u=$('<div class="ui-corner-all finder-contextmenu-sub"/>').appendTo(n.append('<span class="finder-contextmenu-arrow"/>'));
n.addClass("finder-contextmenu-group").hover(function(){u.toggle()});$.each(k.variants,function(a,b){u.append($('<div class="finder-contextmenu-item"><span>'+b[1]+"</span></div>").click(function(a){a.stopPropagation();g();k.exec(f,b[0])}))})}else n=e(k.title,k.name,function(){g();k.exec(f)});b.append(n);h=!0}})},h=function(a){$.each(a,function(a,c){var d;c.label&&"function"==typeof c.callback&&(d=e(c.label,c.icon,function(){g();c.callback()}),b.append(d))})};a.one("load",function(){a.bind("contextmenu",
function(d){var e=d.data;g();e.type&&e.targets?f(e.type,e.targets):e.raw&&h(e.raw);if(b.children().length){d=e.x;var e=e.y,l=$(window),q=b.outerWidth(),p=b.outerHeight(),t=l.width(),n=l.height(),u=l.scrollTop(),l=l.scrollLeft();d={top:(e+p<n?e:0<e-p?e-p:e)+u,left:(d+q<t?d:d-q)+l,"z-index":100+a.getUI("workzone").zIndex()};b.css(d).show();d={"z-index":d["z-index"]+10};d[c]=parseInt(b.width());b.find(".finder-contextmenu-sub").css(d)}}).one("destroy",function(){b.remove()}).bind("disable select",g).getUI().click(g)})})};
"use strict";
$.fn.findercwd=function(a,b){this.not(".finder-cwd").each(function(){var c="list"==a.viewType,d="select."+a.namespace,e="unselect."+a.namespace,g="disable."+a.namespace,f="enable."+a.namespace,h=a.res("class","cwdfile"),k="."+h,m=a.res("class","disabled"),l=a.res("class","draggable"),q=a.res("class","droppable"),p=a.res("class","hover"),t=a.res("class","adroppable"),n=h+"-tmp",u=0<a.options.loadTmbs?a.options.loadTmbs:5,w="",y=[],E={icon:'<div id="{hash}" class="'+h+' {permsclass} {dirclass} ui-corner-all" title="{tooltip}"><div class="finder-cwd-file-wrapper ui-corner-all"><div class="finder-cwd-icon {mime} ui-corner-all" unselectable="on" {style}/>{marker}</div><div class="finder-cwd-filename" title="{name}">{name}</div></div>',row:'<tr id="{hash}" class="'+
h+' {permsclass} {dirclass}" title="{tooltip}"><td><div class="finder-cwd-file-wrapper"><span class="finder-cwd-icon {mime}"/>{marker}<span class="finder-cwd-filename">{name}</span></div></td><td>{perms}</td><td>{date}</td><td>{size}</td><td>{kind}</td></tr>'},O=a.res("tpl","perms"),N=a.res("tpl","symlink"),T={permsclass:function(b){return a.perms2class(b)},perms:function(b){return a.formatPermissions(b)},dirclass:function(a){return"directory"==a.mime?"directory":""},mime:function(b){return a.mime2class(b.mime)},
size:function(b){return a.formatSize(b.size)},date:function(b){return a.formatDate(b)},kind:function(b){return a.mime2kind(b)},marker:function(a){return(a.alias||"symlink-broken"==a.mime?N:"")+(a.read&&a.write?"":O)},tooltip:function(b){var c=a.formatDate(b)+(0<b.size?" ("+a.formatSize(b.size)+")":"");return b.tooltip?a.escape(b.tooltip).replace(/"/g,"&quot;").replace(/\r/g,"&#13;")+"&#13;"+c:c}},B=function(b){b.name=a.escape(b.name);return E[c?"row":"icon"].replace(/\{([a-z]+)\}/g,function(a,c){return T[c]?
T[c](b):b[c]?b[c]:""})},D=!1,P=function(a,b){function g(a,b){return a[b+"All"]("[id]:not(."+m+"):not(.finder-cwd-parent):first")}var f=$.ui.keyCode,h=a==f.LEFT||a==f.UP,k=r.find("[id].ui-selected"),l,n,p;if(k.length)if(l=k.filter(h?":first":":last"),n=g(l,h?"prev":"next"),n.length)if(c||a==f.LEFT||a==f.RIGHT)f=n;else if(p=l.position().top,n=l.position().left,f=l,h){do f=f.prev("[id]");while(f.length&&!(f.position().top<p&&f.position().left<=n));f.is("."+m)&&(f=g(f,"next"))}else{do f=f.next("[id]");
while(f.length&&!(f.position().top>p&&f.position().left>=n));f.is("."+m)&&(f=g(f,"prev"));f.length||(n=r.find("[id]:not(."+m+"):last"),n.position().top>p&&(f=n))}else f=l.siblings("[id]:not(."+m+"):not(.finder-cwd-parent):"+(h?"last":"first"));else f=r.find("[id]:not(."+m+"):not(.finder-cwd-parent):"+(h?"last":"first"));f&&f.length&&!f.is(".finder-cwd-parent")&&(b?f=l.add(l[h?"prevUntil":"nextUntil"]("#"+f.attr("id"))).add(f):k.trigger(e),f.trigger(d),L(f.filter(h?":first":":last")),v())},J=function(a){r.find("#"+
a).trigger(d)},F=function(){r.find("[id].ui-selected").trigger(e);v()},H=function(){return $.map(r.find("[id].ui-selected"),function(a){a=$(a);return a.is("."+m)?null:$(a).attr("id")})},v=function(){a.trigger("select",{selected:H()})},L=function(a){var b=a.position().top;a=a.outerHeight(!0);var c=A.scrollTop(),d=A.innerHeight();b+a>c+d?A.scrollTop(parseInt(b+a-d)):b<c&&A.scrollTop(b)},C=[],K=function(a){for(var b=C.length;b--;)if(C[b].hash==a)return b;return-1},x="scroll."+a.namespace,M=function(){var b=
[],d=!1,e=[],f={},b=r.find("[id]:last"),g=!b.length,h=c?r.children("table").children("tbody"):r,k;if(!C.length)return A.unbind(x);for(;(!b.length||b.position().top<=A.height()+A.scrollTop()+a.options.showThreshold)&&(k=C.splice(0,a.options.showFiles)).length;)b=$.map(k,function(a){return a.hash&&a.name?("directory"==a.mime&&(d=!0),a.tmb&&(1===a.tmb?e.push(a.hash):f[a.hash]=a.tmb),B(a)):null}),h.append(b.join("")),b=r.find("[id]:last"),g&&r.scrollTop(0);S(f);e.length&&X(e);d&&U()},V=$.extend({},a.droppable,
{over:function(b,c){var d=a.cwd().hash;$.each(c.helper.data("files"),function(b,c){if(a.file(c).phash==d)return r.removeClass(t),!1})}}),U=function(){setTimeout(function(){r.find(".directory:not(."+q+",.finder-na,.finder-ro)").droppable(a.droppable)},20)},S=function(b){var c=a.option("tmbUrl"),d=!0,e;$.each(b,function(a,b){var f=r.find("#"+a);f.length?function(a,b){$("<img/>").load(function(){a.find(".finder-cwd-icon").css("background","url('"+b+"') center center no-repeat")}).attr("src",b)}(f,c+
b):(d=!1,-1!=(e=K(a))&&(C[e].tmb=b))});return d},X=function(b){var c=[],c=c=b.splice(0,u);c.length&&a.request({data:{cmd:"tmb",targets:c},preventFail:!0}).done(function(a){S(a.images||[])&&X(b)})},Y=function(b){for(var d=c?r.find("tbody"):r,e=b.length,f=[],g={},h=!1,k=function(b){for(var c=r.find("[id]:first"),d;c.length;){d=a.file(c.attr("id"));if(!c.is(".finder-cwd-parent")&&d&&0>a.compare(b,d))return c;c=c.next("[id]")}},l=function(b){var c=C.length,d;for(d=0;d<c;d++)if(0>a.compare(b,C[d]))return d;
return c||-1},m,n,p,q;e--;)m=b[e],n=m.hash,r.find("#"+n).length||((p=k(m))&&p.length?p.before(B(m)):0<=(q=l(m))?C.splice(q,0,m):d.append(B(m)),r.find("#"+n).length&&("directory"==m.mime?h=!0:m.tmb&&(1===m.tmb?f.push(n):g[n]=m.tmb)));S(g);f.length&&X(f);h&&U()},Q=function(b){for(var c=b.length,d,e,f;c--;)if(d=b[c],(e=r.find("#"+d)).length)try{e.detach()}catch(g){a.debug("error",g)}else-1!=(f=K(d))&&C.splice(f,1)},z=a.i18n("name"),ba=a.i18n("perms"),R=a.i18n("modify"),Z=a.i18n("size"),I=a.i18n("kind"),
W=function(d,e){var f=a.cwd().hash;F();try{r.children("table,"+k).remove()}catch(g){r.html("")}r.removeClass("finder-cwd-view-icons finder-cwd-view-list").addClass("finder-cwd-view-"+(c?"list":"icons"));A[c?"addClass":"removeClass"]("finder-cwd-wrapper-list");c&&r.html('<table><thead><tr class="ui-state-default"><td >'+z+"</td><td>"+ba+"</td><td>"+R+"</td><td>"+Z+"</td><td>"+I+"</td></tr></thead><tbody/></table>");C=$.map(d,function(a){return e||a.phash==f?a:null});C=a.sortFiles(C);A.bind(x,M).trigger(x);
f=a.cwd().phash;if(b.oldSchool&&f&&!w){var h=$.extend(!0,{},a.file(f),{name:"..",mime:"directory"}),h=$(B(h)).addClass("finder-cwd-parent").bind("mousedown click mouseup dblclick mouseenter",function(a){a.preventDefault();a.stopPropagation()}).dblclick(function(){a.exec("open",this.id)});(c?r.find("tbody"):r).prepend(h)}},r=$(this).addClass("ui-helper-clearfix finder-cwd").attr("unselectable","on").delegate(k,"click."+a.namespace,function(a){var b=this.id?$(this):$(this).parents("[id]:first"),c=b.prevAll(".ui-selected:first"),
f=b.nextAll(".ui-selected:first"),g=c.length,h=f.length;a.stopImmediatePropagation();a.shiftKey&&(g||h)?(a=g?b.prevUntil("#"+c.attr("id")):b.nextUntil("#"+f.attr("id")),a.add(b).trigger(d)):a.ctrlKey||a.metaKey?b.trigger(b.is(".ui-selected")?e:d):(F(),b.trigger(d));v()}).delegate(k,"dblclick."+a.namespace,function(b){a.dblclick({file:this.id})}).delegate(k,"mouseenter."+a.namespace,function(b){b=$(this);var d=c?b:b.children();b.is("."+n)||d.is("."+l+",."+m)||d.draggable(a.draggable)}).delegate(k,
d,function(a){a=$(this);D||a.is("."+m)||a.addClass("ui-selected").children().addClass(p)}).delegate(k,e,function(a){D||$(this).removeClass("ui-selected").children().removeClass(p)}).delegate(k,g,function(){var a=$(this).removeClass("ui-selected").addClass(m),b=(c?a:a.children()).removeClass(p);a.is("."+q)&&a.droppable("disable");b.is("."+l)&&b.draggable("disable");!c&&b.removeClass(m)}).delegate(k,f,function(){var a=$(this).removeClass(m),b=c?a:a.children();a.is("."+q)&&a.droppable("enable");b.is("."+
l)&&b.draggable("enable")}).delegate(k,"scrolltoview",function(){L($(this))}).delegate(k,"mouseenter mouseleave",function(b){a.trigger("hover",{hash:$(this).attr("id"),type:b.type})}).bind("contextmenu."+a.namespace,function(b){var c=$(b.target).closest("."+h);c.length&&(b.stopPropagation(),b.preventDefault(),c.is("."+m)||(c.is(".ui-selected")||(F(),c.trigger(d),v()),a.trigger("contextmenu",{type:"files",targets:a.selected(),x:b.clientX,y:b.clientY})))}).selectable({filter:k,stop:v,selected:function(a,
b){$(b.selected).trigger(d)},unselected:function(a,b){$(b.unselected).trigger(e)}}).droppable(V).bind("create."+a.namespace,function(a,b){var d=c?r.find("tbody"):r,e=d.find(".finder-cwd-parent");b=$(B(b)).addClass(n);F();e.length?e.after(b):d.prepend(b);r.scrollTop(0)}).bind("unselectall",F).bind("selectfile",function(a,b){r.find("#"+b).trigger(d);v()}),A=$('<div class="finder-cwd-wrapper"/>').bind("contextmenu",function(b){b.preventDefault();a.trigger("contextmenu",{type:"cwd",targets:[a.cwd().hash],
x:b.clientX,y:b.clientY})}),G=function(){var a=0;A.siblings(".finder-panel:visible").each(function(){a+=$(this).outerHeight(!0)});A.height(aa.height()-a)},aa=$(this).parent().resize(G).children(".finder-workzone").append(A.append(this));a.dragUpload&&(A[0].addEventListener("dragenter",function(a){a.preventDefault();a.stopPropagation();A.addClass(t)},!1),A[0].addEventListener("dragleave",function(a){a.preventDefault();a.stopPropagation();a.target==r[0]&&A.removeClass(t)},!1),A[0].addEventListener("dragover",
function(a){a.preventDefault();a.stopPropagation()},!1),A[0].addEventListener("drop",function(b){b.preventDefault();A.removeClass(t);var c=!1,d="";b.dataTransfer&&b.dataTransfer.files&&b.dataTransfer.files.length?(c=b.dataTransfer.files,d="files"):b.dataTransfer.getData("text/html")?(c=[b.dataTransfer.getData("text/html")],d="html"):b.dataTransfer.getData("text")&&(c=[b.dataTransfer.getData("text")],d="text");c&&a.exec("upload",{files:c,type:d})},!1));a.bind("open",function(a){W(a.data.files)}).bind("search",
function(a){y=a.data.files;W(y,!0)}).bind("searchend",function(){y=[];w&&(w="",W(a.files()))}).bind("searchstart",function(a){w=a.data.query}).bind("sortchange",function(){W(w?y:a.files(),!!w)}).bind("viewchange",function(){var b=a.selected(),d="list"==a.storage("view");d!=c&&(c=d,W(a.files()),$.each(b,function(a,b){J(b)}),v());G()}).add(function(b){var c=a.cwd().hash;b=w?$.map(b.data.added||[],function(a){return-1===a.name.indexOf(w)?null:a}):$.map(b.data.added||[],function(a){return a.phash==c?
a:null});Y(b)}).change(function(b){var c=a.cwd().hash,d=a.selected();w?$.each(b.data.changed||[],function(a,b){Q([b.hash]);-1!==b.name.indexOf(w)&&(Y([b]),-1!==$.inArray(b.hash,d)&&J(b.hash))}):$.each($.map(b.data.changed||[],function(a){return a.phash==c?a:null}),function(a,b){Q([b.hash]);Y([b]);-1!==$.inArray(b.hash,d)&&J(b.hash)});v()}).remove(function(a){Q(a.data.removed||[]);v()}).bind("open add search searchend",function(){r.css("height","auto");r.outerHeight(!0)<A.height()&&r.height(A.height()-
(r.outerHeight(!0)-r.height())-2)}).dragstart(function(a){var b=$(a.data.target);a=a.data.originalEvent;b.is(k)&&(b.is(".ui-selected")||(a.ctrlKey||a.metaKey||a.shiftKey||F(),b.trigger(d),v()),r.droppable("disable"));r.selectable("disable").removeClass(m);D=!0}).dragstop(function(){r.selectable("enable").droppable("enable");D=!1}).bind("lockfiles unlockfiles",function(a){var b="lockfiles"==a.type?g:f;a=a.data.files||[];for(var c=a.length;c--;)r.find("#"+a[c]).trigger(b);v()}).bind("mkdir mkfile duplicate upload rename archive extract",
function(b){var c=a.cwd().hash;F();$.each(b.data.added||[],function(a,b){b&&b.phash==c&&J(b.hash)});v()}).shortcut({pattern:"ctrl+a",description:"selectall",callback:function(){var b;r.find("[id]:not(.ui-selected):not(.finder-cwd-parent)").trigger(d);C.length?(b=a.cwd().hash,a.select({selected:$.map(a.files(),function(a){return a.phash==b?a.hash:null})})):v()}}).shortcut({pattern:"left right up down shift+left shift+right shift+up shift+down",description:"selectfiles",type:"keydown",callback:function(a){P(a.keyCode,
a.shiftKey)}}).shortcut({pattern:"home",description:"selectffile",callback:function(a){F();L(r.find("[id]:first").trigger(d));v()}}).shortcut({pattern:"end",description:"selectlfile",callback:function(a){F();L(r.find("[id]:last").trigger(d));v()}})});return this};"use strict";
$.fn.finderdialog=function(a){var b;"string"==typeof a&&(b=this.closest(".ui-dialog")).length&&("open"==a?"none"==b.css("display")&&b.fadeIn(120,function(){b.trigger("open")}):"close"==a?"none"!=b.css("display")&&b.hide().trigger("close"):"destroy"==a?b.hide().remove():"toTop"==a&&b.trigger("totop"));a=$.extend({},$.fn.finderdialog.defaults,a);this.filter(":not(.ui-dialog-content)").each(function(){var b=$(this).addClass("ui-dialog-content ui-widget-content"),d=b.parent(),e=parseInt(1E6*Math.random()),
g=d.children(".finder-overlay"),f=$('<div class="ui-dialog-buttonset"/>'),h=$('<div class=" ui-helper-clearfix ui-dialog-buttonpane ui-widget-content"/>').append(f),k=$('<div class="test ui-dialog ui-widget ui-widget-content ui-corner-all ui-draggable std42-dialog  finder-dialog '+a.cssClass+'"/>').hide().append(b).appendTo(d).draggable({handle:".ui-dialog-titlebar"}).css({width:a.width,height:a.height,position:"absolute"}).mousedown(function(a){a.stopPropagation();$(document).mousedown();k.is(".finder-dialog-active")||
(d.find(".finder-dialog:visible").removeClass("finder-dialog-active"),k.addClass("finder-dialog-active").zIndex(m()+1))}).bind("open",function(){a.modal&&g.finderoverlay("show");k.trigger("totop");"function"==typeof a.open&&$.proxy(a.open,b[0])();k.is(".finder-dialog-notify")||d.find(".finder-dialog:visible").not(".finder-dialog-notify").each(function(){var a=$(this),b=parseInt(a.css("top")),c=parseInt(a.css("left")),d=parseInt(k.css("top")),e=parseInt(k.css("left"));a[0]==k[0]||b!=d&&c!=e||k.css({top:b+
10,left:c+10})})}).bind("close",function(){var e=d.find(".finder-dialog:visible"),f=m();a.modal&&g.finderoverlay("hide");e.length?e.each(function(){var a=$(this);if(a.zIndex()>=f)return a.trigger("totop"),!1}):setTimeout(function(){d.mousedown().click()},10);"function"==typeof a.close?$.proxy(a.close,b[0])():a.destroyOnClose&&k.hide().remove()}).bind("totop",function(){$(this).mousedown().find(".ui-button:first").focus().end().find(":text:first").focus()}),m=function(){var a=d.zIndex()+10;d.find(".finder-dialog:visible").each(function(){var b;
this!=k[0]&&(b=$(this).zIndex(),b>a&&(a=b))});return a},l;a.position||(l=parseInt((d.height()-k.outerHeight())/2-42),a.position={top:0<l?l:0,left:parseInt((d.width()-k.outerWidth())/2)});k.css(a.position);a.closeOnEscape&&$(document).bind("keyup."+e,function(a){a.keyCode==$.ui.keyCode.ESCAPE&&k.is(".finder-dialog-active")&&(b.finderdialog("close"),$(document).unbind("keyup."+e))});k.prepend($('<div class="ui-dialog-titlebar ui-widget-header ui-corner-all ui-helper-clearfix">'+a.title+"</div>").prepend($('<a href="#" class="ui-dialog-titlebar-close ui-corner-all"><span class="ui-icon ui-icon-closethick"/></a>').mousedown(function(a){a.preventDefault();
b.finderdialog("close")})));$.each(a.buttons,function(a,d){var e=$('<button type="button" class="ui-button ui-widget ui-state-default ui-corner-all ui-button-text-only"><span class="ui-button-text">'+a+"</span></button>").click($.proxy(d,b[0])).hover(function(a){$(this)["mouseenter"==a.type?"focus":"blur"]()}).focus(function(){$(this).addClass("ui-state-hover")}).blur(function(){$(this).removeClass("ui-state-hover")}).keydown(function(a){a.keyCode==$.ui.keyCode.ENTER?$(this).click():a.keyCode==$.ui.keyCode.TAB&&
(a=$(this).next(".ui-button"),a.length?a.focus():$(this).siblings(".ui-button:first").focus())});f.append(e)});f.children().length&&k.append(h);a.resizable&&$.fn.resizable&&k.resizable({minWidth:a.minWidth,minHeight:a.minHeight,alsoResize:this});"function"==typeof a.create&&$.proxy(a.create,this)();a.autoOpen&&b.finderdialog("open")});return this};
$.fn.finderdialog.defaults={cssClass:"",title:"",modal:!1,resizable:!0,autoOpen:!0,closeOnEscape:!0,destroyOnClose:!1,buttons:{},position:null,width:320,height:"auto",minWidth:200,minHeight:110};
$.fn.findernavbar=function(a,b){this.not(".finder-navbar").each(function(){var c=$(this).addClass("ui-state-default finder-navbar"),d;c.siblings(".finder-workzone").append(c);$.fn.resizable&&(d=c.resizable({handles:"ltr"==a.direction?"e":"w",minWidth:b.minWidth||150,maxWidth:b.maxWidth||500}).bind("resize scroll",function(){d.css({top:parseInt(c.scrollTop())})}).find(".ui-resizable-handle").zIndex(c.zIndex()+10),a.one("open",function(){setTimeout(function(){c.trigger("resize")},150)}))});return this};
$.fn.finderoverlay=function(a){this.filter(":not(.finder-overlay)").each(function(){a=$.extend({},a);$(this).addClass("ui-widget-overlay finder-overlay").hide().mousedown(function(a){a.preventDefault();a.stopPropagation()}).data({cnt:0,show:"function"==typeof a.show?a.show:function(){},hide:"function"==typeof a.hide?a.hide:function(){}})});if("show"==a){var b=this.eq(0),c=b.data("cnt")+1,d=b.data("show");b.data("cnt",c);b.is(":hidden")&&(b.zIndex(b.parent().zIndex()+1),b.show(),d())}"hide"==a&&(b=
this.eq(0),c=b.data("cnt")-1,d=b.data("hide"),b.data("cnt",c),0==c&&b.is(":visible")&&(b.hide(),d()));return this};$.fn.finderpanel=function(a){return this.each(function(){var b=$(this).addClass("finder-panel ui-state-default ui-corner-all"),c="margin-"+("ltr"==a.direction?"left":"right");a.one("load",function(d){var e=a.getUI("navbar");b.css(c,parseInt(e.outerWidth(!0)));e.bind("resize",function(){b.is(":visible")&&b.css(c,parseInt(e.outerWidth(!0)))})})})};"use strict";
$.fn.finderpath=function(a){return this.each(function(){var b=$(this).addClass("finder-path").html("&nbsp;").delegate("a","click",function(b){var d=$(this).attr("href").substr(1);b.preventDefault();d!=a.cwd().hash&&a.exec("open",d)}).prependTo(a.getUI("statusbar").show());a.bind("open searchend",function(){var c=[];$.each(a.parents(a.cwd().hash),function(b,e){c.push('<a href="#'+e+'">'+a.escape(a.file(e).name)+"</a>")});b.html(c.join(a.option("separator")))}).bind("search",function(){b.html(a.i18n("searcresult"))})})};
"use strict";
$.fn.finderplaces=function(a,b){return this.each(function(){var c=[],d=a.res("class","navdir"),e=a.res("class","navcollapse"),g=a.res("class","navexpand");a.res("class","hover");var f=a.res("class","treeroot"),h=a.res("tpl","navdir"),k=a.res("tpl","perms"),m=$(a.res("tpl","navspinner")),l=function(a){return a.substr(6)},q=function(){a.storage("places",c.join(","))},p=function(b){return $(h.replace(/\{id\}/,"place-"+b.hash).replace(/\{name\}/,a.escape(b.name)).replace(/\{cssclass\}/,a.perms2class(b)).replace(/\{permissions\}/,b.read&&
b.write?"":k).replace(/\{symlink\}/,""))},t=function(b){var f=p(b);y.children().length&&$.each(y.children(),function(){var a=$(this);if(0>b.name.localeCompare(a.children("."+d).text()))return!f.insertBefore(a)});c.push(b.hash);!f.parent().length&&y.append(f);w.addClass(e);f.draggable({appendTo:"body",revert:!1,helper:function(){var b=$(this);b.children().removeClass("ui-state-hover");return $('<div class="finder-place-drag finder-'+a.direction+'"/>').append(b.clone()).data("hash",l(b.children(":first").attr("id")))},
start:function(){$(this).hide()},stop:function(a,b){var c=E.offset().top,d=E.offset().left,e=E.width(),f=E.height(),g=a.clientX,h=a.clientY;g>d&&g<d+e&&h>c&&h<h+f?$(this).show():(n(b.helper.data("hash")),q())}})},n=function(a){var b=$.inArray(a,c);-1!==b&&(c.splice(b,1),y.find("#place-"+a).parent().remove(),!y.children().length&&w.removeClass(e+" "+g))},u=p({hash:"root-"+a.namespace,name:a.i18n(b.name,"places"),read:!0,write:!0}),w=u.children("."+d).addClass(f).click(function(){w.is("."+e)&&(E.toggleClass(g),
y.slideToggle(),a.storage("placesState",E.is("."+g)?1:0))}),y=u.children("."+a.res("class","navsubtree")),E=$(this).addClass(a.res("class","tree")+" finder-places ui-corner-all").hide().append(u).appendTo(a.getUI("navbar")).delegate("."+d,{click:function(){a.exec("open",$(this).attr("id").substr(6))},mouseenter:function(){$(this).addClass("ui-state-hover")},mouseleave:function(){$(this).removeClass("ui-state-hover")}}).delegate("."+d+":not(."+f+")","contextmenu",function(b){var c=$(this).attr("id").substr(6);
b.preventDefault();a.trigger("contextmenu",{raw:[{label:a.i18n("rmFromPlaces"),icon:"rm",callback:function(){n(c);q()}}],x:b.clientX,y:b.clientY})}).droppable({tolerance:"pointer",accept:".finder-cwd-file-wrapper,.finder-tree-dir,.finder-cwd-file",hoverClass:a.res("class","adroppable"),drop:function(b,d){var e=!0;$.each(d.helper.data("files"),function(b,d){var f=a.file(d);f&&"directory"==f.mime&&-1===$.inArray(f.hash,c)?t(f):e=!1});q();e&&d.helper.hide()}});a.one("load",function(){E.show().parent().show();
c=$.map(a.storage("places").split(","),function(a){return a||null});c.length&&(w.prepend(m),a.request({data:{cmd:"info",targets:c},preventDefault:!0}).done(function(b){c=[];$.each(b.files,function(a,b){"directory"==b.mime&&t(b)});q();0<a.storage("placesState")&&w.click()}).always(function(){m.remove()}));a.remove(function(a){$.each(a.data.removed,function(a,b){n(b)});q()}).change(function(a){$.each(a.data.changed,function(a,b){-1!==$.inArray(b.hash,c)&&(n(b.hash),"directory"==b.mime&&t(b))});q()}).bind("sync",
function(){c.length&&(w.prepend(m),a.request({data:{cmd:"info",targets:c},preventDefault:!0}).done(function(a){$.each(a.files||[],function(a,b){-1===$.inArray(b.hash,c)&&n(b.hash)});q()}).always(function(){m.remove()}))})})})};"use strict";
$.fn.findersearchbutton=function(a){return this.each(function(){var b=!1,c=$(this).hide().addClass("ui-widget-content finder-button "+a.fm.res("class","searchbtn")+""),d=function(){var c=$.trim(g.val());c?a.exec(c).done(function(){b=!0;g.focus()}):a.fm.trigger("searchend")},e=function(){g.val("");b&&(b=!1,a.fm.trigger("searchend"))},g=$('<input type="text" size="42"/>').appendTo(c).keypress(function(a){a.stopPropagation()}).keydown(function(a){a.stopPropagation();13==a.keyCode&&d();27==a.keyCode&&
(a.preventDefault(),e())});$('<span class="ui-icon ui-icon-search" title="'+a.title+'"/>').appendTo(c).click(d);$('<span class="ui-icon ui-icon-close"/>').appendTo(c).click(e);setTimeout(function(){c.parent().detach();a.fm.getUI("toolbar").prepend(c.show());if(a.fm.UA.ltIE7){var b=c.children("ltr"==a.fm.direction?".ui-icon-close":".ui-icon-search");b.css({right:"",left:parseInt(c.width())-b.outerWidth(!0)})}},200);a.fm.error(function(){g.unbind("keydown")}).select(function(){g.blur()}).bind("searchend",
function(){g.val("")}).viewchange(e).shortcut({pattern:"ctrl+f f3",description:a.title,callback:function(){g.select().focus()}})})};"use strict";
$.fn.findersortbutton=function(a){return this.each(function(){var b=a.fm,c=a.name,d=b.res("class","disabled"),e=b.res("class","hover"),g=$(this).addClass("ui-state-default finder-button finder-menubutton elfiner-button-"+c).attr("title",a.title).append('<span class="finder-button-icon finder-button-icon-'+c+'"/>').hover(function(){!g.is("."+d)&&g.toggleClass(e)}).click(function(b){g.is("."+d)||(b.stopPropagation(),f.is(":hidden")&&a.fm.getUI().click(),f.slideToggle(100))}),f=$('<div class="ui-widget ui-widget-content finder-button-menu ui-corner-all"/>').hide().appendTo(g).zIndex(12+
g.zIndex()).delegate(".finder-button-menu-item",{"mouseenter mouseleave":function(){$(this).toggleClass(e)},click:function(a){a.preventDefault();a.stopPropagation();k()}}),h=function(){f.children(":not(:last)").removeClass("finder-button-menu-item-selected finder-button-menu-item-selected-asc finder-button-menu-item-selected-desc").filter('[rel="'+b.sortType+'"]').addClass("finder-button-menu-item-selected "+("asc"==b.sortOrder?"finder-button-menu-item-selected-asc":"finder-button-menu-item-selected-desc"));
f.children(":last").toggleClass("finder-button-menu-item-selected",b.sortStickFolders)},k=function(){f.hide()};$.each(b.sortRules,function(a,c){f.append($('<div class="finder-button-menu-item" rel="'+a+'"><span class="ui-icon ui-icon-arrowthick-1-n"/><span class="ui-icon ui-icon-arrowthick-1-s"/>'+b.i18n("sort"+a)+"</div>").data("type",a))});f.children().click(function(c){c=$(this).attr("rel");a.exec([],{type:c,order:c==b.sortType?"asc"==b.sortOrder?"desc":"asc":b.sortOrder,stick:b.sortStickFolders})});
$('<div class="finder-button-menu-item finder-button-menu-item-separated"><span class="ui-icon ui-icon-check"/>'+b.i18n("sortFoldersFirst")+"</div>").appendTo(f).click(function(){a.exec([],{type:b.sortType,order:b.sortOrder,stick:!b.sortStickFolders})});b.bind("disable select",k).getUI().click(k);b.bind("sortchange",h);1<f.children().length?a.change(function(){g.toggleClass(d,a.disabled());h()}).change():g.addClass(d)})};"use strict";
$.fn.finderstat=function(a){return this.each(function(){var b=$(this).addClass("finder-stat-size"),c=$('<div class="finder-stat-selected"/>'),d=a.i18n("size").toLowerCase(),e=a.i18n("items").toLowerCase(),g=a.i18n("selected"),f=function(c,f){var g=0,l=0;$.each(c,function(a,b){f&&b.phash!=f||(g++,l+=parseInt(b.size)||0)});b.html(e+": "+g+", "+d+": "+a.formatSize(l))};a.getUI("statusbar").prepend(b).append(c).show();a.bind("open reload add remove change searchend",function(){f(a.files(),a.cwd().hash)}).search(function(a){f(a.data.files)}).select(function(){var b=
0,e=0,f=a.selectedFiles();1==f.length?(b=f[0].size,c.html(a.escape(f[0].name)+(0<b?", "+a.formatSize(b):""))):($.each(f,function(a,c){e++;b+=parseInt(c.size)||0}),c.html(e?g+": "+e+", "+d+": "+a.formatSize(b):"&nbsp;"))})})};"use strict";
$.fn.findertoolbar=function(a,b){this.not(".finder-toolbar").each(function(){var c=a._commands,d=$(this).addClass("ui-helper-clearfix ui-widget-header ui-corner-top finder-toolbar"),e=b||[],g=e.length,f,h,k,m;for(d.prev().length&&d.parent().prepend(this);g--;)if(e[g]){k=$('<div class="ui-widget-content ui-corner-all finder-buttonset"/>');for(f=e[g].length;f--;)if(h=c[e[g][f]])m="finder"+h.options.ui,$.fn[m]&&k.prepend($("<div/>")[m](h));k.children().length&&d.prepend(k);k.children(":gt(0)").before('<span class="ui-widget-content finder-toolbar-button-separator"/>')}d.children().length&&
d.show()});return this};"use strict";
$.fn.findertree=function(a,b){var c=a.res("class","tree");this.not("."+c).each(function(){var d=a.res("class","treeroot"),e=b.openRootOnLoad,g=a.res("class","navsubtree"),f=a.res("class","treedir"),h=a.res("class","navcollapse"),k=a.res("class","navexpand"),m=a.res("class","navarrow"),l=a.res("class","active"),q=a.res("class","adroppable"),p=a.res("class","hover"),t=a.res("class","disabled"),n=a.res("class","draggable"),u=a.res("class","droppable"),w=function(a){var b=M.offset().left;return b<=a&&
a<=b+M.width()},y=a.droppable.drop,E=$.extend(!0,{},a.droppable,{over:function(a){var b=$(this),c=p+" "+q;w(a.clientX)?(b.addClass(c),b.is("."+h+":not(."+k+")")&&setTimeout(function(){b.is("."+q)&&b.children("."+m).click()},500)):b.removeClass(c)},out:function(){$(this).removeClass(p+" "+q)},drop:function(a,b){w(a.clientX)&&y.call(this,a,b)}}),O=$(a.res("tpl","navspinner")),N=a.res("tpl","navdir"),T=a.res("tpl","perms"),B=a.res("tpl","symlink"),D={id:function(b){return a.navHash2Id(b.hash)},cssclass:function(b){return(b.phash?
"":d)+" "+(b.net?"finder-navbar-net":"")+" "+f+" "+a.perms2class(b)+" "+(b.dirs&&!b.link?h:"")},permissions:function(a){return a.read&&a.write?"":T},symlink:function(a){return a.alias?B:""}},P=function(b){b.name=a.escape(b.name);return N.replace(/(?:\{([a-z]+)\})/ig,function(a,c){return b[c]||(D[c]?D[c](b):"")})},J=function(a){return $.map(a||[],function(a){return"directory"==a.mime?a:null})},F=function(b){return b?x.find("#"+a.navHash2Id(b)).next("."+g):x},H=function(b,c){for(var d=b.children(":first"),
e;d.length;){e=a.file(a.navId2Hash(d.children("[id]").attr("id")));if((e=a.file(a.navId2Hash(d.children("[id]").attr("id"))))&&0>c.name.toLowerCase().localeCompare(e.name.toLowerCase()))return d;d=d.next()}return $("")},v=function(b){for(var c=b.length,d=[],e=b.length,f,g,h,k;e--;)if(f=b[e],!x.find("#"+a.navHash2Id(f.hash)).length)if(h=F(f.phash),h.length)if(g=P(f),f.phash&&(k=H(h,f)).length)k.before(g);else h[f.phash?"append":"prepend"](g);else d.push(f);if(d.length&&d.length<c)return v(d);setTimeout(function(){C()},
10)},L=function(c){var h=a.cwd().hash,m=x.find("#"+a.navHash2Id(h)),n,p;e&&(n=x.find("#"+a.navHash2Id(a.root())),n.is(".finder-subtree-loaded")&&n.addClass(k).next("."+g).show(),e=!1);m.is("."+l)||(x.find("."+f+"."+l).removeClass(l),m.addClass(l));b.syncTree&&(m.length?m.parentsUntil("."+d).filter("."+g).show().prev("."+f).addClass(k):!c&&(p=a.file(h)).phash&&x.find("#"+a.navHash2Id(p.phash)).length&&(v([p]),a.request({data:{cmd:"parents",target:h},preventFail:!0}).done(function(b){b=J(b.tree);v(b);
K(b,"finder-subtree-loaded");h==a.cwd().hash&&L(!0)})))},C=function(){x.find("."+f+":not(."+u+",.finder-ro,.finder-na)").droppable(E)},K=function(b,c){var d="finder-subtree-loaded"==c?"."+h+":not(.finder-subtree-loaded)":":not(."+h+")";$.each(b,function(b,e){x.find("#"+a.navHash2Id(e.phash)+d).filter(function(){return 0<$(this).next("."+g).children().length}).addClass(c)})},x=$(this).addClass(c).delegate("."+f,{"mouseenter mouseleave":function(b){var c=$(this);b="mouseenter"==b.type;c.is("."+q+" ,."+
t)||(b&&!c.is("."+d+",."+n+",.finder-na,.finder-wo")&&c.draggable(a.draggable),c.toggleClass(p,b))},"dropover dropout drop":function(a){$(this)["dropover"==a.type?"addClass":"removeClass"](q+" "+p)},click:function(b){b=$(this);var c=a.navId2Hash(b.attr("id")),d=a.file(c);a.trigger("searchend");c==a.cwd().hash||b.is("."+t)?b.is("."+h)&&b.children("."+m).click():a.exec("open",d.thash||c)},contextmenu:function(b){b.preventDefault();a.trigger("contextmenu",{type:"navbar",targets:[a.navId2Hash($(this).attr("id"))],
x:b.clientX,y:b.clientY})}}).delegate("."+f+"."+h+" ."+m,"click",function(b){var c=$(this),d=c.parent("."+f),e=d.next("."+g);b.stopPropagation();d.is(".finder-subtree-loaded")?(d.toggleClass(k),e.slideToggle()):(O.insertBefore(c),d.removeClass(h),a.request({cmd:"tree",target:a.navId2Hash(d.attr("id"))}).done(function(a){v(J(a.tree));e.children().length&&(d.addClass(h+" "+k),e.slideDown());L()}).always(function(a){O.remove();d.addClass("finder-subtree-loaded")}))}),M=a.getUI("navbar").append(x).show();
a.open(function(a){a=a.data;var b=J(a.files);a.init&&x.empty();b.length&&(v(b),K(b,"finder-subtree-loaded"));L()}).add(function(a){a=J(a.data.added);a.length&&(v(a),K(a,h))}).change(function(b){b=J(b.data.changed);for(var c=b.length,d,e,h,l,m,n;c--;)if(d=b[c],(e=x.find("#"+a.navHash2Id(d.hash))).length){if(d.phash){h=e.closest("."+g);l=F(d.phash);m=e.parent().next();n=H(l,d);if(!l.length)continue;if(l[0]!==h[0]||m.get(0)!==n.get(0))n.length?n.before(e):l.append(e)}l=e.is("."+k);m=e.is(".finder-subtree-loaded");
h=$(P(d));e.replaceWith(h.children("."+f));d.dirs&&(l||m)&&(e=x.find("#"+a.navHash2Id(d.hash)))&&e.next("."+g).children().length&&(l&&e.addClass(k),m&&e.addClass("finder-subtree-loaded"))}L();C()}).remove(function(b){b=b.data.removed;for(var c=b.length,d,e;c--;)(d=x.find("#"+a.navHash2Id(b[c]))).length&&(e=d.closest("."+g),d.parent().detach(),e.children().length||e.hide().prev("."+f).removeClass(h+" "+k+" finder-subtree-loaded"))}).bind("search searchend",function(b){x.find("#"+a.navHash2Id(a.cwd().hash))["search"==
b.type?"removeClass":"addClass"](l)}).bind("lockfiles unlockfiles",function(b){var c="lockfiles"==b.type,d=c?"disable":"enable";b=$.map(b.data.files||[],function(b){var c=a.file(b);return c&&"directory"==c.mime?b:null});$.each(b,function(b,e){var f=x.find("#"+a.navHash2Id(e));f.length&&(f.is("."+n)&&f.draggable(d),f.is("."+u)&&f.droppable(l),f[c?"addClass":"removeClass"](t))})})});return this};"use strict";
$.fn.finderuploadbutton=function(a){return this.each(function(){var b=$(this).finderbutton(a).unbind("click"),c=$("<form/>").appendTo(b),d=$('<input type="file" multiple="true"/>').change(function(){var b=$(this);b.val()&&(a.exec({input:b.remove()[0]}),d.clone(!0).appendTo(c))});c.append(d.clone(!0));a.change(function(){c[a.disabled()?"hide":"show"]()}).change()})};"use strict";
$.fn.finderviewbutton=function(a){return this.each(function(){var b=$(this).finderbutton(a),c=b.children(".finder-button-icon");a.change(function(){var d="icons"==a.value;c.toggleClass("finder-button-icon-view-list",d);b.attr("title",a.fm.i18n(d?"viewlist":"viewicons"))})})};"use strict";
$.fn.finderworkzone=function(a){this.not(".finder-workzone").each(function(){var a=$(this).addClass("finder-workzone"),c=a.outerHeight(!0)-a.height(),d=a.parent();d.add(window).bind("resize",function(){var e=d.height();d.children(":visible:not(.finder-workzone)").each(function(){var a=$(this);"absolute"!=a.css("position")&&(e-=a.outerHeight(!0))});a.height(e-c)})});return this};"use strict";
Finder.prototype.commands.archive=function(){var a=this,b=a.fm,c=[];this.variants=[];this.disableOnSearch=!0;b.bind("open reload",function(){a.variants=[];$.each(c=b.option("archivers").create||[],function(c,e){a.variants.push([e,b.mime2kind(e)])});a.change()});this.getstate=function(){return!this._disabled&&c.length&&b.selected().length&&b.cwd().write?0:-1};this.exec=function(a,e){var g=this.files(a),f=g.length,h=e||c[0],k=b.cwd(),m=["errArchive","errPerm"],l=$.Deferred().fail(function(a){a&&b.error(a)});
if(!(this.enabled()&&f&&c.length&&-1!==$.inArray(h,c)))return l.reject();if(!k.write)return l.reject(m);for(k=0;k<f;k++)if(!g[k].read)return l.reject(m);return b.request({data:{cmd:"archive",targets:this.hashes(a),type:h},notify:{type:"archive",cnt:1},syncOnFail:!0})}};"use strict";Finder.prototype.commands.back=function(){this.alwaysEnabled=!0;this.updateOnSelect=!1;this.shortcuts=[{pattern:"ctrl+left backspace"}];this.getstate=function(){return this.fm.history.canBack()?0:-1};this.exec=function(){return this.fm.history.back()}};
"use strict";Finder.prototype.commands.copy=function(){this.shortcuts=[{pattern:"ctrl+c ctrl+insert"}];this.getstate=function(a){a=this.files(a);var b=a.length;return b&&$.map(a,function(a){return a.phash&&a.read?a:null}).length==b?0:-1};this.exec=function(a){var b=this.fm,c=$.Deferred().fail(function(a){b.error(a)});$.each(this.files(a),function(a,b){if(!b.read||!b.phash)return!c.reject(["errCopy",b.name,"errPerm"])});return"rejected"==c.state()?c:c.resolve(b.clipboard(this.hashes(a)))}};"use strict";
Finder.prototype.commands.cut=function(){this.shortcuts=[{pattern:"ctrl+x shift+insert"}];this.getstate=function(a){a=this.files(a);var b=a.length;return b&&$.map(a,function(a){return a.phash&&a.read&&!a.locked?a:null}).length==b?0:-1};this.exec=function(a){var b=this.fm,c=$.Deferred().fail(function(a){b.error(a)});$.each(this.files(a),function(a,b){if(!b.read||!b.phash)return!c.reject(["errCopy",b.name,"errPerm"]);if(b.locked)return!c.reject(["errLocked",b.name])});return"rejected"==c.state()?c:
c.resolve(b.clipboard(this.hashes(a),!0))}};"use strict";
Finder.prototype.commands.download=function(){var a=this,b=this.fm,c=function(b){return $.map(a.files(b),function(a){return"directory"==a.mime?null:a})};this.shortcuts=[{pattern:"shift+enter"}];this.getstate=function(){var a=this.fm.selected(),e=a.length;return this._disabled||!e||b.UA.IE&&1!=e||e!=c(a).length?-1:0};this.exec=function(a){var b=this.fm,g=b.options.url,f=c(a),h=$.Deferred(),k="",m="",l;if(this.disabled())return h.reject();$.each(b.options.customData||{},function(a,b){m+="&"+a+"="+b});
g+=-1===g.indexOf("?")?"?":"&";for(l=0;l<f.length;l++)k+='<iframe class="downloader" id="downloader-'+f[l].hash+'" style="display:none" src="'+g+"cmd=file&target="+f[l].hash+"&download=1"+m+'"/>';$(k).appendTo("body").ready(function(){setTimeout(function(){$(k).each(function(){$("#"+$(this).attr("id")).remove()})},2E4+1E4*l)});b.trigger("download",{files:f});return h.resolve(a)}};"use strict";
Finder.prototype.commands.duplicate=function(){var a=this.fm;this.getstate=function(b){b=this.files(b);var c=b.length;return!this._disabled&&c&&a.cwd().write&&$.map(b,function(a){return a.phash&&a.read?a:null}).length==c?0:-1};this.exec=function(a){var c=this.fm,d=this.files(a),e=d.length,g=$.Deferred().fail(function(a){a&&c.error(a)});if(!e||this._disabled)return g.reject();$.each(d,function(a,b){if(!b.read||!c.file(b.phash).write)return!g.reject(["errCopy",b.name,"errPerm"])});return"rejected"==
g.state()?g:c.request({data:{cmd:"duplicate",targets:this.hashes(a)},notify:{type:"copy",cnt:e}})}};"use strict";
Finder.prototype.commands.edit=function(){var a=this,b=this.fm,c=b.res("mimes","text")||[],d=function(b){return $.map(b,function(b){return 0!==b.mime.indexOf("text/")&&-1===$.inArray(b.mime,c)||!b.mime.indexOf("text/rtf")||a.onlyMimes.length&&-1===$.inArray(b.mime,a.onlyMimes)||!b.read||!b.write?null:b})},e=function(c,d,e){var g=$.Deferred(),l=$('<textarea class="finder-file-edit" rows="20" id="'+c+'-ta">'+b.escape(e)+"</textarea>"),q=function(){l.editor&&l.editor.save(l[0],l.editor.instance);g.resolve(l.getContent());
l.finderdialog("close")},p=function(){g.reject();l.finderdialog("close")};e={title:d.name,width:a.options.dialogWidth||450,buttons:{},close:function(){l.editor&&l.editor.close(l[0],l.editor.instance);$(this).finderdialog("destroy")},open:function(){b.disable();l.focus();l[0].setSelectionRange&&l[0].setSelectionRange(0,0);l.editor&&l.editor.load(l[0])}};l.getContent=function(){return l.val()};$.each(a.options.editors||[],function(a,b){if(-1!==$.inArray(d.mime,b.mimes||[])&&"function"==typeof b.load&&
"function"==typeof b.save)return l.editor={load:b.load,save:b.save,close:"function"==typeof b.close?b.close:function(){},instance:null},!1});l.editor||l.keydown(function(a){var b=a.keyCode,c,d;a.stopPropagation();9==b&&(a.preventDefault(),this.setSelectionRange&&(c=this.value,d=this.selectionStart,this.value=c.substr(0,d)+"\t"+c.substr(this.selectionEnd),d+=1,this.setSelectionRange(d,d)));if(a.ctrlKey||a.metaKey){if(81==b||87==b)a.preventDefault(),p();83==b&&(a.preventDefault(),q())}});e.buttons[b.i18n("Save")]=
q;e.buttons[b.i18n("Cancel")]=p;b.dialog(l,e).attr("id",c);return g.promise()},g=function(a){var c=a.hash,d=$.Deferred();b.url(c);var g="edit-"+b.namespace+"-"+a.hash,l=b.getUI().find("#"+g);if(l.length)return l.finderdialog("toTop"),d.resolve();if(!a.read||!a.write)return l=["errOpen",a.name,"errPerm"],b.error(l),d.reject(l);b.request({data:{cmd:"get",target:c},notify:{type:"openfile",cnt:1},syncOnFail:!0}).done(function(l){e(g,a,l.content).done(function(a){b.request({options:{type:"post"},data:{cmd:"put",
target:c,content:a},notify:{type:"save",cnt:1},syncOnFail:!0}).fail(function(a){d.reject(a)}).done(function(a){a.changed&&a.changed.length&&b.change(a);d.resolve(a)})})}).fail(function(a){d.reject(a)});return d.promise()};this.shortcuts=[{pattern:"ctrl+e"}];this.init=function(){this.onlyMimes=this.options.mimes||[]};this.getstate=function(a){a=this.files(a);var b=a.length;return!this._disabled&&b&&d(a).length==b?0:-1};this.exec=function(a){a=d(this.files(a));var b=[],c;if(this.disabled())return $.Deferred().reject();
for(;c=a.shift();)b.push(g(c));return b.length?$.when.apply(null,b):$.Deferred().reject()}};"use strict";
Finder.prototype.commands.extract=function(){var a=this,b=a.fm,c=[],d=function(a){return $.map(a,function(a){return a.read&&-1!==$.inArray(a.mime,c)?a:null})};this.disableOnSearch=!0;b.bind("open reload",function(){c=b.option("archivers").extract||[];a.change()});this.getstate=function(a){a=this.files(a);var b=a.length;return!this._disabled&&b&&this.fm.cwd().write&&d(a).length==b?0:-1};this.exec=function(a){a=this.files(a);var d=$.Deferred(),f=a.length,h=f,k,m;if(!(this.enabled()&&f&&c.length))return d.reject();
for(k=0;k<f;k++){m=a[k];if(!m.read||!b.file(m.phash).write)return a=["errExtract",m.name,"errPerm"],b.error(a),d.reject(a);if(-1===$.inArray(m.mime,c))return a=["errExtract",m.name,"errNoArchive"],b.error(a),d.reject(a);b.request({data:{cmd:"extract",target:m.hash},notify:{type:"extract",cnt:1},syncOnFail:!0}).fail(function(a){"rejected"!=d.state()&&d.reject(a)}).done(function(){h--;0==h&&d.resolve()})}return d}};
Finder.prototype.commands.forward=function(){this.updateOnSelect=this.alwaysEnabled=!0;this.shortcuts=[{pattern:"ctrl+right"}];this.getstate=function(){return this.fm.history.canForward()?0:-1};this.exec=function(){return this.fm.history.forward()}};"use strict";
Finder.prototype.commands.getfile=function(){var a=this,b=this.fm,c=function(b){var c=a.options;b=$.map(b,function(a){return"directory"!=a.mime||c.folders?a:null});return c.multiple||1==b.length?b:[]};this.alwaysEnabled=!0;this.callback=b.options.getFileCallback;this._disabled="function"==typeof this.callback;this.getstate=function(a){a=this.files(a);var b=a.length;return this.callback&&b&&c(a).length==b?0:-1};this.exec=function(b){var c=this.fm,g=this.options,f=this.files(b);b=f.length;var h=c.option("url"),
k=c.option("tmbUrl"),m=$.Deferred().done(function(b){c.trigger("getfile",{files:b});a.callback(b,c);"close"==g.oncomplete?c.hide():"destroy"==g.oncomplete&&c.destroy()}),l=[],q,p,t;if(-1==this.getstate())return m.reject();for(q=0;q<b;q++){p=f[q];if("directory"==p.mime&&!g.folders)return m.reject();p.baseUrl=h;p.url=c.url(p.hash);p.path=c.path(p.hash);p.tmb&&1!=p.tmb&&(p.tmb=k+p.tmb);p.width||p.height||(p.dim?(t=p.dim.split("x"),p.width=t[0],p.height=t[1]):-1!==p.mime.indexOf("image")&&l.push(c.request({data:{cmd:"dim",
target:p.hash},preventDefault:!0}).done($.proxy(function(a){a.dim&&(t=a.dim.split("x"),this.width=t[0],this.height=t[1]);this.dim=a.dim},f[q]))))}return l.length?($.when.apply(null,l).always(function(){m.resolve(g.multiple?f:f[0])}),m):m.resolve(g.multiple?f:f[0])}};"use strict";
Finder.prototype.commands.help=function(){var a=this.fm,b=this,c=/\{url\}/,d=/\{link\}/,e=['<div class="ui-tabs ui-widget ui-widget-content ui-corner-all finder-help">','<ul class="ui-tabs-nav ui-helper-reset ui-helper-clearfix ui-widget-header ui-corner-all">'],g=function(){var b=a.shortcuts();e.push('<div id="shortcuts" class="ui-tabs-panel ui-widget-content ui-corner-bottom">');b.length?(e.push('<div class="ui-widget-content finder-help-shortcuts">'),$.each(b,function(a,b){e.push('<div class="finder-help-shortcut"><div class="finder-help-shortcut-pattern">{pattern}</div> {descrip}</div>'.replace(/\{pattern\}/,
b[0]).replace(/\{descrip\}/,b[1]))}),e.push("</div>")):e.push('<div class="finder-help-disabled">'+a.i18n("shortcutsof")+"</div>");e.push("</div>")},f;this.alwaysEnabled=!0;this.updateOnSelect=!1;this.state=0;this.shortcuts=[{pattern:"f1",description:this.title}];setTimeout(function(){var h=b.options.view||["about","shortcuts","help"];$.each(h,function(b,c){e.push('<li class="ui-state-default ui-corner-top"><a href="#{id}">{title}</a></li>'.replace(/\{id\}/,c).replace(/\{title\}/,a.i18n(c)))});e.push("</ul>");
-1!==$.inArray("about",h)&&(e.push('<div id="about" class="ui-tabs-panel ui-widget-content ui-corner-bottom">'),e.push("<h3>gpFinder</h3>"),e.push('<div class="ui-priority-primary">'+a.i18n("webfm")+"</div>"),e.push('<div class="ui-priority-secondary">'+a.i18n("ver")+": "+a.version+' <span id="apiver"></span></div>'),e.push('<div class="ui-priority-secondary">jQuery/jQuery UI: '+$().jquery+"/"+$.ui.version+"</div>"),e.push('<div class="finder-help-separator"/>'),e.push('<div class="finder-help-link"> <a href="{url}">{link}</a></div>'.replace(c,
"https://github.com/oyejorge/gpFinder/wiki").replace(d,a.i18n("docs"))),e.push('<div class="finder-help-link"> <a href="{url}">{link}</a></div>'.replace(c,"https://github.com/oyejorge/gpFinder/issues").replace(d,"Issues")),e.push('<div class="finder-help-link"> <a href="{url}">{link}</a></div>'.replace(c,"https://github.com/oyejorge/gpFinder").replace(d,a.i18n("github"))),e.push('<div class="finder-help-link"> <a href="{url}">{link}</a></div>'.replace(c,"https://elfinder.org").replace(d,"gpFinder is an adaptation of elFinder")),
e.push('<div class="finder-help-separator"/>'),e.push('<div class="finder-help-separator"/>'),e.push('<div class="finder-help-license">'+a.i18n("icons")+': <a href="http://pixelmixer.ru/" target="_blank">Pixelmixer</a>, <a href="http://p.yusukekamiyamane.com" target="_blank">Fugue</a></div>'),e.push('<div class="finder-help-separator"/>'),e.push('<div class="finder-help-license">Licence: BSD Licence</div>'),e.push('<div class="finder-help-license">Copyright \u00a9 2009-2011, Studio 42</div>'),e.push('<div class="finder-help-license">\u201e \u2026'+
a.i18n("dontforget")+" \u201d</div>"),e.push("</div>"));-1!==$.inArray("shortcuts",h)&&g();-1!==$.inArray("help",h)&&(e.push('<div id="help" class="ui-tabs-panel ui-widget-content ui-corner-bottom">'),e.push('<a href="http://gpfinder.org/index.php/Forum" target="_blank" class="finder-dont-panic"><span>DON\'T PANIC</span></a>'),e.push("</div>"));e.push("</div>");f=$(e.join(""));a.one("load",function(){f.find("#apiver").text(a.api)});f.find(".ui-tabs-nav li").hover(function(){$(this).toggleClass("ui-state-hover")}).children().click(function(a){var b=
$(this);a.preventDefault();a.stopPropagation();b.is(".ui-tabs-selected")||(b.parent().addClass("ui-tabs-selected ui-state-active").siblings().removeClass("ui-tabs-selected").removeClass("ui-state-active"),f.find(".ui-tabs-panel").hide().filter(b.attr("href")).show())}).filter(":first").click()},200);this.getstate=function(){return 0};this.exec=function(){this.dialog||(this.dialog=this.fm.dialog(f,{title:this.title,width:530,autoOpen:!1,destroyOnClose:!1}));this.dialog.finderdialog("open").find(".ui-tabs-nav li a:first").click()}};
Finder.prototype.commands.home=function(){this.title="Home";this.alwaysEnabled=!0;this.updateOnSelect=!1;this.shortcuts=[{pattern:"ctrl+home ctrl+shift+up",description:"Home"}];this.getstate=function(){var a=this.fm.root(),b=this.fm.cwd().hash;return a&&b&&a!=b?0:-1};this.exec=function(){return this.fm.exec("open",this.fm.root())}};"use strict";
Finder.prototype.commands.info=function(){var a=this.fm,b={calc:a.i18n("calc"),size:a.i18n("size"),unknown:a.i18n("unknown"),path:a.i18n("path"),aliasfor:a.i18n("aliasfor"),modify:a.i18n("modify"),perms:a.i18n("perms"),locked:a.i18n("locked"),dim:a.i18n("dim"),kind:a.i18n("kind"),files:a.i18n("files"),folders:a.i18n("folders"),items:a.i18n("items"),yes:a.i18n("yes"),no:a.i18n("no"),link:a.i18n("link")};this.tpl={main:'<div class="ui-helper-clearfix finder-info-title"><span class="finder-cwd-icon {class} ui-corner-all"/>{title}</div><table class="finder-info-tb">{content}</table>',
itemTitle:'<strong>{name}</strong><span class="finder-info-kind">{kind}</span>',groupTitle:"<strong>{items}: {num}</strong>",row:"<tr><td>{label} : </td><td>{value}</td></tr>",spinner:'<span>{text}</span> <span class="finder-info-spinner"/>'};this.alwaysEnabled=!0;this.updateOnSelect=!1;this.shortcuts=[{pattern:"ctrl+i"}];this.init=function(){$.each(b,function(c,d){b[c]=a.i18n(d)})};this.getstate=function(a){a=this.files(a);return a.length?0:-1};this.exec=function(a){var d=this.fm,e=this.tpl,g=e.row,
f=this.files(a),h=f.length;a=[];var k=e.main,m={title:this.title,width:"auto",close:function(){$(this).finderdialog("destroy")}},l=[],q=function(a){t.find(".finder-info-spinner").parent().text(a)},p=d.namespace+"-info-"+$.map(f,function(a){return a.hash}).join("-"),t=d.getUI().find("#"+p),n,u,w,y;if(!h)return $.Deferred().reject();if(t.length)return t.finderdialog("toTop"),$.Deferred().resolve();1==h?(f=f[0],k=k.replace("{class}",d.mime2class(f.mime)),w=e.itemTitle.replace("{name}",f.name).replace("{kind}",
d.mime2kind(f)),f.tmb&&(u=d.option("tmbUrl")+f.tmb),f.read?"directory"!=f.mime||f.alias?n=d.formatSize(f.size):(n=e.spinner.replace("{text}",b.calc),l.push(f.hash)):n=b.unknown,a.push(g.replace("{label}",b.size).replace("{value}",n)),f.alias&&a.push(g.replace("{label}",b.aliasfor).replace("{value}",f.alias)),a.push(g.replace("{label}",b.path).replace("{value}",d.escape(d.path(f.hash)))),f.read&&a.push(g.replace("{label}",b.link).replace("{value}",'<a href="'+d.url(f.hash)+'" target="_blank">'+f.name+
"</a>")),f.dim?a.push(g.replace("{label}",b.dim).replace("{value}",f.dim)):-1!==f.mime.indexOf("image")&&(f.width&&f.height?a.push(g.replace("{label}",b.dim).replace("{value}",f.width+"x"+f.height)):(a.push(g.replace("{label}",b.dim).replace("{value}",e.spinner.replace("{text}",b.calc))),d.request({data:{cmd:"dim",target:f.hash},preventDefault:!0}).fail(function(){q(b.unknown)}).done(function(a){q(a.dim||b.unknown)}))),a.push(g.replace("{label}",b.modify).replace("{value}",d.formatDate(f))),a.push(g.replace("{label}",
b.perms).replace("{value}",d.formatPermissions(f))),a.push(g.replace("{label}",b.locked).replace("{value}",f.locked?b.yes:b.no))):(k=k.replace("{class}","finder-cwd-icon-group"),w=e.groupTitle.replace("{items}",b.items).replace("{num}",h),(y=$.map(f,function(a){return"directory"==a.mime?1:null}).length)?(a.push(g.replace("{label}",b.kind).replace("{value}",y==h?b.folders:b.folders+" "+y+", "+b.files+" "+(h-y))),a.push(g.replace("{label}",b.size).replace("{value}",e.spinner.replace("{text}",b.calc))),
l=$.map(f,function(a){return a.hash})):(n=0,$.each(f,function(a,b){var c=parseInt(b.size);n=0<=c&&0<=n?n+c:"unknown"}),a.push(g.replace("{label}",b.kind).replace("{value}",b.files)),a.push(g.replace("{label}",b.size).replace("{value}",d.formatSize(n)))));k=k.replace("{title}",w).replace("{content}",a.join(""));t=d.dialog(k,m);t.attr("id",p);u&&$("<img/>").load(function(){t.find(".finder-cwd-icon").css("background",'url("'+u+'") center center no-repeat')}).attr("src",u);l.length&&d.request({data:{cmd:"size",
targets:l},preventDefault:!0}).fail(function(){q(b.unknown)}).done(function(a){a=parseInt(a.size);q(0<=a?d.formatSize(a):b.unknown)})}};"use strict";Finder.prototype.commands.mkdir=function(){this.disableOnSearch=!0;this.updateOnSelect=!1;this.mime="directory";this.prefix="untitled folder";this.exec=$.proxy(this.fm.res("mixin","make"),this);this.shortcuts=[{pattern:"ctrl+shift+n"}];this.getstate=function(){return!this._disabled&&this.fm.cwd().write?0:-1}};"use strict";
Finder.prototype.commands.mkfile=function(){this.disableOnSearch=!0;this.updateOnSelect=!1;this.mime="text/plain";this.prefix="untitled file.txt";this.exec=$.proxy(this.fm.res("mixin","make"),this);this.getstate=function(){return!this._disabled&&this.fm.cwd().write?0:-1}};"use strict";
Finder.prototype.commands.netmount=function(){var a=this;this.alwaysEnabled=!0;this.updateOnSelect=!1;this.drivers=[];this.handlers={load:function(){this.drivers=this.fm.netDrivers}};this.getstate=function(){return this.drivers.length?0:-1};this.exec=function(){var b=a.fm,c=$.Deferred();a.dialog||(a.dialog=function(){var d={protocol:$("<select/>"),host:$('<input type="text"/>'),port:$('<input type="text"/>'),path:$('<input type="text" value="/"/>'),user:$('<input type="text"/>'),pass:$('<input type="password"/>')},
e={title:b.i18n("netMountDialogTitle"),resizable:!1,modal:!0,destroyOnClose:!0,close:function(){delete a.dialog;"resolved"!=c.state()&&"rejected"!=c.state()&&c.reject()},buttons:{}},g=$('<table class="finder-info-tb finder-netmount-tb"/>');$.each(a.drivers,function(a,c){d.protocol.append('<option value="'+c+'">'+b.i18n(c)+"</option>")});$.each(d,function(a,c){"protocol"!=a&&c.addClass("ui-corner-all");g.append($("<tr/>").append($("<td>"+b.i18n(a)+"</td>")).append($("<td/>").append(c)))});e.buttons[b.i18n("btnMount")]=
function(){var b={cmd:"netmount"};$.each(d,function(a,c){var d=$.trim(c.val());d&&(b[a]=d)});if(!b.host)return a.fm.trigger("error",{error:"errNetMountHostReq"});a.fm.request({data:b,notify:{type:"netmount",cnt:1}}).done(function(){c.resolve()}).fail(function(a){c.reject(a)});a.dialog.finderdialog("close")};e.buttons[b.i18n("btnCancel")]=function(){a.dialog.finderdialog("close")};return b.dialog(g,e)}());return c.promise()}};"use strict";
Finder.prototype.commands.open=function(){this.alwaysEnabled=!0;this._handlers={dblclick:function(a){a.preventDefault();this.exec()},"select enable disable reload":function(a){this.update("disable"==a.type?-1:void 0)}};this.shortcuts=[{pattern:"ctrl+down numpad_enter"+("mac"!=this.fm.OS&&" enter")}];this.getstate=function(a){a=this.files(a);var b=a.length;return 1==b?0:b?$.map(a,function(a){return"directory"==a.mime?null:a}).length==b?0:-1:-1};this.exec=function(a){var b=this.fm,c=$.Deferred().fail(function(a){a&&
b.error(a)}),d=this.files(a),e=d.length,g,f,h;if(!e)return c.reject();if(1==e&&(g=d[0])&&"directory"==g.mime)return g&&!g.read?c.reject(["errOpen",g.name,"errPerm"]):b.request({data:{cmd:"open",target:g.thash||g.hash},notify:{type:"open",cnt:1,hideCnt:!0},syncOnFail:!0});d=$.map(d,function(a){return"directory"!=a.mime?a:null});if(e!=d.length)return c.reject();for(e=d.length;e--;){g=d[e];if(!g.read)return c.reject(["errOpen",g.name,"errPerm"]);(f=b.url(g.hash))||(f=b.options.url,f=f+(-1===f.indexOf("?")?
"?":"&")+"cmd=file&target="+g.hash);h="";g.dim?(g=g.dim.split("x"),h="width="+(parseInt(g[0])+20)+",height="+(parseInt(g[1])+20)):h="width="+parseInt(2*$(window).width()/3)+",height="+parseInt(2*$(window).height()/3);if(!window.open(f,"_blank",h+",top=50,left=50,scrollbars=yes,resizable=yes"))return c.reject("errPopup")}return c.resolve(a)}};"use strict";
Finder.prototype.commands.paste=function(){this.updateOnSelect=!1;this.handlers={changeclipboard:function(){this.update()}};this.shortcuts=[{pattern:"ctrl+v shift+insert"}];this.getstate=function(a){if(this._disabled)return-1;if(a){if($.isArray(a)){if(1!=a.length)return-1;a=this.fm.file(a[0])}}else a=this.fm.cwd();return"directory"==a.mime&&a.write?0:-1};this.exec=function(a){var b=this,c=b.fm;a=a?this.files(a)[0]:c.cwd();var d=c.clipboard(),e=d.length,g=e?d[0].cut:!1,f=g?"errMove":"errCopy",h=[],
k=[],m=$.Deferred().fail(function(a){a&&c.error(a)}),l,q;if(!e||!a||"directory"!=a.mime)return m.reject();if(!a.write)return m.reject([f,d[0].name,"errPerm"]);l=c.parents(a.hash);$.each(d,function(b,e){if(!e.read)return!m.reject([f,d[0].name,"errPerm"]);if(g&&e.locked)return!m.reject(["errLocked",e.name]);if(-1!==$.inArray(e.hash,l))return!m.reject(["errCopyInItself",e.name]);q=c.parents(e.hash);if(-1!==$.inArray(a.hash,q)&&$.map(q,function(b){b=c.file(b);return b.phash==a.hash&&b.name==e.name?b:
null}).length)return!m.reject(["errReplByChild",e.name]);e.phash==a.hash?k.push(e.hash):h.push({hash:e.hash,phash:e.phash,name:e.name})});return"rejected"==m.state()?m:$.when(k.length&&c._commands.duplicate?c.exec("duplicate",k):$.Deferred().resolve(),function(d){var e=$.Deferred(),f=[],h=function(a){var b=d[f[a]],k=a==f.length-1;b&&c.confirm({title:c.i18n(g?"moveFiles":"copyFiles"),text:c.i18n(["errExists",b.name,"confirmRepl"]),all:!k,accept:{label:"btnYes",callback:function(b){k||b?l(d):h(++a)}},
reject:{label:"btnNo",callback:function(b){var c;if(b)for(c=f.length;a<c--;)d[f[c]].remove=!0;else d[f[a]].remove=!0;k||b?l(d):h(++a)}},cancel:{label:"btnCancel",callback:function(){e.resolve()}}})},k=function(a){for(var b=[],c=d.length;c--;)-1!==$.inArray(d[c].name,a)&&b.unshift(c);f=b;f.length?h(0):l(d)},l=function(b){b=$.map(b,function(a){return a.remove?null:a});var d=b.length,f;if(!d)return e.resolve();f=b[0].phash;b=$.map(b,function(a){return a.hash});c.request({data:{cmd:"paste",dst:a.hash,
targets:b,cut:g?1:0,src:f},notify:{type:g?"move":"copy",cnt:d}}).always(function(){e.resolve();c.unlockfiles({files:b})})};if(b._disabled||!d.length)return e.resolve();c.option("copyOverwrite")?a.hash==c.cwd().hash?k($.map(c.files(),function(b){return b.phash==a.hash?b.name:null})):c.request({data:{cmd:"ls",target:a.hash},notify:{type:"prepare",cnt:1,hideCnt:!0},preventFail:!0}).always(function(a){k(a.list||[])}):l(d);return e}(h)).always(function(){g&&c.clipboard([])})}};"use strict";
Finder.prototype.commands.quicklook=function(){var a=this,b=a.fm,c=0,d=function(a){$(document).trigger($.Event("keydown",{keyCode:a,ctrlKey:!1,shiftKey:!1,altKey:!1,metaKey:!1}))},e=function(a){return{opacity:0,width:20,height:"list"==b.view?1:20,top:a.offset().top,left:a.offset().left}},g=function(){var a=$(window);return{opacity:1,width:h,height:k,top:parseInt((a.height()-k)/2+a.scrollTop()),left:parseInt((a.width()-h)/2+a.scrollLeft())}},f=function(a){var b=document.createElement(a.substr(0,a.indexOf("/"))),
c=!1;try{c=b.canPlayType&&b.canPlayType(a)}catch(d){}return c&&""!==c&&"no"!=c},h,k,m,l,q=$('<div class="finder-quicklook-title"/>'),p=$("<div/>"),t=$('<div class="finder-quicklook-info"/>'),n=$('<div class="finder-quicklook-navbar-icon finder-quicklook-navbar-icon-fullscreen"/>').mousedown(function(c){var d=a.window,e=d.is(".finder-quicklook-fullscreen"),f="scroll."+b.namespace,g=$(window);c.stopPropagation();e?(d.css(d.data("position")).unbind("mousemove"),g.unbind(f).trigger(a.resize).unbind(a.resize),
u.unbind("mouseenter").unbind("mousemove")):(d.data("position",{left:d.css("left"),top:d.css("top"),width:d.width(),height:d.height()}).css({width:"100%",height:"100%"}),$(window).bind(f,function(){d.css({left:parseInt($(window).scrollLeft()),top:parseInt($(window).scrollTop())})}).bind(a.resize,function(b){a.preview.trigger("changesize")}).trigger(f).trigger(a.resize),d.bind("mousemove",function(a){u.stop(!0,!0).show().delay(3E3).fadeOut("slow")}).mousemove(),u.mouseenter(function(){u.stop(!0,!0).show()}).mousemove(function(a){a.stopPropagation()}));
u.attr("style","");e?u.filter(":ui-draggable").draggable("destroy"):u.draggable({});d.toggleClass("finder-quicklook-fullscreen");$(this).toggleClass("finder-quicklook-navbar-icon-fullscreen-off");$.fn.resizable&&m.add(d).resizable(e?"enable":"disable").removeClass("ui-state-disabled")}),u=$('<div class="finder-quicklook-navbar"/>').append($('<div class="finder-quicklook-navbar-icon finder-quicklook-navbar-icon-prev"/>').mousedown(function(){d(37)})).append(n).append($('<div class="finder-quicklook-navbar-icon finder-quicklook-navbar-icon-next"/>').mousedown(function(){d(39)})).append('<div class="finder-quicklook-navbar-separator"/>').append($('<div class="finder-quicklook-navbar-icon finder-quicklook-navbar-icon-close"/>').mousedown(function(){a.window.trigger("close")}));
this.resize="resize."+b.namespace;this.info=$('<div class="finder-quicklook-info-wrapper"/>').append(p).append(t);this.preview=$('<div class="finder-quicklook-preview ui-helper-clearfix"/>').bind("change",function(b){a.info.attr("style","").hide();p.removeAttr("class").attr("style","");t.html("")}).bind("update",function(b){var c=a.fm,d=b.file,e;d?(!d.read&&b.stopImmediatePropagation(),a.window.data("hash",d.hash),a.preview.unbind("changesize").trigger("change").children().remove(),q.html(c.escape(d.name)),
t.html('<div class="finder-quicklook-info-data">{value}</div>'.replace(/\{value\}/,d.name)+'<div class="finder-quicklook-info-data">{value}</div>'.replace(/\{value\}/,c.mime2kind(d))+("directory"==d.mime?"":'<div class="finder-quicklook-info-data">{value}</div>'.replace(/\{value\}/,c.formatSize(d.size)))+'<div class="finder-quicklook-info-data">{value}</div>'.replace(/\{value\}/,c.i18n("modify")+": "+c.formatDate(d))),p.addClass("finder-cwd-icon ui-corner-all "+c.mime2class(d.mime)),d.tmb&&$("<img/>").hide().appendTo(a.preview).load(function(){p.css("background",
'url("'+e+'") center center no-repeat');$(this).remove()}).attr("src",e=c.tmb(d.hash)),a.info.delay(100).fadeIn(10)):b.stopImmediatePropagation()});this.window=$('<div class="ui-helper-reset ui-widget finder-quicklook" style="position:absolute"/>').click(function(a){a.stopPropagation()}).append($('<div class="finder-quicklook-titlebar"/>').append(q).append($('<span class="ui-icon ui-icon-circle-close"/>').mousedown(function(b){b.stopPropagation();a.window.trigger("close")}))).append(this.preview.add(u)).append(a.info.hide()).draggable({handle:"div.finder-quicklook-titlebar"}).bind("open",
function(b){b=a.window;var d=a.value,f;a.closed()&&d&&(f=l.find("#"+d.hash)).length&&(c=1,f.trigger("scrolltoview"),b.css(e(f)).show().animate(g(),550,function(){c=2;a.update(1,a.value)}))}).bind("close",function(b){var d=a.window,f=a.preview.trigger("change");b=l.find("#"+d.data("hash"));var g=function(){c=0;d.hide();f.children().remove();a.update(0,a.value)};a.opened()&&(c=1,d.is(".finder-quicklook-fullscreen")&&n.mousedown(),b.length?d.animate(e(b),500,g):g())});this.alwaysEnabled=!0;this.value=
null;this.handlers={select:function(){this.update(void 0,this.fm.selectedFiles()[0])},error:function(){a.window.is(":visible")&&a.window.data("hash","").trigger("close")},"searchshow searchhide":function(){this.opened()&&this.window.trigger("close")}};this.shortcuts=[{pattern:"space"}];this.support={audio:{ogg:f('audio/ogg; codecs="vorbis"'),mp3:f("audio/mpeg;"),wav:f('audio/wav; codecs="1"'),m4a:f("audio/x-m4a;")||f("audio/aac;")},video:{ogg:f('video/ogg; codecs="theora"'),webm:f('video/webm; codecs="vp8, vorbis"'),
mp4:f('video/mp4; codecs="avc1.42E01E"')||f('video/mp4; codecs="avc1.42E01E, mp4a.40.2"')}};this.closed=function(){return 0==c};this.opened=function(){return 2==c};this.init=function(){var c=this.options,d=this.window,e=this.preview;h=0<c.width?parseInt(c.width):450;k=0<c.height?parseInt(c.height):300;b.one("load",function(){m=b.getUI();l=b.getUI("cwd");d.appendTo("body").zIndex(100+m.zIndex());$(document).keydown(function(b){27==b.keyCode&&a.opened()&&d.trigger("close")});$.fn.resizable&&d.resizable({handles:"se",
minWidth:350,minHeight:120,resize:function(){e.trigger("changesize")}});a.change(function(){a.opened()&&(a.value?e.trigger($.Event("update",{file:a.value})):d.trigger("close"))});$.each(b.commands.quicklook.plugins||[],function(b,c){"function"==typeof c&&new c(a)});e.bind("update",function(){a.info.show()})})};this.getstate=function(){return 1==this.fm.selected().length?2==c?1:0:-1};this.exec=function(){this.enabled()&&this.window.trigger(this.opened()?"close":"open")};this.hideinfo=function(){this.info.stop(!0).hide()}};
Finder.prototype.commands.quicklook.plugins=[function(a){var b=["image/jpeg","image/png","image/gif"],c=a.preview;$.each(navigator.mimeTypes,function(a,c){var g=c.type;0===g.indexOf("image/")&&$.inArray(g,b)&&b.push(g)});c.bind("update",function(d){var e=d.file,g;-1!==$.inArray(e.mime,b)&&(d.stopImmediatePropagation(),g=$("<img/>").hide().appendTo(c).load(function(){setTimeout(function(){var b=(g.width()/g.height()).toFixed(2);c.bind("changesize",function(){var a=parseInt(c.width()),d=parseInt(c.height()),
e;b<(a/d).toFixed(2)?(e=d,a=Math.floor(e*b)):e=Math.floor(a/b);g.width(a).height(e).css("margin-top",e<d?Math.floor((d-e)/2):0)}).trigger("changesize");a.hideinfo();g.fadeIn(100)},1)}).attr("src",a.fm.url(e.hash)))})},function(a){var b=["text/html","application/xhtml+xml"],c=a.preview,d=a.fm;c.bind("update",function(e){var g=e.file,f;-1!==$.inArray(g.mime,b)&&(e.stopImmediatePropagation(),c.one("change",function(){"resolved"!=f.state()&&"rejected"!=f.state()&&f.reject()}),f=d.request({data:{cmd:"get",
target:g.hash,current:g.phash},preventDefault:!0}).done(function(b){a.hideinfo();doc=$('<iframe class="finder-quicklook-preview-html"/>').appendTo(c)[0].contentWindow.document;doc.open();doc.write(b.content);doc.close()}))})},function(a){var b=a.fm,c=b.res("mimes","text"),d=a.preview;d.bind("update",function(e){var g=e.file,f=g.mime,h;if(0===f.indexOf("text/")||-1!==$.inArray(f,c))e.stopImmediatePropagation(),d.one("change",function(){"resolved"!=h.state()&&"rejected"!=h.state()&&h.reject()}),h=b.request({data:{cmd:"get",
target:g.hash},preventDefault:!0}).done(function(c){a.hideinfo();$('<div class="finder-quicklook-preview-text-wrapper"><pre class="finder-quicklook-preview-text">'+b.escape(c.content)+"</pre></div>").appendTo(d)})})},function(a){var b=a.fm,c=a.preview,d=!1;b.UA.Safari&&"mac"==b.OS||b.UA.IE?d=!0:$.each(navigator.plugins,function(a,b){$.each(b,function(a,b){if("application/pdf"==b.type)return!(d=!0)})});d&&c.bind("update",function(d){var g=d.file,f;"application/pdf"==g.mime&&(d.stopImmediatePropagation(),
c.one("change",function(){f.unbind("load").remove()}),f=$('<iframe class="finder-quicklook-preview-pdf"/>').hide().appendTo(c).load(function(){a.hideinfo();f.show()}).attr("src",b.url(g.hash)))})},function(a){var b=a.fm,c=a.preview,d=!1;$.each(navigator.plugins,function(a,b){$.each(b,function(a,b){if("application/x-shockwave-flash"==b.type)return!(d=!0)})});d&&c.bind("update",function(d){var g=d.file;"application/x-shockwave-flash"==g.mime&&(d.stopImmediatePropagation(),a.hideinfo(),c.append($('<embed class="finder-quicklook-preview-flash" pluginspage="http://www.macromedia.com/go/getflashplayer" src="'+
b.url(g.hash)+'" quality="high" type="application/x-shockwave-flash" />')))})},function(a){var b=a.preview,c=!!a.options.autoplay,d={"audio/mpeg":"mp3","audio/mpeg3":"mp3","audio/mp3":"mp3","audio/x-mpeg3":"mp3","audio/x-mp3":"mp3","audio/x-wav":"wav","audio/wav":"wav","audio/x-m4a":"m4a","audio/aac":"m4a","audio/mp4":"m4a","audio/x-mp4":"m4a","audio/ogg":"ogg"},e;b.bind("update",function(g){var f=g.file;a.support.audio[d[f.mime]]&&(g.stopImmediatePropagation(),e=$('<audio class="finder-quicklook-preview-audio" controls preload="auto" autobuffer><source src="'+
a.fm.url(f.hash)+'" /></audio>').appendTo(b),c&&e[0].play())}).bind("change",function(){e&&e.parent().length&&(e[0].pause(),e.remove(),e=null)})},function(a){var b=a.preview,c=!!a.options.autoplay,d={"video/mp4":"mp4","video/x-m4v":"mp4","video/ogg":"ogg","application/ogg":"ogg","video/webm":"webm"},e;b.bind("update",function(g){var f=g.file;a.support.video[d[f.mime]]&&(g.stopImmediatePropagation(),a.hideinfo(),e=$('<video class="finder-quicklook-preview-video" controls preload="auto" autobuffer><source src="'+
a.fm.url(f.hash)+'" /></video>').appendTo(b),c&&e[0].play())}).bind("change",function(){e&&e.parent().length&&(e[0].pause(),e.remove(),e=null)})},function(a){var b=a.preview,c=[],d;$.each(navigator.plugins,function(a,b){$.each(b,function(a,b){0!==b.type.indexOf("audio/")&&0!==b.type.indexOf("video/")||c.push(b.type)})});b.bind("update",function(e){var g=e.file,f=g.mime;-1!==$.inArray(g.mime,c)&&(e.stopImmediatePropagation(),(e=0===f.indexOf("video/"))&&a.hideinfo(),d=$('<embed src="'+a.fm.url(g.hash)+
'" type="'+f+'" class="finder-quicklook-preview-'+(e?"video":"audio")+'"/>').appendTo(b))}).bind("change",function(){d&&d.parent().length&&(d.remove(),d=null)})}];
Finder.prototype.commands.reload=function(){this.updateOnSelect=this.alwaysEnabled=!0;this.shortcuts=[{pattern:"ctrl+shift+r f5"}];this.getstate=function(){return 0};this.exec=function(){var a=this.fm,b=a.sync(),c=setTimeout(function(){a.notify({type:"reload",cnt:1,hideCnt:!0});b.always(function(){a.notify({type:"reload",cnt:-1})})},a.notifyDelay);return b.always(function(){clearTimeout(c);a.trigger("reload")})}};"use strict";
Finder.prototype.commands.rename=function(){this.shortcuts=[{pattern:"f2"+("mac"==this.fm.OS?" enter":"")}];this.getstate=function(){var a=this.fm.selectedFiles();return this._disabled||1!=a.length||!a[0].phash||a[0].locked?-1:0};this.exec=function(){var a=this.fm,b=a.getUI("cwd"),c=a.selected(),d=c.length,e=a.file(c.shift()),g=$.Deferred().fail(function(c){var d=f.parent(),g=a.escape(e.name);d.length?(f.remove(),d.html(g)):(b.find("#"+e.hash).find(".finder-cwd-filename").html(g),setTimeout(function(){b.find("#"+
e.hash).click()},50));c&&a.error(c)}).always(function(){a.enable()}),f=$('<input type="text"/>').keydown(function(a){a.stopPropagation();a.stopImmediatePropagation();a.keyCode==$.ui.keyCode.ESCAPE?g.reject():a.keyCode==$.ui.keyCode.ENTER&&f.blur()}).mousedown(function(a){a.stopPropagation()}).dblclick(function(a){a.stopPropagation();a.preventDefault()}).blur(function(){var b=$.trim(f.val()),c=f.parent();if(c.length){f[0].setSelectionRange&&f[0].setSelectionRange(0,0);if(b==e.name)return g.reject();
if(!b)return g.reject("errInvName");if(a.fileByName(b,e.phash))return g.reject(["errExists",b]);c.html(a.escape(b));a.lockfiles({files:[e.hash]});a.request({data:{cmd:"rename",target:e.hash,name:b},notify:{type:"rename",cnt:1}}).fail(function(b){g.reject();a.sync()}).done(function(a){g.resolve(a)}).always(function(){a.unlockfiles({files:[e.hash]})})}}),c=b.find("#"+e.hash).find(".finder-cwd-filename").empty().append(f.val(e.name)),h=f.val().replace(/\.((tar\.(gz|bz|bz2|z|lzo))|cpio\.gz|ps\.gz|xcf\.(gz|bz2)|[a-z0-9]{1,4})$/ig,
"");if(this.disabled())return g.reject();if(!e||1<d||!c.length)return g.reject("errCmdParams",this.title);if(e.locked)return g.reject(["errLocked",e.name]);a.one("select",function(){f.parent().length&&e&&-1===$.inArray(e.hash,a.selected())&&f.blur()});f.select().focus();f[0].setSelectionRange&&f[0].setSelectionRange(0,h.length);return g}};"use strict";
Finder.prototype.commands.resize=function(){this.updateOnSelect=!1;this.getstate=function(){var a=this.fm.selectedFiles();return!this._disabled&&1==a.length&&a[0].read&&a[0].write&&-1!==a[0].mime.indexOf("image/")?0:-1};this.exec=function(a){var b=this.fm;a=this.files(a);var c=$.Deferred(),d,e;if(!a.length||-1===a[0].mime.indexOf("image/"))return c.reject();d="resize-"+b.namespace+"-"+a[0].hash;e=b.getUI().find("#"+d);if(e.length)return e.finderdialog("toTop"),c.resolve();(function(a,d){var e=$('<div class="finder-dialog-resize"/>'),
k=$('<div class="finder-resize-control"/>'),m=$('<div class="finder-resize-preview"/>'),l=$('<div class="finder-resize-spinner">'+b.i18n("ntfloadimg")+"</div>"),q=$('<div class="finder-resize-handle"/>'),p=$('<div class="finder-resize-handle"/>'),t=$('<div class="finder-resize-uiresize"/>'),n=$('<div class="finder-resize-uicrop"/>'),u=$('<div class="finder-resize-rotate"/>'),w=$('<div class="ui-state-default finder-button"/>').attr("title",b.i18n("rotate-cw")).append($('<span class="finder-button-icon finder-button-icon-rotate-l"/>').click(function(){Q-=
90;G.update(Q)})),y=$('<div class="ui-state-default finder-button"/>').attr("title",b.i18n("rotate-ccw")).append($('<span class="finder-button-icon finder-button-icon-rotate-r"/>').click(function(){Q+=90;G.update(Q)})),E=$("<span />"),O=$('<div class="ui-state-default ui-corner-all finder-resize-reset"><span class="ui-icon ui-icon-arrowreturnthick-1-w"/></div>'),N=$('<div class="finder-resize-type"/>').append('<input type="radio" name="type" id="type-resize" value="resize" checked="checked" /><label for="type-resize">'+
b.i18n("resize")+"</label>").append('<input type="radio" name="type" id="type-crop"   value="crop"/><label for="type-crop">'+b.i18n("crop")+"</label>").append('<input type="radio" name="type" id="type-rotate" value="rotate"/><label for="type-rotate">'+b.i18n("rotate")+"</label>");$("input",N).change(function(){var a=$("input:checked",N).val();W();aa(!0);da(!0);ea(!0);"resize"==a?(t.show(),u.hide(),n.hide(),aa()):"crop"==a?(u.hide(),t.hide(),n.show(),da()):"rotate"==a&&(t.hide(),n.hide(),u.show(),
ea())});var T=$('<input type="checkbox" checked="checked"/>').change(function(){V=!!T.prop("checked");r.fixHeight();aa(!0);aa()}),B=$('<input type="text" size="5"/>').change(function(){var a=parseInt(B.val()),b=parseInt(V?a/C:D.val());0<a&&0<b&&(r.updateView(a,b),D.val(b))}),D=$('<input type="text" size="5"/>').change(function(){var a=parseInt(D.val()),b=parseInt(V?a*C:B.val());0<b&&0<a&&(r.updateView(b,a),B.val(b))}),P=$('<input type="text" size="5"/>'),J=$('<input type="text" size="5"/>'),F=$('<input type="text" size="5"/>'),
H=$('<input type="text" size="5"/>'),v=$('<input type="text" size="3" maxlength="3" value="0" />').change(function(){G.update()}),L=$('<div class="finder-resize-rotate-slider"/>').slider({min:0,max:359,value:v.val(),animate:!0,change:function(a,b){b.value!=L.slider("value")&&G.update(b.value)},slide:function(a,b){G.update(b.value,!1)}}),C=1,K=1,x=0,M=0,V=!0,U=0,S=0,X=0,Y=0,Q=0,z=$("<img/>").load(function(){l.remove();x=z.width();M=z.height();C=x/M;r.updateView(x,M);q.append(z.show()).show();B.val(x);
D.val(M);var a=Math.min(U,S)/Math.sqrt(Math.pow(x,2)+Math.pow(M,2));X=x*a;Y=M*a;k.find("input,select").removeAttr("disabled").filter(":text").keydown(function(a){var b=a.keyCode,c;a.stopPropagation();37<=b&&40>=b||b==$.ui.keyCode.BACKSPACE||b==$.ui.keyCode.DELETE||65==b&&(a.ctrlKey||a.metaKey)||27==b||(9==b&&(c=$(this).parent()[a.shiftKey?"prev":"next"](".finder-resize-row").children(":text"),c.length&&c.focus()),13==b?fa():48<=b&&57>=b||96<=b&&105>=b||a.preventDefault())}).filter(":first").focus();
aa();O.hover(function(){O.toggleClass("ui-state-hover")}).click(W)}).error(function(){l.text("Unable to load image").css("background","transparent")}),ba=$("<div/>"),R=$("<img/>"),Z=$("<div/>"),I=$("<img/>"),W=function(){B.val(x);D.val(M);r.updateView(x,M)},r={update:function(){B.val(parseInt(z.width()/K));D.val(parseInt(z.height()/K))},updateView:function(a,b){a>U||b>S?a/U>b/S?z.width(U).height(Math.ceil(z.width()/C)):z.height(S).width(Math.ceil(z.height()*C)):z.width(a).height(b);K=z.width()/a;
E.text("1 : "+(1/K).toFixed(2));r.updateHandle()},updateHandle:function(){q.width(z.width()).height(z.height())},fixWidth:function(){var a;V&&(a=D.val(),a=parseInt(a*C),r.updateView(void 0,a),B.val(void 0))},fixHeight:function(){var a,b;V&&(a=B.val(),b=parseInt(a/C),r.updateView(a,b),D.val(b))}},A={update:function(){F.val(parseInt(p.width()/K));H.val(parseInt(p.height()/K));P.val(parseInt((p.offset().left-R.offset().left)/K));J.val(parseInt((p.offset().top-R.offset().top)/K))},resize_update:function(){A.update();
Z.width(p.width());Z.height(p.height())}},G={mouseStartAngle:0,imageStartAngle:0,imageBeingRotated:!1,update:function(a,c){"undefined"==typeof a&&(Q=a=parseInt(v.val()));"undefined"==typeof c&&(c=!0);!c||b.UA.Opera||b.UA.ltIE8?I.rotate(a):I.animate({rotate:a+"deg"});a%=360;0>a&&(a+=360);v.val(parseInt(a));L.slider("value",v.val())},execute:function(a){if(G.imageBeingRotated){var b=G.getCenter(I),b=Math.atan2(a.pageY-b[1],a.pageX-b[0])-G.mouseStartAngle+G.imageStartAngle,b=Math.round(180*parseFloat(b)/
Math.PI);a.shiftKey&&(b=15*Math.round((b+6)/15));I.rotate(b);b%=360;0>b&&(b+=360);v.val(b);L.slider("value",v.val());return!1}},start:function(a){G.imageBeingRotated=!0;var b=G.getCenter(I);G.mouseStartAngle=Math.atan2(a.pageY-b[1],a.pageX-b[0]);G.imageStartAngle=parseFloat(I.rotate())*Math.PI/180;$(document).mousemove(G.execute);return!1},stop:function(a){if(G.imageBeingRotated)return $(document).unbind("mousemove",G.execute),setTimeout(function(){G.imageBeingRotated=!1},10),!1},getCenter:function(a){a=
I.rotate();I.rotate(0);var b=I.offset(),c=b.left+I.width()/2,b=b.top+I.height()/2;I.rotate(a);return[c,b]}},aa=function(a){$.fn.resizable&&(a?(q.filter(":ui-resizable").resizable("destroy"),q.hide()):(q.show(),q.resizable({alsoResize:z,aspectRatio:V,resize:r.update,stop:r.fixHeight})))},da=function(a){$.fn.draggable&&$.fn.resizable&&(a?(p.filter(":ui-resizable").resizable("destroy"),p.filter(":ui-draggable").draggable("destroy"),ba.hide()):(R.width(z.width()).height(z.height()),Z.width(z.width()).height(z.height()),
p.width(R.width()).height(R.height()).offset(R.offset()).resizable({containment:ba,resize:A.resize_update,handles:"all"}).draggable({handle:p,containment:R,drag:A.update}),ba.show().width(z.width()).height(z.height()),A.update()))},ea=function(a){$.fn.draggable&&$.fn.resizable&&(a?I.hide():I.show().width(X).height(Y).css("margin-top",(S-Y)/2).css("margin-left",(U-X)/2))},fa=function(){var d,f,l,k,m,n=$("input:checked",N).val();B.add(D).change();if("resize"==n)d=parseInt(B.val())||0,f=parseInt(D.val())||
0;else if("crop"==n)d=parseInt(F.val())||0,f=parseInt(H.val())||0,l=parseInt(P.val())||0,k=parseInt(J.val())||0;else{n="rotate";d=x;f=M;m=parseInt(v.val())||0;if(0>m||360<m)return b.error("Invalid rotate degree");if(0==m||360==m)return b.error("Image dose not rotated")}if("rotate"!=n){if(0>=d||0>=f)return b.error("Invalid image size");if(d==x&&f==M)return b.error("Image size not changed")}e.finderdialog("close");b.request({data:{cmd:"resize",target:a.hash,width:d,height:f,x:l,y:k,degree:m,mode:n},
notify:{type:"resize",cnt:1}}).fail(function(a){c.reject(a)}).done(function(){c.resolve()})},ca={},ga=b.url(a.hash);I.mousedown(G.start);$(document).mouseup(G.stop);t.append($('<div class="finder-resize-row"/>').append($('<div class="finder-resize-label"/>').text(b.i18n("width"))).append(B).append(O)).append($('<div class="finder-resize-row"/>').append($('<div class="finder-resize-label"/>').text(b.i18n("height"))).append(D)).append($('<div class="finder-resize-row"/>').append($("<label/>").text(b.i18n("aspectRatio")).prepend(T))).append($('<div class="finder-resize-row"/>').append(b.i18n("scale")+
" ").append(E));n.append($('<div class="finder-resize-row"/>').append($('<div class="finder-resize-label"/>').text("X")).append(P)).append($('<div class="finder-resize-row"/>').append($('<div class="finder-resize-label"/>').text("Y")).append(J)).append($('<div class="finder-resize-row"/>').append($('<div class="finder-resize-label"/>').text(b.i18n("width"))).append(F)).append($('<div class="finder-resize-row"/>').append($('<div class="finder-resize-label"/>').text(b.i18n("height"))).append(H));u.append($('<div class="finder-resize-row"/>').append($('<div class="finder-resize-label"/>').text(b.i18n("rotate"))).append($('<div style="float:left; width: 130px;">').append($('<div style="float:left;">').append(v).append($("<span/>").text(b.i18n("degree")))).append($('<div class="ui-widget-content ui-corner-all finder-buttonset"/>').append(w).append($('<span class="ui-widget-content finder-toolbar-button-separator"/>')).append(y))).append(L));
e.append(N);k.append($('<div class="finder-resize-row"/>')).append(t).append(n.hide()).append(u.hide()).find("input,select").attr("disabled","disabled");q.append('<div class="finder-resize-handle-hline finder-resize-handle-hline-top"/>').append('<div class="finder-resize-handle-hline finder-resize-handle-hline-bottom"/>').append('<div class="finder-resize-handle-vline finder-resize-handle-vline-left"/>').append('<div class="finder-resize-handle-vline finder-resize-handle-vline-right"/>').append('<div class="finder-resize-handle-point finder-resize-handle-point-e"/>').append('<div class="finder-resize-handle-point finder-resize-handle-point-se"/>').append('<div class="finder-resize-handle-point finder-resize-handle-point-s"/>');
m.append(l).append(q.hide()).append(z.hide());p.css("position","absolute").append('<div class="finder-resize-handle-hline finder-resize-handle-hline-top"/>').append('<div class="finder-resize-handle-hline finder-resize-handle-hline-bottom"/>').append('<div class="finder-resize-handle-vline finder-resize-handle-vline-left"/>').append('<div class="finder-resize-handle-vline finder-resize-handle-vline-right"/>').append('<div class="finder-resize-handle-point finder-resize-handle-point-n"/>').append('<div class="finder-resize-handle-point finder-resize-handle-point-e"/>').append('<div class="finder-resize-handle-point finder-resize-handle-point-s"/>').append('<div class="finder-resize-handle-point finder-resize-handle-point-w"/>').append('<div class="finder-resize-handle-point finder-resize-handle-point-ne"/>').append('<div class="finder-resize-handle-point finder-resize-handle-point-se"/>').append('<div class="finder-resize-handle-point finder-resize-handle-point-sw"/>').append('<div class="finder-resize-handle-point finder-resize-handle-point-nw"/>');
m.append(ba.css("position","absolute").hide().append(R).append(p.append(Z)));m.append(I.hide());m.css("overflow","hidden");e.append(m).append(k);ca[b.i18n("btnCancel")]=function(){e.finderdialog("close")};ca[b.i18n("btnApply")]=fa;b.dialog(e,{title:a.name,width:650,resizable:!1,destroyOnClose:!0,buttons:ca,open:function(){m.zIndex(1+$(this).parent().zIndex())}}).attr("id",d);b.UA.ltIE8&&$(".finder-dialog").css("filter","");O.css("left",B.position().left+B.width()+12);Z.css({opacity:.2,"background-color":"#fff",
position:"absolute"});p.css("cursor","move");p.find(".finder-resize-handle-point").css({"background-color":"#fff",opacity:.5,"border-color":"#000"});I.css("cursor","pointer");N.buttonset();U=m.width()-(q.outerWidth()-q.width());S=m.height()-(q.outerHeight()-q.height());z.attr("src",ga+(-1===ga.indexOf("?")?"?":"&")+"_="+Math.random());R.attr("src",z.attr("src"));I.attr("src",z.attr("src"))})(a[0],d);return c}};
(function(a){var b=function(a,b){var c=0;for(c in b)if("undefined"!=typeof a[b[c]])return b[c];a[b[c]]="";return b[c]};a.cssHooks.rotate={get:function(b,c,g){return a(b).rotate()},set:function(b,c){a(b).rotate(c);return c}};a.cssHooks.transform={get:function(a,c,g){c=b(a.style,["WebkitTransform","MozTransform","OTransform","msTransform","transform"]);return a.style[c]},set:function(a,c){var g=b(a.style,["WebkitTransform","MozTransform","OTransform","msTransform","transform"]);return a.style[g]=c}};
a.fn.rotate=function(a){if("undefined"==typeof a)return window.opera?(a=this.css("transform").match(/rotate\((.*?)\)/))&&a[1]?Math.round(180*parseFloat(a[1])/Math.PI):0:(a=this.css("transform").match(/rotate\((.*?)\)/))&&a[1]?parseInt(a[1]):0;this.css("transform",this.css("transform").replace(/none|rotate\(.*?\)/,"")+"rotate("+parseInt(a)+"deg)");return this};a.fx.step.rotate=function(b){0==b.state&&(b.start=a(b.elem).rotate(),b.now=b.start);a(b.elem).rotate(b.now)};if("undefined"==typeof window.addEventListener&&
"undefined"==typeof document.getElementsByClassName){var c=a.cssHooks.transform.set;a.cssHooks.transform.set=function(a,b){c.apply(this,[a,b]);var g,f=1,h=1,k=1,m=1;if("undefined"==typeof a.style.msTransform){if("static"==a.currentStyle.position){g=a;for(var l=g.offsetLeft,q=g.offsetTop;g.offsetParent;){g=g.offsetParent;if(g!=document.body&&"static"!=g.currentStyle.position)break;g!=document.body&&g!=document.documentElement&&(l-=g.scrollLeft,q-=g.scrollTop);l+=g.offsetLeft;q+=g.offsetTop}a.style.position=
"absolute";a.style.left=l+"px";a.style.top=q+"px"}g=(g=b.match(/rotate\((.*?)\)/))&&g[1]?parseInt(g[1]):0;g%=360;0>g&&(g=360+g);l=g*Math.PI/180;q=Math.cos(l);l=Math.sin(l);f*=q;h*=-l;k*=l;m*=q;a.style.filter=(a.style.filter||"").replace(/progid:DXImageTransform\.Microsoft\.Matrix\([^)]*\)/,"")+("progid:DXImageTransform.Microsoft.Matrix(M11="+f+",M12="+h+",M21="+k+",M22="+m+",FilterType='bilinear',sizingMethod='auto expand')");f=parseInt(a.style.width||a.width||0);h=parseInt(a.style.height||a.height||
0);l=g*Math.PI/180;k=Math.abs(Math.cos(l));m=Math.abs(Math.sin(l));a.style.marginLeft=Math.floor((f-(f*k+h*m))/2)+"px";a.style.marginTop=Math.floor((h-(f*m+h*k))/2)+"px"}return b}}})(jQuery);"use strict";
Finder.prototype.commands.rm=function(){this.shortcuts=[{pattern:"delete ctrl+backspace"}];this.getstate=function(a){var b=this.fm;a=a||b.selected();return!this._disabled&&a.length&&$.map(a,function(a){var d=b.file(a);return d&&d.phash&&!d.locked?a:null}).length==a.length?0:-1};this.exec=function(a){var b=this.fm,c=$.Deferred().fail(function(a){a&&b.error(a)}),d=this.files(a),e=d.length,g=b.cwd().hash,f=!1;if(!e||this._disabled)return c.reject();$.each(d,function(a,d){if(!d.phash)return!c.reject(["errRm",
d.name,"errPerm"]);if(d.locked)return!c.reject(["errLocked",d.name]);d.hash==g&&(f=b.root(d.hash))});"rejected"!=c.state()&&(d=this.hashes(a),b.confirm({title:this.title,text:"confirmRm",accept:{label:"btnRm",callback:function(){b.lockfiles({files:d});b.request({data:{cmd:"rm",targets:d},notify:{type:"rm",cnt:e},preventFail:!0}).fail(function(a){c.reject(a)}).done(function(a){c.done(a);f&&b.exec("open",f)}).always(function(){b.unlockfiles({files:d})})}},cancel:{label:"btnCancel",callback:function(){c.reject()}}}));
return c}};"use strict";Finder.prototype.commands.search=function(){this.title="Find files";this.options={ui:"searchbutton"};this.alwaysEnabled=!0;this.updateOnSelect=!1;this.getstate=function(){return 0};this.exec=function(a){var b=this.fm;if("string"==typeof a&&a)return b.trigger("searchstart",{query:a}),b.request({data:{cmd:"search",q:a},notify:{type:"search",cnt:1,hideCnt:!0}});b.getUI("toolbar").find("."+b.res("class","searchbtn")+" :text").focus();return $.Deferred().reject()}};"use strict";
Finder.prototype.commands.sort=function(){this.options={ui:"sortbutton"};this.getstate=function(){return 0};this.exec=function(a,b){var c=this.fm;b=$.extend({type:c.sortType,order:c.sortOrder,stick:c.sortStickFolders},b);this.fm.setSort(b.type,b.order,b.stick);return $.Deferred().resolve()}};
Finder.prototype.commands.unmount=function(){var a=this.fm;this.alwaysEnabled=!0;this.updateOnSelect=!1;this.getstate=function(b){return!b||1<b.length?-1:a.file(b[0]).net?0:-1};this.exec=function(b){var c=b[0],d=$.Deferred();return a.request({data:{cmd:"unmount",target:c},notify:{type:"unmount",cnt:1}}).fail(function(a){d.reject(a)}).done(function(a){d.resolve();$("#nav-"+c).closest(".finder-navbar-wrapper").detach();$(".finder-navbar-wrapper:first span:first").click()})}};"use strict";
Finder.prototype.commands.up=function(){this.alwaysEnabled=!0;this.updateOnSelect=!1;this.shortcuts=[{pattern:"ctrl+up"}];this.getstate=function(){return this.fm.cwd().phash?0:-1};this.exec=function(){return this.fm.cwd().phash?this.fm.exec("open",this.fm.cwd().phash):$.Deferred().reject()}};"use strict";
Finder.prototype.commands.upload=function(){var a=this.fm.res("class","hover");this.disableOnSearch=!0;this.updateOnSelect=!1;this.shortcuts=[{pattern:"ctrl+u"}];this.getstate=function(){return!this._disabled&&this.fm.cwd().write?0:-1};this.exec=function(b){var c=this.fm,d=function(a){g.finderdialog("close");c.upload(a).fail(function(a){e.reject(a)}).done(function(a){e.resolve(a)})},e,g,f,h,k,m;if(this.disabled())return $.Deferred().reject();if(b&&(b.input||b.files))return c.upload(b);e=$.Deferred();
f=$('<input type="file" multiple="true"/>').change(function(){d({input:f[0]})});h=$('<div class="ui-button ui-widget ui-state-default ui-corner-all ui-button-text-only"><span class="ui-button-text">'+c.i18n("selectForUpload")+"</span></div>").append($("<form/>").append(f)).hover(function(){h.toggleClass(a)});g=$('<div class="finder-upload-dialog-wrapper"/>').append(h);m=$('<div class="ui-corner-all finder-upload-dropbox" contenteditable=true></div>').focus(function(){if(this.innerHTML){var a=this.innerHTML.match(/<[^>]+>/)?
"html":"text",b=this.innerHTML;this.innerHTML="";d({files:[b],type:a})}}).bind("dragenter mouseover",function(){this.focus();$(m).addClass(a)}).bind("dragleave mouseout",function(){this.blur();$(m).removeClass(a)}).bind("mouseup keyup",function(){setTimeout(function(){$(m).focus()},100)});c.dragUpload?(k=$('<div class="ui-corner-all finder-upload-dropbox">'+c.i18n("dropFiles")+"</div>").prependTo(g).after('<div class="finder-upload-dialog-or">'+c.i18n("or")+"</div>").after(m).after("<div>"+c.i18n("dropFilesBrowser")+
"</div>").after('<div class="finder-upload-dialog-or">'+c.i18n("or")+"</div>")[0],k.addEventListener("dragenter",function(b){b.stopPropagation();b.preventDefault();$(k).addClass(a)},!1),k.addEventListener("dragleave",function(b){b.stopPropagation();b.preventDefault();$(k).removeClass(a)},!1),k.addEventListener("dragover",function(b){b.stopPropagation();b.preventDefault();$(k).addClass(a)},!1),k.addEventListener("drop",function(a){a.stopPropagation();a.preventDefault();var b=!1,c="";a.dataTransfer&&
a.dataTransfer.files&&a.dataTransfer.files.length?(b=a.dataTransfer.files,c="files"):a.dataTransfer.getData("text/html")?(b=[a.dataTransfer.getData("text/html")],c="html"):a.dataTransfer.getData("text")&&(b=[a.dataTransfer.getData("text")],c="text");b&&d({files:b,type:c})},!1)):$("<div>"+c.i18n("dropFilesBrowser")+"</div>").append(m).prependTo(g).after('<div class="finder-upload-dialog-or">'+c.i18n("or")+"</div>")[0];c.dialog(g,{title:this.title,modal:!0,resizable:!1,destroyOnClose:!0});return e}};
"use strict";Finder.prototype.commands.view=function(){this.value=this.fm.viewType;this.alwaysEnabled=!0;this.updateOnSelect=!1;this.options={ui:"viewbutton"};this.getstate=function(){return 0};this.exec=function(){var a=this.fm.storage("view","list"==this.value?"icons":"list");this.fm.viewchange();this.update(void 0,a)}};