metro-explorer
Version:
File explorer in JS
2 lines • 118 kB
JavaScript
!function e(t,i,o){function n(r,a){if(!i[r]){if(!t[r]){var l="function"==typeof require&&require;if(!a&&l)return l(r,!0);if(s)return s(r,!0);var d=new Error("Cannot find module '"+r+"'");throw d.code="MODULE_NOT_FOUND",d}var c=i[r]={exports:{}};t[r][0].call(c.exports,function(e){var i=t[r][1][e];return n(i?i:e)},c,c.exports,e,t,i,o)}return i[r].exports}for(var s="function"==typeof require&&require,r=0;r<o.length;r++)n(o[r]);return n}({1:[function(e,t,i){"use strict";e("./resources/assets/js/jquery-ui-1.11.4.min.js");var o=e("./resources/assets/js/explorer.js"),n=e("./resources/assets/extensions/ExUpload/exUpload.js"),s=e("./resources/assets/js/file.js");t.exports={Explorer:o,File:s,ExUpload:n}},{"./resources/assets/extensions/ExUpload/exUpload.js":2,"./resources/assets/js/explorer.js":3,"./resources/assets/js/file.js":4,"./resources/assets/js/jquery-ui-1.11.4.min.js":5}],2:[function(e,t,i){"use strict";function o(e,t,i){var o={explorerContainer:null,useAutomaticId:!1,url:t,params:i,debugMode:!1,callback:void 0,explorer:e,allowedExtensions:void 0,enabled:!0,MSG_EXUPLOAD_NOT_ENABLED:"ExUpload is not enabled, thus, you can't upload any file right now.",MSG_INVALID_FILE:"{ext} files are not allowed.",ERROR_INVALID_FILE:1,ERROR_NO_ID_FOUND:2,ERROR_EXUPLOAD_NOT_ENABLED:3,start:function(){try{o.validate(),o.explorerContainer=o.explorer.container,o.handleEvents(),o.explorer.exUpload=o}catch(e){o.log(e)}},validate:function(){if(void 0===o.params&&(o.params={fileParam:"file"},o.info("uploadParam was not defined, so its default value ('file') will be set.")),void 0===o.params.fileParam&&(o.params.fileParam="file",o.info("uploadParam was not defined, so its default value ('file') will be set.")),void 0===o.explorer||void 0===o.explorer.ROOT)throw"ExUpload will not work if you do not set Explorer's instance.";if(void 0===o.url)throw"ExUpload will not work if you do not set an url."},log:function(e){o.debugMode},info:function(e){o.debugMode},validadeExtension:function(e){if(void 0!==o.allowedExtensions)return o.allowedExtensions.indexOf(e.toLowerCase())!=-1;var t=AVAILABLE_ICON_EXTENSIONS.indexOf(e.toLowerCase());return t!=-1||AVAILABLE_ICON_EXTENSIONS.indexOf("_".concat(e.toLowerCase()))!=-1},handleEvents:function(){var e=document.getElementById(o.explorerContainer.substring(1));e.addEventListener("dragenter",function(e){e.currentTarget.classList.add("drop")}),e.addEventListener("dragleave",function(e){e.currentTarget.classList.remove("drop")}),e.addEventListener("dragover",function(e){e.preventDefault(),e.stopPropagation(),e.dataTransfer.dropEffect="copy"}),e.addEventListener("drop",function(e){e.preventDefault(),e.stopPropagation();var t=e.dataTransfer.files[0];o.upload(t)})},beforeSend:function(e){},upload:function(e){var t=e.name.substr(e.name.lastIndexOf(".")+1),i=o.generateFakeId(),n=new File(i,e.name,t,o.explorer.currentParent==-1?0:o.explorer.currentParent),s=new o.Uploader(e,n);if(!this.enabled){var r={message:o.MSG_EXUPLOAD_NOT_ENABLED,error:o.ERROR_EXUPLOAD_NOT_ENABLED};return s.createProgressStructure(n.id,!0),void o.error(r,n)}if(o.validadeExtension(n.ext)===!1){var r={message:o.MSG_INVALID_FILE.replace("{ext}","."+t),error:o.ERROR_INVALID_FILE};s.createProgressStructure(n.id,!0),o.error(r,n)}else o.explorer.addFiles(n),s.fileIndex=o.explorer.checkIfExists(n.id),s.upload()},generateFakeId:function(){for(var e=100,t="fake"+e;o.explorer.checkIfExists(t)!=-1;)t="fake"+ ++e;return t},error:function(e,t){var i=$("#"+t.id).find(".errorStyle"),n=$("#"+t.id);n.find(".exUpload").fadeOut("fast"),n.find(".abortStyle").fadeOut("fast"),i.fadeIn("slow"),i.on("mouseover",function(){i.css("cursor","pointer"),i.prop("title","Click to Hide"),n.find(".errorFont").text("Remove?")}).on("mouseout",function(){n.find(".errorFont").text("Upload has Failed!")}).on("mousedown",function(){n.fadeOut("slow",function(){var e=o.explorer.getFileById(t.id).field,i=o.explorer.fields.fieldList[e].filesOn;o.explorer.fields.fieldList[e].filesOn=$.grep(i,function(e){return e!=t.id}),0===o.explorer.fields.fieldList[e].filesOn.length&&(o.explorer.fields.usedFields-=1),o.explorer.fileList=$.grep(o.explorer.fileList,function(e,i){return e.id!=t.id}),$(this).remove()})}),void 0!==o.callback&&o.callback(e,!1),o.log(e)},Uploader:function(e,t){var i={fakeFile:t,file:e,fileIndex:null,myXhr:void 0,upload:function(){var e=new FormData;e.append(o.params.fileParam,i.file),e.append("dirId",o.explorer.currentParent);for(var t in o.params)"fileParam"!=t&&e.append(t,o.params[t]);$.ajax({url:o.url,type:"POST",xhr:function(){return i.myXhr=$.ajaxSettings.xhr(),i.myXhr.upload&&i.myXhr.upload.addEventListener("progress",i.progressEvent,!1),i.myXhr},beforeSend:function(e){o.beforeSend(e),i.updateFileState(!0,0,!1,0),i.fakeFile.date=Math.round(new Date/1e3),o.explorer.fileList[i.fileIndex].uploader=i},success:function(e){var t=$.Deferred(),n=o.explorer.checkIfExists(i.fakeFile.id);if(void 0!==e.id&&null!==e.id){var s=i.fakeFile.id;$("#"+s).find("#selec_id".concat(s)).attr("id","selec_id".concat(e.id)),$("#"+s).attr("id",e.id),o.explorer.fileList[n].id=e.id}else{if(!o.useAutomaticId){var r={messages:"Your server did not return any ID, not did you enable the use of automatic id (exUpload.useAutomaticId).",error:o.ERROR_NO_ID_FOUND};return void 0!==o.callback&&o.callback(r,!1),void this.error(r,i.fakeFile)}e.id=i.fakeFile.id}i.updateFileState(!1,100,!1),t.resolve(),$.when(t).then(function(){var t=$("#"+e.id);t.find(".abortStyle").unbind("mouseover"),t.find(".abortStyle").css("display","none"),t.removeClass("uploading"),setTimeout(function(){t.find(".exUpload").fadeOut("slow")},2e3),void 0!==o.callback&&o.callback(e,!0)})},error:function(e){o.error(e,i.fakeFile)},data:e,cache:!1,contentType:!1,processData:!1,dataType:"json"})},createProgressStructure:function(e,t){var n=null,s={id:$("#"+e),abortStyle:null},r=t===!0||o.explorer.fileList[i.fileIndex].uploadFailed===!0||o.explorer.fileList[i.fileIndex].uploading===!1?" displayNone ":"";s.id.hasClass("uploading")||s.id.addClass("uploading"),s.id.find("#progressBar").length||(s.id.append('<div id="progressBar" class="progressBar exUpload'+r+'"></div><div id="errorStyle" class="errorStyle"><p class="errorFont">Upload has Failed</p></div><div id="abortStyle" class="abortStyle'+r+'"><p class="abortFont">Abort?</p></div><div style="position:absolute; left:50%; top:0;" class="exUpload'+r+'"><div class="percentCounterContainer'+r+'"><span class="percentConcluido" ></span></div><span class="uploadSpeed'+r+'">0 Kbps</span></div>'),s.abortStyle=$("#"+e).find(".abortStyle"),s.abortStyle.find("p").prop("title","Abort the upload of "+this.file.name),s.abortStyle.find(".abortFont").on("click",function(){s.abortStyle.unbind("mouseover"),s.abortStyle.css("display","none"),i.myXhr.abort(),o.explorer.fileList[i.fileIndex].uploadFailed=!0}),s.abortStyle.on("mouseover",function(){s.abortStyle.css("opacity",.8)}),s.abortStyle.on("mouseout",function(){s.abortStyle.css("opacity",0)}),$(window).resize(function(){clearTimeout(n),n=setTimeout(function(){i.progressEvent({lengthComputable:null},!0)},5)}))},progressEvent:function(e,t){if(e.lengthComputable||t){var n=$("#"+i.fakeFile.id),s=null,r=null,a=Math.round(new Date/1e3)-i.fakeFile.date;i.createProgressStructure(i.fakeFile.id),t?(s=o.explorer.fileList[i.fileIndex].progress,r=o.explorer.fileList[i.fileIndex].speed,o.explorer.fileList[i.fileIndex].uploadFailed&&(n.abortStyle=$("#"+i.fakeFile.id).find(".abortStyle"),n.abortStyle.unbind("mouseover"),n.abortStyle.css("display","none"),o.error("error",i.fakeFile))):(r=Math.floor(e.loaded/1024/a),s=Math.round(100*e.loaded/e.total)),s>=100?(n.find(".uploadSpeed").css("color","white"),n.removeClass("uploading")):s>=50?n.find(".percentCounterContainer").css("color","white"):s>=10&&n.find(".uploadSpeed").css("color","white"),i.updateFileState(100!=s,s,null,r),n.find(".percentConcluido").html(s+'<span class="percentSymbol">%</span>'),n.find(".progressBar").css("height",s+"%"),n.find(".uploadSpeed").html("^ "+r+" Kbps")}},updateFileState:function(e,t,n,s){notNull(e)&&(o.explorer.fileList[i.fileIndex].uploading=e),notNull(n)&&(o.explorer.fileList[i.fileIndex].uploadFailed=n),notNull(t)&&(o.explorer.fileList[i.fileIndex].progress=t),notNull(t)&&(o.explorer.fileList[i.fileIndex].speed=s)}};return i}};return o}t.exports=o},{}],3:[function(e,t,i){"use strict";function o(e,t,i,o,f){var u={POSITION_LEFT:1,POSITION_CENTER:2,POSITION_RIGHT:3,LANG_LBL_NEW_FOLDER:"New Folder",LANG_LBL_UPLOAD:"Upload a File",LANG_LBL_MOVE:"Move to",LANG_LBL_MOVE_ALL:"Move All to",LANG_LBL_DEL:"Delete",LANG_LBL_DEL_ALL:"Delete All",LANG_LBL_SHARE:"Share",LANG_LBL_SHARE_ALL:"Share All",LANG_LBL_DOWNLOAD:"Download",LANG_LBL_DOWNLOAD_ALL:"Download All",LANG_LBL_OPEN:"Open",LANG_LBL_RENAME:"Rename",LANG_LBL_UP:"Up",LANG_LBL_MOVE_HEADER:"Which folder would like to move your files to?",LANG_LBL_MOVE_BT_MOVE:"Move",LANG_LBL_MOVE_BT_MOVE_TITLE:"It will move your file(s)/folder(s) to the selected folder.",LANG_LBL_MOVE_FOLDER_ERROR_MSG:"You cannot move {folderName} to its sub folder.",LANG_LBL_NEW_FOLDER_HEADER:"Create a new Folder",LANG_LBL_NEW_FOLDER_FOLDER_NAME:"Folder:",LANG_LBL_NEW_FOLDER_BT_CREATE:"Create",LANG_LBL_ROOT_FOLDER:"Root",LANG_LBL_EMPTY_MESSAGE:"Drag and drop a file over here to start uploading. :)",LANG_LBL_NO_FOLDERS_FOUND:"There are no folders where you can move your files to. :/",TEMP_VAR:void 0,EVENT_DROP:1,EVENT_RENAME:2,ENABLED:0,HIDDEN:1,DISABLED:2,CONTEXT_MENU_OPTIONS:{DOWNLOAD:0,DOWNLOAD_ALL:0,UPLOAD:0,UPLOAD_ALL:0,MOVE:0,MOVE_ALL:0,DELETE:0,DELETE_ALL:0,SHARE:0,SHARE_ALL:0,RENAME:0,NEW_FOLDER:0,OPEN:0},DOWNLOAD:0,DOWNLOAD_ALL:1,UPLOAD:2,UPLOAD_ALL:3,MOVE:4,MOVEL_ALL:5,DELETE:6,DELETE_ALL:7,SHARE:8,SHARE_ALL:9,RENAME:10,NEW_FOLDER:11,OPEN:12,ROOT:0,GO_UP_ID:-1,baseDialogEffect:"fade",debugMode:!1,container:void 0===i?"#explorerContainer":i,element:"#explorer",fields:{fieldList:[],usedFields:0},width:void 0===e?800:e,height:void 0===t?600:t,position:void 0===o?2:o,cssPosition:"relative",fileList:void 0===f?[]:f,fileUpdateEvent:"fileUpdateEvent",border:"0px solid gray",language:void 0,currentPath:[],top:0,left:0,selectedFiles:[],started:!1,browserContextMenuDisabled:!0,currentParent:0,availableIconExtensions:null,iconsBackgroundColor:"#00ABA9",baseDialogId:".baseDialog",iconPaths:[],preloadIcons:!0,multiSelect:!0,exUpload:null,customOptionId:0,closeBaseDialogOnEsc:!0,explorerRootFolder:null,styleFile:null,addFiles:function(e,t,i){window.AVAILABLE_ICON_EXTENSIONS||(window.AVAILABLE_ICON_EXTENSIONS=u.getAvailableIconExtensions());var o=[],n=[];if($("#emptyMessage").length&&$("#emptyMessage").fadeOut("fast"),void 0===e)return void u.log("You are passing an undefined parameter to addFiles()");if($.isArray(e))return void $.each(e,function(e,t){u.addFiles(t)});if(u.checkIfContainerExist()!==!1){if(u.started||$(u.element).css("display","none"),$.isNumeric(e)){var s=e;if(u.currentParent==s&&t!==!0)return;u.fields.fieldList=[],u.fields.usedFields=0,$(u.element).find(".file, .field").remove(),u.currentParent=s,u.createQuickFolderAccess(s),0!==s&&u.createUpButton(s)}else{var r=e,a=u.checkIfExists(r.id);if(a!=-1&&void 0===r.found)return void u.log("Explorer already has a file/folder with this id ("+r.id+"). '"+r.name+"' will not be added to the fileList.");if(a==-1&&u.fileList.push(r),void 0!==r.found)return u.createFieldsIfNecessary(r),void u.placeFileAutomatically(r)}$.each(u.fileList,function(e,i){var s=u.checkIfExists(i.id);return i.parent!==u.currentParent?void(u.fileList[s].placed=!1):void(i.placed&&t!==!0||(u.createFieldsIfNecessary(i),void 0===u.fields.fieldList[i.field]&&i.field!==-1&&u.log(i.name+"'s field does not exist. It will be placed on an existing free field. Make sure you are running createFields(number_of_fields); with enough number of fields to place '"+i.name+"' on."),i.field!==-1?o.push(i):n.push(i),s=u.checkIfExists(i.id),u.fileList[s].placed=!0,u.fileList[s].uploading===!0&&(u.fileList[s].uploader.fileIndex=s,u.fileList[s].uploader.createProgressStructure(i.id),u.fileList[s].uploader.progressEvent({lengthComputable:null},!0))))}),$.each(o,function(e,i){u.placeFileWithField(i,t)}),$.each(n,function(e,t){u.placeFileAutomatically(t)}),u.initMouseOverEvent(),void 0!==i&&i.resolve()}},placeFileWithField:function(e,t){var i=u.fields.fieldList[e.field].top+5+"px;",o=u.fields.fieldList[e.field].left+5+"px;";$(u.element).append("<div id='"+e.id+"' class='file fileButton draggable displayNone' style='position: absolute; top:"+i+"left:"+o+"'> <div class='center iconBorder'><div class='"+e.getIcon()+" center'></div></div> <div id='input"+e.id+"' style='display:inline-block; position:relative;' title='"+e.name+"'> <input class='txtcenter ft11 inputFileName'maxlength='30' readonly='readonly' title='"+e.name+"' value='"+e.getName().replace(/'/g,"'")+"'/><div style='position:absolute; left:0; right:0; top:0; bottom:0;'></div></div> <div id='selec_id"+e.id+"' class='opacity4'> </div> <div class=\"moveToTooltip\">Move to</div></div>"),u.fields.fieldList[e.field].filesOn.push(e.id);var n=u.fields.fieldList[e.field];e.getElement().css("top",(n.filesOn.length>1?n.top+5-3*(n.filesOn.length-1):n.top+5)+"px"),e.getElement().css("left",(n.filesOn.length>1?n.left+5+3*(n.filesOn.length-1):n.left+5)+"px"),t===!0?e.getElement().css("display","block"):e.getElement().fadeIn(300),u.fields.usedFields++,u.loadFileEvents(e)},placeFileAutomatically:function(e,t){for(var i=0;i<u.fields.fieldList.length;i++)if(0===u.fields.fieldList[i].filesOn.length){var o=u.fields.fieldList[i].top+5+"px;",n=u.fields.fieldList[i].left+5+"px;";$(u.element).append("<div id='"+e.id+"' class='file fileButton draggable displayNone' style='position: absolute; top:"+o+"left:"+n+"'> <div class='center iconBorder'><div class='"+e.getIcon()+" center'></div></div><div id='input"+e.id+"' style='display:inline-block; position:relative;' title='"+e.name+"'> <input class='txtcenter ft11 inputFileName' maxlength='30' readonly='readonly' title='"+e.name+"' value='"+e.getName().replace(/'/g,"'")+"' /><div style='position:absolute; left:0; right:0; top:0; bottom:0;'></div></div> <div id='selec_id"+e.id+"' class='opacity4'> </div> <div class=\"moveToTooltip\">Move to</div></div>"),t===!0?e.getElement().css("display","block"):e.getElement().fadeIn(300),u.fields.fieldList[i].filesOn.push(e.id),u.fields.usedFields++;var s=u.checkIfExists(e.id);e.found||(u.fileList[s].field=i),u.loadFileEvents(e);break}},createFieldsIfNecessary:function(e){e.field===-1?u.fields.fieldList.length<=u.fileList.length&&u.createFields(1):e.field>u.fields.fieldList.length-1&&u.createFields(e.field-u.fields.fieldList.length+1),u.fields.fieldList.length-u.fileList.length<2&&u.createFields(1)},createUpButton:function(e){u.createFields(1,!0);var t=$.grep(u.fileList,function(t){return t.id===e});$(u.element).append("<div id='goup' class='file fileButton' style='float:left; top: 5px; left: 5px; position: absolute'><div class='center iconBorder'><div class='goUp center'></div></div><br /><p class='txtcenter ft11'>"+u.LANG_LBL_UP+"</p></div>"),$("#goup").on("click",function(){$(".file").fadeOut("slow"),u.hide([".contextMenuFile",".contextMenuFolder",".contextMenuVoid"]),setTimeout(function(){u.addFiles(t[0].parent)},200),setTimeout(function(){$(".file").fadeIn("fast")},250)})},loadFileEvents:function(e){var t=e.getElement();t.find("input").on("blur",function(t){u.rename(e,!0)}),t.dblclick(function(){u.dbclick(e)}),t.on("mousedown",function(i){$(document).trigger("contextMenuEvent",{event:i,file:e}),($(i.target).is("._selected")||3!=i.which)&&u.multiSelect||(u.selectedFiles=[],$("._selected").removeClass("_selected"),$(".file").css("border","1px solid darkgray"));var o=$.grep(u.selectedFiles,function(t){return t.id==e.id});0===o.length&&u.selectedFiles.push(e),$(i.currentTarget).hasClass("uploading")||(1==i.which?(u.hide([".contextMenuFile",".contextMenuFolder","#contextIdTools"]),$(i.target).is("._selected")||!t.find("input").is("[readonly]")||$(i.target).is(".errorStyle, .errorFont")||(t.css("border","1px solid blue"),t.find("#selec_id"+e.id).addClass("_selected"))):3==i.which&&($("#contextMenu4Files").css("top",i.pageY-5+"px"),$("#contextMenu4Files").css("left",i.pageX-5+"px"),u.showContextMenu(e)))}),u.initDraggable()},checkIfExists:function(e){for(var t=0;t<u.fileList.length;t++)if(u.fileList[t].id==e)return t;return-1},createFields:function(e,t){for(var i=130,o=150,s=u.fields.fieldList.length,r=parseInt(u.getExplorerCurrentWidth()/i),a=function(e){var s=new n(e,$("<div id='field_"+e+"' class='field' style='top:"+(parseInt(e/r)*o+8)+"px; left: "+parseInt(e%r)*i+"px;'/>"),[],parseInt(e/r)*o,parseInt(e%r)*i);$(u.element).append(s.element),s.element.droppable({drop:function(e,t){s.element.css("border-width","0px");var i=u.getFileById(t.draggable[0].id),o=s.filesOn[s.filesOn.length-1];if(i.getElement().find(".moveToTooltip").fadeOut(),o==u.GO_UP_ID){u.selectedFiles=[i];var n=u.getFileById(u.currentParent);return void u.clientMove(n.parent,!0)}if(o=u.getFileById(o),o&&"dir"==o.ext&&o.id!=i.id)return u.selectedFiles=[i],void u.clientMove(o.id);if($.inArray(i.id,s.filesOn)==-1){s.filesOn.push(Number(i.id));var r=u.checkIfExists(i.id);u.fileList[r].field=s.fieldNumber()}$(s.element).trigger("fileUpdateEvent",[{file:i},u.EVENT_DROP]),i.getElement().animate({left:s.filesOn.length>1?s.left+5+3*(s.filesOn.length-1):s.left+5,top:s.filesOn.length>1?s.top+5-3*(s.filesOn.length-1):s.top+5},{start:function(e){$("#"+e.elem.id).css("z-index",20*s.filesOn.length)}},300)},out:function(e,t){s.element.css("border-width","0px"),s.filesOn=$.grep(s.filesOn,function(e,i){return e!=t.draggable[0].id}),0===s.filesOn.length&&(u.fields.usedFields-=1)},over:function(e,t){s.element.css("border-width","1px");var i=s.filesOn[s.filesOn.length-1],o=u.getFileById(t.draggable[0].id);if(i==u.GO_UP_ID){var n=u.getFileById(u.currentParent),r=n.parent==u.ROOT?"Root":u.getFileById(n.parent).name;o.getElement().find(".moveToTooltip").html("<span style='color: #101973'>Move to ".concat(r)).fadeIn()}else i=u.getFileById(i),i&&"dir"==i.ext&&i.id!=o.id?o.getElement().find(".moveToTooltip").html("<span style='color: #101973'>Move to</span> ".concat(i.name)).fadeIn():o.getElement().find(".moveToTooltip").fadeOut()}}),u.fields.fieldList.push(s),t===!0&&(u.fields.fieldList[0].filesOn=[u.GO_UP_ID])},l=s;l<s+e;l++)a(l)},getFileById:function(e){return u.fileList[u.checkIfExists(e)]},getSelectedFiles:function(){return u.selectedFiles},disableBrowserContextMenu:function(){u.browserContextMenuDisabled&&$(document).ready(function(){$(document).bind("contextmenu",function(e){e.preventDefault()})})},initDraggable:function(){$(".draggable").draggable({cursor:"move",revert:"invalid",start:function(e,t){$("#"+t.helper[0].id).css("z-index","9000")}})},hide:function(e){$.each(e,function(e,t){$(t).css("display","none")})},setExplorerPosition:function(){var e=u.getExplorerCurrentHeight(),t=u.getExplorerCurrentWidth();if(u.position==u.POSITION_CENTER){var i=$(u.container).parent().width()/2-t/2+u.left;i=i<0?0:i,$(u.container).css("left",i+"px"),$(u.container).css("top",u.top+"px")}else u.position==u.POSITION_LEFT?($(u.container).css("left",u.left+"px"),$(u.container).css("top",u.top+"px")):u.position==u.POSITION_RIGHT&&($(u.container).css("left",$(u.container).parent().width()-t+u.left+"px"),$(u.container).css("top",u.top+"px"));$(u.container).css({position:u.cssPosition,width:t+"px",height:e+"px","min-width":"150px","min-height":"170px",border:u.border}),$(u.element).css({width:"100%",height:"90%","overflow-y":"auto","overflow-x":"hidden",position:"relative"})},getExplorerCurrentHeight:function(){var e=null;return u.height>$(window).height()?(e=$(window).height()-50,u.log("The height you have set is higher than screen's height, so we have now set Explorer's height to "+($(window).height()-50))):e=u.height,e},getExplorerCurrentWidth:function(){var e=null;return u.width>$(window).width()?(e=$(window).width()-20,u.log("The width you have set is larger than screen's width, so we have now set Explorer's width to "+$(window).width())):e=u.width,e},createQuickFolderAccess:function(e){var t=[];$("#quickAccess");$("#quickAccess").length?$("#quickAccess").empty():$(u.container).prepend("<div id='quickAccess' style='width: auto; height: 20px; position: relative;' style='margin-left: 10px;'></div>"),$("#quickAccess").append("<span id='quick_root' class='text-small bold handCursor quickAccessLink' style='margin-bottom: 10px; margin-left: 10px;'>/ </span>"),$("#quick_root").on("click",function(){u.addFiles(0)}),$.each(u.currentPath,function(i,o){return 0!==e&&(o.id==e?(t.push(o),!1):void t.push(o))}),$.each(t,function(e,t){$("#quickAccess").append("<span id='quick_"+t.id+"'class='text-small bold handCursor quickAccessLink'>"+t.name+"/</span> "),$("#quick_"+t.id).on("click",function(){u.addFiles(t.id)})}),u.currentPath=t},initContextMenuEvent:function(){$("body").append("<div id='contextIdTools'class='opacity9 txtmargin contextMenuVoid gray ft12 bold displayNone'>"+u.loadContextMenuOption(u.NEW_FOLDER,u.CONTEXT_MENU_OPTIONS.NEW_FOLDER,!1)+u.loadContextMenuOption(u.UPLOAD,u.CONTEXT_MENU_OPTIONS.UPLOAD,!1)+u.customMenuOption()+"</div>"),$("#expNewFolder").on("click",function(){u.newFolder()}),$("#expUpload").on("click",function(){u.upload()}),$(document).on("mousedown",function(e){$(e.target).is(".field,#explorer,#quickAccess")&&(u.hide([".contextMenuFile",".contextMenuFolder",".contextMenuVoid"]),$(".file").css("border","1px solid darkgray"),$("._selected").removeClass("_selected"),u.selectedFiles=[],3!=e.which||!$(e.target).is(u.element)&&!$(e.target).is(".field")||u.CONTEXT_MENU_OPTIONS.NEW_FOLDER==u.HIDDEN&&u.CONTEXT_MENU_OPTIONS.UPLOAD==u.HIDDEN||($("#contextIdTools").css("top",e.pageY-5+"px"),$("#contextIdTools").css("left",e.pageX-5+"px"),u.showContextMenu("void")))}),$(".contextMenuOption").on("click",function(){l(this)&&$("#contextIdTools").fadeOut("fast")}),$("body").append("<div id='contextMenu4Files' style='position:absolute;' class='displayNone'> </div>")},initMouseOverEvent:function(){$(".fileButton").mouseover(function(e){document.getElementById(this.id).style.border.indexOf("blue")==-1&&$(this).css("border","1px solid yellow")}).mouseout(function(){document.getElementById(this.id).style.border.indexOf("blue")==-1&&$(this).css("border","1px solid darkgray")})},setLanguage:function(e){this.language=e,this.loadLanguage()},loadLanguage:function(){var e=/\.json$/i,t=u.language;e.test(t)===!0?$.get(t,function(e){u.LANG_LBL_NEW_FOLDER=u.loadLanguageCheckIfDefined(e.LANG_LBL_NEW_FOLDER,u.LANG_LBL_NEW_FOLDER),u.LANG_LBL_UPLOAD=u.loadLanguageCheckIfDefined(e.LANG_LBL_UPLOAD,u.LANG_LBL_UPLOAD),u.LANG_LBL_MOVE=u.loadLanguageCheckIfDefined(e.LANG_LBL_MOVE,u.LANG_LBL_MOVE),u.LANG_LBL_MOVE_ALL=u.loadLanguageCheckIfDefined(e.LANG_LBL_MOVE_ALL,u.LANG_LBL_MOVE_ALL),u.LANG_LBL_DEL=u.loadLanguageCheckIfDefined(e.LANG_LBL_DEL,u.LANG_LBL_DEL),u.LANG_LBL_DEL_ALL=u.loadLanguageCheckIfDefined(e.LANG_LBL_DEL_ALL,u.LANG_LBL_DEL_ALL),u.LANG_LBL_SHARE=u.loadLanguageCheckIfDefined(e.LANG_LBL_SHARE,u.LANG_LBL_SHARE),u.LANG_LBL_SHARE_ALL=u.loadLanguageCheckIfDefined(e.LANG_LBL_SHARE_ALL,u.LANG_LBL_SHARE_ALL),u.LANG_LBL_DOWNLOAD=u.loadLanguageCheckIfDefined(e.LANG_LBL_DOWNLOAD,u.LANG_LBL_DOWNLOAD),u.LANG_LBL_DOWNLOAD_ALL=u.loadLanguageCheckIfDefined(e.LANG_LBL_DOWNLOAD_ALL,u.LANG_LBL_DOWNLOAD_ALL),u.LANG_LBL_RENAME=u.loadLanguageCheckIfDefined(e.LANG_LBL_RENAME,u.LANG_LBL_RENAME),u.LANG_LBL_OPEN=u.loadLanguageCheckIfDefined(e.LANG_LBL_OPEN,u.LANG_LBL_OPEN),u.LANG_LBL_UP=u.loadLanguageCheckIfDefined(e.LANG_LBL_UP,u.LANG_LBL_UP),u.LANG_LBL_MOVE_HEADER=u.loadLanguageCheckIfDefined(e.LANG_LBL_MOVE_HEADER,u.LANG_LBL_MOVE_HEADER),u.LANG_LBL_MOVE_BT_MOVE=u.loadLanguageCheckIfDefined(e.LANG_LBL_MOVE_BT_MOVE,u.LANG_LBL_MOVE_BT_MOVE),u.LANG_LBL_MOVE_BT_MOVE_TITLE=u.loadLanguageCheckIfDefined(e.LANG_LBL_MOVE_BT_MOVE_TITLE,u.LANG_LBL_MOVE_BT_MOVE_TITLE),u.LANG_LBL_NEW_FOLDER_HEADER=u.loadLanguageCheckIfDefined(e.LANG_LBL_NEW_FOLDER_HEADER,u.LANG_LBL_NEW_FOLDER_HEADER),u.LANG_LBL_NEW_FOLDER_FOLDER_NAME=u.loadLanguageCheckIfDefined(e.LANG_LBL_NEW_FOLDER_FOLDER_NAME,u.LANG_LBL_NEW_FOLDER_FOLDER_NAME),u.LANG_LBL_NEW_FOLDER_BT_CREATE=u.loadLanguageCheckIfDefined(e.LANG_LBL_NEW_FOLDER_BT_CREATE,u.LANG_LBL_NEW_FOLDER_BT_CREATE)},"json").fail(function(){u.log("Looks like '"+t+"' does not have a correct json structure or does not exist."),u.log("Default language, English, will be loaded.")}).always(function(){u.initContextMenuEvent()}):(u.log(u.language+" is not a .json file."),u.log("Default language, English, will be loaded."),u.initContextMenuEvent())},loadLanguageCheckIfDefined:function(e,t){return void 0!==e?e:t},createExplorer:function(){$("body").prepend("<div id='"+u.container.substr(1)+"'> </div>")},checkIfContainerExist:function(){return $(u.container).length?($(u.element).length||$(u.container).append("<div id='"+u.element.substr(1)+"'></div>"),!0):(u.log(u.container+"'s <div> does not exist. You must either create the element that Explorer will use to create its structure, for example: <div id='explorerContainer' /> or just run explorer.createExplorer(); right after you have instantiated explorer, and it will be build between your <body> tags. Explorer will not work without it."),!1)},start:function(){this.language=void 0===this.language?u.getExplorerRootFolder()+"/lang/en-US.json":this.language,void 0!==u.language?u.loadLanguage():u.initContextMenuEvent();var e=null;if(u.checkIfContainerExist()!==!1){if(window.AVAILABLE_ICON_EXTENSIONS=u.getAvailableIconExtensions(),null===window.AVAILABLE_ICON_EXTENSIONS)return u.log("It looks like you have not include 'explorer.css' on your html document. Explorer will not start without it. :/"),null;"undefined"!=typeof Preload?this.preloadIcons&&(e=new Preload(u.iconPaths,LoadType.ASYNC).run()):u.log("Looks like you have not include Preload class. Thus, icons preload will not be done."),u.started=!0,u.createQuickFolderAccess(0),u.setExplorerPosition(),$(window).resize(function(){u.resizeExplorer()}),u.disableBrowserContextMenu(),$(u.element).fadeIn("fast"),u.showEmptyMessage(),u.setIconsBackgroundColor(u.iconsBackgroundColor),$(u.container).on("drop",function(){u.currentParent==-1&&(u.log("While searching, dropped files will be uploaded at the root.",1),$(document).trigger("droppedWhenSearching",["While searching, dropped files will be uploaded at the root."]))})}},setIconsBackgroundColor:function(e){var t=$("#iconsBackgroundColor");u.iconsBackgroundColor=e,t.length?(t.empty(),t.append(".iconBorder{ background-color:"+e+"; }")):$("head").append('<style id="iconsBackgroundColor"> .iconBorder{ background-color:'+e+"; }")},resizeExplorer:function(){u.setExplorerPosition(),u.addFiles(u.currentParent,!0),u.resizeBaseDialog()},showEmptyMessage:function(){0===u.fileList.length&&($("#emptyMessage").length?$("#emptyMessage").fadeIn("fast"):$(u.element).append("<p id='emptyMessage' class='gray txtcenter'>"+u.LANG_LBL_EMPTY_MESSAGE+"</p>"))},showContextMenu:function(e){var t=null,i=$("#contextMenu4Files"),o="",n="contextMenuFile";if(u.hide(["#contextMenu4Files",".contextMenuVoid"]),i.removeClass("contextMenuFile contextMenuFolder"),"void"==e)$("#contextIdTools").fadeIn("fast");else{if(i.empty(),t=u.selectedFiles.length>1&&u.multiSelect,o=o.concat(u.loadContextMenuOption(u.MOVE,t?u.CONTEXT_MENU_OPTIONS.MOVE_ALL:u.CONTEXT_MENU_OPTIONS.MOVE,t)+(t?"":u.loadContextMenuOption(u.RENAME,u.CONTEXT_MENU_OPTIONS.RENAME,t))+u.loadContextMenuOption(u.DELETE,t?u.CONTEXT_MENU_OPTIONS.DELETE_ALL:u.CONTEXT_MENU_OPTIONS.DELETE,t)+u.loadContextMenuOption(u.SHARE,t?u.CONTEXT_MENU_OPTIONS.SHARE_ALL:u.CONTEXT_MENU_OPTIONS.SHARE,t)+u.loadContextMenuOption(u.DOWNLOAD,t?u.CONTEXT_MENU_OPTIONS.DOWNLOAD_ALL:u.CONTEXT_MENU_OPTIONS.DOWNLOAD,t)),t||"dir"!=e.ext||(o=u.loadContextMenuOption(u.OPEN,u.CONTEXT_MENU_OPTIONS.OPEN,t).concat(o),n="contextMenuFolder"),i.addClass(n),o=o.concat(u.customMenuOption(e)),i.append(o),i.html().length<1)return;i.addClass("opacity9 gray ft12 txtmargin bold"),i.fadeIn("fast"),i.css("z-index",9999),$(".contextMenuOption").on("click",function(){l(this)&&i.fadeOut("fast")}),u.loadContextMenuOptionEvents(e)}},loadContextMenuOptionEvents:function(e){$("#expOpen").on("click",function(){l(this)&&u.open(e)}),$("#expMove").on("click",function(){l(this)&&u.move(e)}),$("#expRename").on("click",function(){l(this)&&u.rename(e,!1)}),$("#expDelete").on("click",function(){l(this)&&u["delete"](e)}),$("#expShare").on("click",function(){l(this)&&u.share(e)}),$("#expDownload").on("click",function(){l(this)&&u.download(e)})},loadContextMenuOption:function(e,t,i){var o;switch(e){case u.MOVE:switch(t){case u.ENABLED:o="<p id='expMove' class='contextMenuOption handCursor'>"+(i?u.LANG_LBL_MOVE_ALL:u.LANG_LBL_MOVE)+"</p>";break;case u.DISABLED:o="<p id='expMove' class='contextMenuOption disabledContextMenuOption'>"+(i?u.LANG_LBL_MOVE_ALL:u.LANG_LBL_MOVE)+"</p>";break;case u.HIDDEN:o=""}break;case u.DELETE:switch(t){case u.ENABLED:o="<p id='expDelete' class='contextMenuOption handCursor'>"+(i?u.LANG_LBL_DEL_ALL:u.LANG_LBL_DEL)+"</p>";break;case u.DISABLED:o="<p id='expDelete' class='contextMenuOption disabledContextMenuOption'>"+(i?u.LANG_LBL_DEL_ALL:u.LANG_LBL_DEL)+"</p>";break;case u.HIDDEN:o=""}break;case u.SHARE:switch(t){case u.ENABLED:o="<p id='expShare' class='contextMenuOption handCursor'>"+(i?u.LANG_LBL_SHARE_ALL:u.LANG_LBL_SHARE)+"</p>";break;case u.DISABLED:o="<p id='expShare' class='contextMenuOption disabledContextMenuOption'>"+(i?u.LANG_LBL_SHARE_ALL:u.LANG_LBL_SHARE)+"</p>";break;case u.HIDDEN:o=""}break;case u.DOWNLOAD:switch(t){case u.ENABLED:o="<p id='expDownload' class='contextMenuOption handCursor'>"+(i?u.LANG_LBL_DOWNLOAD_ALL:u.LANG_LBL_DOWNLOAD)+"</p>";break;case u.DISABLED:o="<p id='expDownload' class='contextMenuOption disabledContextMenuOption'>"+(i?u.LANG_LBL_DOWNLOAD_ALL:u.LANG_LBL_DOWNLOAD)+"</p>";break;case u.HIDDEN:o=""}break;case u.NEW_FOLDER:switch(t){case u.ENABLED:o="<p id='expNewFolder' class='contextMenuOption handCursor' style='margin-top:10px;'>"+u.LANG_LBL_NEW_FOLDER+"</p>";break;case u.DISABLED:o="<p id='expNewFolder' class='contextMenuOption disabledContextMenuOption' style='margin-top:10px;'>"+u.LANG_LBL_NEW_FOLDER+"</p>";break;case u.HIDDEN:o=""}break;case u.UPLOAD:switch(t){case u.ENABLED:o="<p id='expUpload' class='contextMenuOption handCursor'>"+u.LANG_LBL_UPLOAD+"</p>";break;case u.DISABLED:o="<p id='expUpload' class='contextMenuOption disabledContextMenuOption'>"+u.LANG_LBL_UPLOAD+"</p>";break;case u.HIDDEN:o=""}break;case u.RENAME:switch(t){case u.ENABLED:o="<p id='expRename' class='contextMenuOption handCursor'>"+u.LANG_LBL_RENAME+"</p>";break;case u.DISABLED:o="<p id='expRename' class='contextMenuOption disabledContextMenuOption'>"+u.LANG_LBL_RENAME+"</p>";break;case u.HIDDEN:o=""}break;case u.OPEN:switch(t){case u.ENABLED:o="<p id='expOpen' class='contextMenuOption handCursor'>"+u.LANG_LBL_OPEN+"</p>";break;case u.DISABLED:o="<p id='expOpen' class='contextMenuOption disabledContextMenuOption'>"+u.LANG_LBL_OPEN+"</p>";break;case u.HIDDEN:o=""}}return o},createBaseDialog:function(e,t,i){void 0===i&&(i=[]),void 0===e&&(e="auto"),i.width=$.isNumeric(e)?e+"px":e,void 0===t&&(t="auto"),i.height=$.isNumeric(t)?t+"px":t,void 0!==i&&(void 0===i["min-width"]&&(i["min-width"]=$.isNumeric(e)?e:0),void 0===i["min-height"]&&(i["min-height"]=$.isNumeric(t)?t:0),void 0===i.style&&(i.style=""),void 0===i["class"]&&(i["class"]="")),u.getBaseDialog().remove(),$("body").append("<div class='baseDialog radius10 opacity98 "+i["class"]+"' style='"+i.style+"'><input id='defaultWidth' type='hidden' value='"+i.width+"'/><input id='defaultHeight' type='hidden' value='"+i.height+"'/></div>"),u.getBaseDialog().css({width:i.width,height:i.height,"min-width":i["min-width"],"min-height":i["min-height"]});var o=u.getBaseDialog();o.append("<div class='closeBaseDialog handCursor displayNone' style='top: 10px; margin-right: 10px; float: right;'title='Close' alt='Close'/> <br />"),
$(".closeBaseDialog").on("click",function(){u.closeBaseDialog()}),o.append("<div id='baseDialogContent' class='baseDialogContent'> </div>")},loadBaseDialog:function(e,t){var i=$("#baseDialogContent"),o=/\.tmp$|\.html/i;o.test(e)===!0?i.load(e,function(){"undefined"!=typeof t&&t.resolve()}):i.append(e)},showBaseDialog:function(e,t){var i=u.getBaseDialog();if(!i.ready())return void this.showBaseDialog(e,t);e!==!0&&$(".closeBaseDialog").fadeIn("fast"),i.ready(function(){void 0!==t&&t.resolve()}),"auto"!=i.find("#defaultHeight").val()&&"auto"!=i.find("#defaultWidth").val()?u.resizeBaseDialog():i.css("opacity",0),i.show(u.baseDialogEffect,{},500,function(){"auto"!=i.find("#defaultHeight").val()&&"auto"!=i.find("#defaultWidth").val()||(u.resizeBaseDialog(),i.animate({opacity:1},300))});var o=i.height(),n=i.width(),s=setInterval(function(){o==i.height()&&n==i.width()||(o=i.height(),n=i.width(),i.trigger($.Event("resize")))},5);i.resize(function(){u.resizeBaseDialog()}),i.on("closeDialogEvent",function(){clearInterval(s)}),$(document).on("keyup",function(e){27==e.keyCode&&u.closeBaseDialogOnEsc===!0&&$(u.baseDialogId).length&&u.closeBaseDialog()})},closeBaseDialog:function(){var e=u.getBaseDialog();$(".closeBaseDialog").fadeOut(100),e.hide(u.baseDialogEffect,{},300,function(){e.empty()}),e.trigger("closeDialogEvent")},resizeBaseDialog:function(){var e=u.getBaseDialog();if($("#baseDialogContent").length){var t=e.outerWidth(),i=Number(e.css("min-width").replace("px","")),o=Number(e.find("#defaultWidth").val().replace("px","")),n=$(window).width();($.isNumeric(o)&&t!=i&&t>n&&i<n||t<n&&t<o)&&e.css("width",n-10+"px");var s=e.outerHeight(),r=Number(e.css("min-height").replace("px","")),a=Number(e.find("#defaultHeight").val().replace("px","")),l=$(window).height();($.isNumeric(a)&&s!=r&&s>l&&r<l||s<l&&s<a)&&e.css("height",l-10+"px"),u.centralize(u.baseDialogId)}},getBaseDialog:function(){return $(u.baseDialogId)},centralize:function(e){var t=$(e).outerWidth()/2,i=$(window).width()/2,o=$(e).outerHeight()/2,n=$(window).height()/2;$(e).css({left:i-t+"px",top:n-o+"px"})},log:function(e,t){u.debugMode},loadExplorerRootFolder:function(e){var t=document.getElementsByTagName("script"),i="",o=this;$(t).each(function(t,n){try{!function(){var t=n.attributes.src.value;$.get(t,function(n){if(n.indexOf("//METRO-EXPLORER_CODE")!=-1){for(var s=t.split("/"),r=0;r<s.length-2||0==r;r++)i=i.concat(s[0]).concat("\\");o.explorerRootFolder=i,e.resolve()}})}()}catch(s){return}}),setTimeout(function(){"pending"===e.state()&&(o.log("We could not find Explorer's root folder. Explorer will not work well without it. Please, visit www.metroui.us/Explorer to know how to fix it."),e.resolve())},1e4)},setExplorerRootFolder:function(e){this.explorerRootFolder=e},getExplorerRootFolder:function(){return this.explorerRootFolder},destroy:function(e,t){if(void 0===e||null===e)$(u.element).remove();else{var i=/#|\.*/i;i.test(e)===!0?t&&$(e).effect("explode",null,700,function(){$(this).remove()}):u.log("You must enter a valid id, or css class. For example, '#my_id' or '.my_class'.")}},open:function(e){var t=e.id,i=$.Deferred();u.selectedFiles=[],$(".file").fadeOut(200,function(){u.addFiles(Number(t),null,i)});var o=new s(t,u.getFileById(t).name);u.currentPath.push(o),$.when(i).done(function(){$(".file").fadeIn("fast")})},rename:function(e,t){var i=e.id,o=$.Deferred(),n={id:$("#"+i),inputDiv:$("#"+i).find("#input"+i),input:$("#"+i).find("#input"+i).find("input"),cover:$("#"+i).find("#input"+i).find("div")};if(t){var s=n.input.val();""===s.trim()&&(s="none",n.input.val(s)),u.serverRename(s,o),$.when(o).then(function(e){var t=u.checkIfExists(i);u.fileList[t].name=s,n.input.attr({readonly:"readonly",title:s}),n.input.val(u.fileList[t].getName()),n.input.css({border:"none",cursor:"default"}),n.inputDiv.prop("title",s),n.cover.css("display","block"),"function"==typeof e&&e(u.fileList[t])})}else n.input.val(n.inputDiv.prop("title")),n.cover.css("display","none"),n.id.find("._selected").remove(),n.id.css("border","1px solid darkgray"),n.input.removeAttr("readonly"),n.input.css({border:"2px dashed gray",cursor:"text"}),setTimeout(function(){r(n.input)},300)},serverRename:function(e,t){t.resolve(!0)},move:function(){var e=$.Deferred(),t=0;u.createBaseDialog(600),u.loadBaseDialog(u.getExplorerRootFolder()+"/templates/move.html",e),$.when(e).then(function(){var e=$("#buttonMoveFiles");u.showBaseDialog(!1),$("#moveHeader").text(u.LANG_LBL_MOVE_HEADER),e.append(u.LANG_LBL_MOVE_BT_MOVE),e.prop("title",u.LANG_LBL_MOVE_BT_MOVE_TITLE),u.currentParent!=u.ROOT&&(t++,u.createDestFolder(u.ROOT)),$.grep(u.fileList,function(e,i){"dir"!=e.ext||e.id==u.currentParent||d(u.selectedFiles,e)||(t++,u.createDestFolder(e))}),0===t&&$("#foldersList").append("<br /><p class='gray ft10'>"+u.LANG_LBL_NO_FOLDERS_FOUND+"</p>"),e.on("click",function(){u.clientMove(u.TEMP_VAR)})})},createDestFolder:function(e){var t=null,i=null;isNaN(e)?(t=e.id,i=e.name):(t=e,i=u.LANG_LBL_ROOT_FOLDER),$("#foldersList").append("<div id='mv_"+t+"' class='file mvFolderItem fileButton' style='float:left;'><div class='center iconBorder'><div class='dir center'></div></div> <input class='txtcenter ft11 inputFileName'maxlength='13' readonly='readonly' value='"+i+"'/></div>"),$("#mv_"+t).on("mousedown",function(){$(".movFolderSelect").remove(),$(".mvFolderItem").css("border","1px solid gray"),$(this).append("<div id='selec_mv_id"+t+"' class='opacity4 _selected movFolderSelect'> </div>"),$(this).css("border","1px solid blue");var e=$("#buttonMoveFiles");e.prop("disabled",!1),e.removeClass("explorerButtonDisabled"),u.TEMP_VAR=this.id.replace("mv_","")}),u.initMouseOverEvent()},clientMove:function(e,t){for(var i=-1,o=null,n=$.Deferred(),s=[],r=[],a=0;a<u.selectedFiles.length;a++)if(i=u.checkIfExists(u.selectedFiles[a].id),"dir"==u.selectedFiles[a].ext){var l=u.getMySubFolders(u.selectedFiles[a].id);$.inArray(e,l)!=-1?($(document).trigger("movingToItself",[{file:u.selectedFiles[a],msg:u.LANG_LBL_MOVE_FOLDER_ERROR_MSG.replace("{folderName}","<b>"+u.selectedFiles[a].name+"</b>")}]),u.selectedFiles.splice(a,1)):s.push(u.selectedFiles[a])}else r.push(u.selectedFiles[a]);u.serverMove(e,r,s,n),$.when(n).then(function(n){if(n===!0){u.closeBaseDialog();for(var s=function(n){var s=u.getFileById(u.selectedFiles[n].id);if(o=u.getFileById(e),e!=u.ROOT&&s.parent==u.currentParent&&o.parent==u.currentParent)s.getElement().css("z-index",999).animate({top:o.getElement().css("top"),left:o.getElement().css("left")},1e3+500*n,function(){$(this).hide("scale",{percent:0},700,function(){s.getElement().css("z-index",1)})});else if(t)s.getElement().hide("slide",{direction:"up"},500);else{var r=null;u.currentParent!==u.ROOT&&(r=u.getFileById(u.currentParent).parent),e==r?s.getElement().css("z-index",999).animate({top:u.fields.fieldList[0].element.css("top"),left:u.fields.fieldList[0].element.css("left")},1e3+500*n,function(){s.getElement().hide("slide",{direction:"up"},500)}):s.getElement().hide("clip",{},500)}i=u.checkIfExists(s.id),u.fileList[i].parent=Number(e),u.fileList[i].placed=!1,u.fileList[i].field=-1},r=0;r<u.selectedFiles.length;r++)s(r)}})},search:function(e){var t=!0;if(""===e.trim())return void u.addFiles(0);if(u.fields.fieldList=[],u.fields.usedFields=0,$(".quickAccessLink").css("text-decoration","line-through"),u.currentParent!=-1)for(var i=0;i<u.fileList.length;i++)u.fileList[i].placed=!1;u.currentParent=-1,$(".file, .field").remove();for(var o=0;o<u.fileList.length;o++)if(u.fileList[o].name.toLowerCase().indexOf(e.toLowerCase())!=-1){var n=u.fileList[o];n.found=!0,u.addFiles(n),t=!1}var s=$("#emptyMessage");t?(s.text("No file found for: "+e),s.fadeIn("fast")):s.text(u.LANG_LBL_EMPTY_MESSAGE)},serverMove:function(e,t,i,o){o.resolve(!0)},getMySubFolders:function(e){var t="";return $.each(u.fileList,function(i,o){"dir"==o.ext&&o.parent==e&&(t+=o.id+","+u.getMySubFolders(o.id))}),t=$.grep(t.split(","),function(e,t){if(""!==e)return e})},"delete":function(){u.clientDelete()},clientDelete:function(){var e=$.Deferred();u.serverDelete(e),$.when(e).then(function(e){if(e===!0){for(var t=function(e){"dir"==u.selectedFiles[e].ext&&u.deleteFolderRecursively(u.selectedFiles[e].id);var t=u.checkIfExists(u.selectedFiles[e].id),i=u.fields.fieldList[u.fileList[t].field].filesOn;u.fields.fieldList[u.fileList[t].field].filesOn=$.grep(i,function(e){return e!=u.fileList[t].id}),0===u.fields.fieldList[u.fileList[t].field].filesOn.length&&(u.fields.usedFields-=1),u.destroy("#"+u.selectedFiles[e].id,!0),u.fileList=$.grep(u.fileList,function(e,i){return e.id!=u.fileList[t].id})},i=0;i<u.selectedFiles.length;i++)t(i);u.selectedFiles=[],u.showEmptyMessage()}else u.log("Looks like your server side delete function did not return true, so explorer is not going to delete the selected files.")})},deleteFolderRecursively:function(e){for(var t=0;t<u.fileList.length;t++)if(u.fileList[t].parent==e)if("dir"==u.fileList[t].ext){var i=u.fileList[t].id;u.deleteFolderRecursively(u.fileList[t].id),u.fileList=$.grep(u.fileList,function(e,t){return e.id!=i}),t=0}else u.fileList=$.grep(u.fileList,function(e,i){return e.id!=u.fileList[t].id}),t=0},serverDelete:function(e){e.resolve(!0)},share:function(){},download:function(){},dbclick:function(e){u.TEMP_VAR=e,"dir"==e.ext?u.open(e):u.preview(e)},newFolder:function(){var e=$.Deferred();u.serverNewFolder(e),$.when(e).then(function(e){if($.isNumeric(e)){var t=new c(e,"","dir",u.currentParent);u.addFiles(t),u.rename(t,!1)}else u.log("explorer.serverNewFolder() either did not return the folder ID or its result is not a number. Result: "+e)})},serverNewFolder:function(e){return e.resolve(Math.floor(500*Math.random()+200))},upload:function(){},customMenuOption:function(e){return""},buildCustomMenuOption:function(e,t,i){var o=null,n=null,s="",r="";return o=u.customOptionId++,n=setInterval(function(){$("#contextMenuOption"+o).length&&($("#contextMenuOption"+o).on("click",function(e){l(this)&&t(u.selectedFiles)}),clearInterval(n))},50),i&&(i.disabled&&(s="disabledContextMenuOption"),i.title&&(r=i.title)),"<p title='"+r+"' id='contextMenuOption"+o+"'class='contextMenuOption handCursor "+s+"'>"+e+"</p>"},preview:function(e){},getAvailableIconExtensions:function(){for(var e=!1,t=!1,i=[],o=null,n=this.getExplorerStyleFile(),s=0;s<n.cssRules.length&&!t;s++)if(e){if(e&&!t){if(o=a(n.cssRules[s].style.background).replace("..",""),$.inArray(o,u.iconPaths)===-1&&u.iconPaths.push(o),t=".EXPLORER_EXTENSIONS_END"===n.cssRules[s].selectorText)break;for(var r=n.cssRules[s].selectorText.replace(/\./,"").split(","),l=0;l<r.length;l++)i.push(r[l])}}else e=".EXPLORER_EXTENSIONS_BEGIN"===n.cssRules[s].selectorText;return 0===i.length?null:i},getExplorerStyleFile:function(){var e=this;if(null!==this.styleFile)return this.styleFile;var t=document.styleSheets;return $(t).each(function(t,i){null===i.href&&void 0===i.href||$(i.cssRules).each(function(t,o){if(".EXPLORER_EXTENSIONS_BEGIN"==o.selectorText)return e.styleFile=i,!1})}),this.styleFile}};return u}function n(e,t,i,o,n){this.id="field_"+e,this.element=t,this.filesOn=i,this.top=o,this.left=n,this.fieldNumber=function(){return Number(this.id.replace("field_",""))}}function s(e,t){this.id=e,this.name=t}function r(e){var t=e.val();e.val(""),e.focus().val(t)}function a(e){var t="";return t=/"/.test(e)?e.match(/"(.*?)"/)[1]:e}function l(e){return!$(e).hasClass("disabledContextMenuOption")}function d(e,t,i){var o=[],n=!1;if(void 0===i){for(var s=0;s<e.length;s++){for(var r in t)if(!$.isFunction(e[s][r])&&(n=t[r]===e[s][r],!n))break;if(n)return n}return n}for(var a=0;a<e.length;a++){n=!0;for(var l=0;l<i.length;l++){var d=i[l];$.isFunction(e[a][d])||(o[l]=e[a][d]===t[d])}for(var c=0;c<o.length;c++)if(o[c]===!1){n=!1;break}if(n===!0)return n}return n}var c=e("./file.js");t.exports=o},{"./file.js":4}],4:[function(e,t,i){"use strict";var o=function(e,t,i,o,n){this.id=e,this.parent=void 0===o||null===o?0:o,this.field=void 0===n||null===n?-1:n,this.placed=!1,this.name=t,this.getIcon=function(e){if(e=void 0!==this.ext?this.ext:"",window.AVAILABLE_ICON_EXTENSIONS){var t=window.AVAILABLE_ICON_EXTENSIONS.indexOf(e.toLowerCase());if(t==-1||window.AVAILABLE_ICON_EXTENSIONS.indexOf("_".concat(e.toLowerCase()))!=-1)return"noIcon"}return e.toLowerCase()},this.getName=function(){var e=this.name;return e.length>12&&(e=e.substring(0,12)+"..."),e},this.getExtension=function(e){e=void 0===e?this.ext:e;var t=e.split("."),i=t[t.length-1];return this.getIcon(i)},this.getElement=function(){return $("#"+this.id)},this.ext=i};t.exports=o},{}],5:[function(e,t,i){"use strict";var o="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(e){return typeof e}:function(e){return e&&"function"==typeof Symbol&&e.constructor===Symbol&&e!==Symbol.prototype?"symbol":typeof e};!function(e){"function"==typeof define&&define.amd?define(["jquery"],e):e(jQuery)}(function(e){function t(t,o){var n,s,r,a=t.nodeName.toLowerCase();return"area"===a?(n=t.parentNode,s=n.name,!(!t.href||!s||"map"!==n.nodeName.toLowerCase())&&(r=e("img[usemap='#"+s+"']")[0],!!r&&i(r))):(/^(input|select|textarea|button|object)$/.test(a)?!t.disabled:"a"===a?t.href||o:o)&&i(t)}function i(t){return e.expr.filters.visible(t)&&!e(t).parents().addBack().filter(function(){return"hidden"===e.css(this,"visibility")}).length}e.ui=e.ui||{},e.extend(e.ui,{version:"1.11.4",keyCode:{BACKSPACE:8,COMMA:188,DELETE:46,DOWN:40,END:35,ENTER:13,ESCAPE:27,HOME:36,LEFT:37,PAGE_DOWN:34,PAGE_UP:33,PERIOD:190,RIGHT:39,SPACE:32,TAB:9,UP:38}}),e.fn.extend({scrollParent:function(t){var i=this.css("position"),o="absolute"===i,n=t?/(auto|scroll|hidden)/:/(auto|scroll)/,s=this.parents().filter(function(){var t=e(this);return(!o||"static"!==t.css("position"))&&n.test(t.css("overflow")+t.css("overflow-y")+t.css("overflow-x"))}).eq(0);return"fixed"!==i&&s.length?s:e(this[0].ownerDocument||document)},uniqueId:function(){var e=0;return function(){return this.each(function(){this.id||(this.id="ui-id-"+ ++e)})}}(),removeUniqueId:function(){return this.each(function(){/^ui-id-\d+$/.test(this.id)&&e(this).removeAttr("id")})}}),e.extend(e.expr[":"],{data:e.expr.createPseudo?e.expr.createPseudo(function(t){return function(i){return!!e.data(i,t)}}):function(t,i,o){return!!e.data(t,o[3])},focusable:function(i){return t(i,!isNaN(e.attr(i,"tabindex")))},tabbable:function(i){var o=e.attr(i,"tabindex"),n=isNaN(o);return(n||o>=0)&&t(i,!n)}}),e("<a>").outerWidth(1).jquery||e.each(["Width","Height"],function(t,i){function o(t,i,o,s){return e.each(n,function(){i-=parseFloat(e.css(t,"padding"+this))||0,o&&(i-=parseFloat(e.css(t,"border"+this+"Width"))||0),s&&(i-=parseFloat(e.css(t,"margin"+this))||0)}),i}var n="Width"===i?["Left","Right"]:["Top","Bottom"],s=i.toLowerCase(),r={innerWidth:e.fn.innerWidth,innerHeight:e.fn.innerHeight,outerWidth:e.fn.outerWidth,outerHeight:e.fn.outerHeight};e.fn["inner"+i]=function(t){return void 0===t?r["inner"+i].call(this):this.each(function(){e(this).css(s,o(this,t)+"px")})},e.fn["outer"+i]=function(t,n){return"number"!=typeof t?r["outer"+i].call(this,t):this.each(function(){e(this).css(s,o(this,t,!0,n)+"px")})}}),e.fn.addBack||(e.fn.addBack=function(e){return this.add(null==e?this.prevObject:this.prevObject.filter(e))}),e("<a>").data("a-b","a").removeData("a-b").data("a-b")&&(e.fn.removeData=function(t){return function(i){return arguments.length?t.call(this,e.camelCase(i)):t.call(this)}}(e.fn.removeData)),e.ui.ie=!!/msie [\w.]+/.exec(navigator.userAgent.toLowerCase()),e.fn.extend({focus:function(t){return function(i,o){return"number"==typeof i?this.each(function(){var t=this;setTimeout(function(){e(t).focus(),o&&o.call(t)},i)}):t.apply(this,arguments)}}(e.fn.focus),disableSelection:function(){var e="onselectstart"in document.createElement("div")?"selectstart":"mousedown";return function(){return this.bind(e+".ui-disableSelection",function(e){e.preventDefault()})}}(),enableSelection:function(){return this.unbind(".ui-disableSelection")},zIndex:function(t){if(void 0!==t)return this.css("zIndex",t);if(this.length)for(var i,o,n=e(this[0]);n.length&&n[0]!==document;){if(i=n.css("position"),("absolute"===i||"relative"===i||"fixed"===i)&&(o=parseInt(n.css("zIndex"),10),!isNaN(o)&&0!==o))return o;n=n.parent()}return 0}}),e.ui.plugin={add:function(t,i,o){var n,s=e.ui[t].prototype;for(n in o)s.plugins[n]=s.plugins[n]||[],s.plugins[n].push([i,o[n]])},call:function(e,t,i,o){var n,s=e.plugins[t];if(s&&(o||e.element[0].parentNode&&11!==e.element[0].parentNode.nodeType))for(n=0;s.length>n;n++)e.options[s[n][0]]&&s[n][1].apply(e.element,i)}};var n=0,s=Array.prototype.slice;e.cleanData=function(t){return function(i){var o,n,s;for(s=0;null!=(n=i[s]);s++)try{o=e._data(n,"events"),o&&o.remove&&e(n).triggerHandler("remove")}catch(r){}t(i)}}(e.cleanData),e.widget=function(t,i,o){var n,s,r,a,l={},d=t.split(".")[0];return t=t.split(".")[1],n=d+"-"+t,o||(o=i,i=e.Widget),e.expr[":"][n.toLowerCase()]=function(t){return!!e.data(t,n)},e[d]=e[d]||{},s=e[d][t],r=e[d][t]=function(e,t){return this._createWidget?void(arguments.length&&this._createWidget(e,t)):new r(e,t)},e.extend(r,s,{version:o.version,_proto:e.extend({},o),_childConstructors:[]}),a=new i,a.options=e.widget.extend({},a.options),e.each(o,function(t,o){return e.isFunction(o)?void(l[t]=function(){var e=function(){return i.prototype[t].apply(this,arguments)},n=function(e){return i.prototype[t].apply(this,e)};return function(){var t,i=this._super,s=this._superApply;return this._super=e,this._superApply=n,t=o.apply(this,arguments),this._super=i,this._superApply=s,t}}()):void(l[t]=o)}),r.prototype=e.widget.extend(a,{widgetEventPrefix:s?a.widgetEventPrefix||t:t},l,{constructor:r,namespace:d,widgetName:t,widgetFullName:n}),s?(e.each(s._childConstructors,function(t,i){var o=i.prototype;e.widget(o.namespace+"."+o.widgetName,r,i._proto)}),delete s._childConstructors):i._childConstructors.push(r),e.widget.bridge(t,r),r},e.widget.extend=function(t){for(var i,o