mirror of
https://github.com/aaPanel/aaPanel.git
synced 2026-10-01 05:44:50 +02:00
2.The page is displayed when the adjustment panel is wrong 3.App store add common plug-in display 4.Adjust the sessionid name to a non-fixed name 5.Panel CSRF defense mechanism covers panel websocket communication 6.Adjust the font size of the panel list 7.Adjust the panel pop-up window (add a close button to cancel the automatic closing time) 8.Optimize the front/back end of the file manager 9.Add the entrance of the MailServer Rspamd 10.Refactor the debug module 11.Other known bug fixes
1 line
158 KiB
JavaScript
1 line
158 KiB
JavaScript
var bt_file={area:[],loadT:null,loadY:null,vscode:null,file_table_arry:[],timerM:null,is_update_down_list:!0,is_recycle:!1,is_editor:!1,file_header:{file_checkbox:40,file_name:"auto",file_accept:130,file_size:90,file_mtime:155,file_ps:"auto",file_operation:350,file_tr:0,file_list_header:0},file_operating:[],file_pointer:-1,file_path:"C:/",file_page_num:bt.get_storage("local","showRow")||100,file_list:[],file_store_list:[],file_store_current:0,file_images_list:[],file_drop:null,file_present_task:null,file_selection_operating:[],file_share_list:[],scroll_width:function(){var noScroll,scroll,oDiv=document.createElement("DIV");return oDiv.style.cssText="position:absolute; top:-1000px; width:100px; height:100px; overflow:hidden;",noScroll=document.body.appendChild(oDiv).clientWidth,oDiv.style.overflowY="scroll",scroll=oDiv.clientWidth,document.body.removeChild(oDiv),noScroll-scroll}(),is_mobile:function(){return!(!navigator.userAgent.match(/mobile/i)&&!/(iPhone|iPad|iPod|iOS|Android)/i.test(navigator.userAgent))&&(layer.msg(navigator.userAgent.match(/mobile/i),{icon:2,time:0}),!0)},method_list:{GetFileBody:lan.public.get_file_contents,DeleteDir:lan.public.deleting,DeleteFile:lan.public.deleting,GetDiskInfo:["system",lan.public.getting_disk_list],CheckExistsFiles:lan.files.check_same_name_file,GetFileAccess:lan.files.getting_permission_list,SetFileAccess:lan.public.config,DelFileAccess:lan.files.deleting_user,get_path_size:lan.files.getting_dir_size,add_files_store_types:lan.files.create_favorite,get_files_store:lan.files.getting_favorite,del_files_store:lan.files.unfavorite,dir_webshell_check:"目录查杀",file_webshell_check:"查杀文件",get_download_url_list:lan.files.getting_share_list,get_download_url_find:lan.files.getting_s_share_info,create_download_url:lan.files.create_share,remove_download_url:lan.files.cancel_share,add_files_store:lan.files.adding_favorite,CopyFile:lan.files.copy_the,MvFile:lan.files.mv_the,SetBatchData:lan.files.performing_bulk_opt,Get_Recycle_bin:lan.files.getting_recycle_list,get_path_premissions:lan.files.getting_permission_list,back_path_permissions:lan.files.setting_permission_list,get_all_back:lan.files.getting_permission_list,fix_permissions:lan.files.fix_permission,del_path_premissions:lan.files.deleting_permission},file_drop:{f_path:null,startTime:0,endTime:0,uploadLength:0,splitSize:2097152,splitEndTime:0,splitStartTime:0,fileSize:0,speedLastTime:0,filesList:[],errorLength:0,isUpload:!0,uploadSuspend:[],isUploadNumber:800,uploadAllSize:0,uploadedSize:0,updateedSizeLast:0,topUploadedSize:0,uploadExpectTime:0,initTimer:0,speedInterval:null,timerSpeed:0,isLayuiDrop:!1,uploading:!1,is_webkit:navigator.userAgent.indexOf("WebKit")>-1,init:function(){0==$("#mask_layer").length&&(window.UploadFiles=function(){bt_file.file_drop.dialog_view()},$("body").append($('<div class="mask_layer" id="mask_layer" style="position:fixed;top:0;left:0;right:0;bottom:0; background:rgba(255,255,255,0.6);border:3px #ccc dashed;z-index:99999999;display:none;color:#999;font-size:40px;text-align:center;overflow:hidden;"><span style="position: absolute;top: 50%;left: 50%;margin-left: -300px;margin-top: -40px;">Upload files to the current directory'+(this.is_webkit?"":'<i style="font-size:20px;font-style:normal;display:block;margin-top:15px;color:red;">The current browser does not support drag upload. Commend to use Chrome browser or WebKit kernel for browsing</i>')+"</span></div>")),this.event_relation(document.querySelector("#container"),document,document.querySelector("#mask_layer")))},event_relation:function(enter,leave,drop){var that=this,obj=Object.keys(arguments);for(var item in arguments)"object"==typeof arguments[item]&&void 0!==arguments[item].nodeType&&(arguments[item]={el:arguments[item],callback:null});leave.el.addEventListener("dragleave",null!=leave.callback?leave.callback:function(e){0==e.x&&0==e.y&&$("#mask_layer").hide(),e.preventDefault()},!1),enter.el.addEventListener("dragenter",null!=enter.callback?enter.callback:function(e){if("string"==e.dataTransfer.items[0].kind)return!1;$("#mask_layer").show(),that.isLayuiDrop=!1,e.preventDefault()},!1),drop.el.addEventListener("dragover",(function(e){e.preventDefault()}),!1),drop.el.addEventListener("drop",null!=enter.callback?drop.callback:that.ev_drop,!1)},ev_drop:function(e){if("string"==e.dataTransfer.items[0].kind)return!1;if(!bt_file.file_drop.is_webkit)return $("#mask_layer").hide(),!1;if(e.preventDefault(),bt_file.file_drop.uploading)return layer.msg("Uploading files, please wait..."),!1;var items=e.dataTransfer.items,time,num=0;if(loadT=layer.msg("Getting upload files details, please wait...",{icon:16,time:0,shade:.3}),bt_file.file_drop.isUpload=!0,items&&items.length&&null!=items[0].webkitGetAsEntry&&"file"!=items[0].kind)return!1;null==bt_file.file_drop.filesList&&(bt_file.file_drop.filesList=[]);for(var i=bt_file.file_drop.filesList.length-1;i>=0;i--)bt_file.file_drop.filesList[i].is_upload&&bt_file.file_drop.filesList.splice(-i,1);function update_sync(s){s.getFilesAndDirectories().then((function(subFilesAndDirs){return iterateFilesAndDirs(subFilesAndDirs,s.path)}))}$("#mask_layer").hide();var iterateFilesAndDirs=function(filesAndDirs,path){if(!bt_file.file_drop.isUpload)return!1;for(var i=0;i<filesAndDirs.length;i++)if("function"==typeof filesAndDirs[i].getFilesAndDirectories)update_sync(filesAndDirs[i]);else{if(num>bt_file.file_drop.isUploadNumber)return bt_file.file_drop.isUpload=!1,layer.msg(" "+bt_file.file_drop.isUploadNumber+" items cannot upload, please compress first!。",{icon:2,area:"405px"}),bt_file.file_drop.filesList=[],clearTimeout(time),!1;bt_file.file_drop.filesList.push({file:filesAndDirs[i],path:bt.get_file_path(path+"/"+filesAndDirs[i].name).replace("//","/"),name:filesAndDirs[i].name.replace("//","/"),icon:bt_file.get_ext_name(filesAndDirs[i].name),size:bt_file.file_drop.to_size(filesAndDirs[i].size),upload:0,is_upload:!1}),bt_file.file_drop.uploadAllSize+=filesAndDirs[i].size,clearTimeout(time),time=setTimeout((function(){layer.close(loadT),bt_file.file_drop.dialog_view()}),100),num++}};"getFilesAndDirectories"in e.dataTransfer&&e.dataTransfer.getFilesAndDirectories().then((function(filesAndDirs){return iterateFilesAndDirs(filesAndDirs,"/")}))},dialog_view:function(config){var that=this,html="";if(this.f_path=bt_file.file_path,!$(".file_dir_uploads").length>0){null==that.filesList&&(that.filesList=[]);for(var i=0;i<that.filesList.length;i++){var item;html+='<li><div class="fileItem"><span class="filename" title="File path:'+((item=that.filesList[i]).path+"/"+item.name).replace("//","/")+" File type:"+item.file.type+" File size:"+item.size+'"><i class="ico ico-'+item.icon+'"></i>'+(item.path+"/"+item.name).replace("//","/")+'</span><span class="filesize">'+item.size+'</span><span class="fileStatus">'+that.is_upload_status(item.upload)+'</span></div><div class="fileLoading"></div></li>'}var is_show=that.filesList.length>11;layer.open({type:1,closeBtn:1,maxmin:!0,area:["550px","505px"],btn:["Upload","Cancel","Clear"],title:"Upload files to【"+bt.get_cookie("Path")+"】--- Support breakpoint renewal",skin:"file_dir_uploads",content:'<div style="padding:15px 15px 10px 15px;"><div class="upload_btn_groud"><div class="btn-group"><button type="button" class="btn btn-primary btn-sm upload_file_btn">Upload file</button><button type="button" class="btn btn-primary btn-sm dropdown-toggle" data-toggle="dropdown" aria-haspopup="true" aria-expanded="false"><span class="caret"></span><span class="sr-only">Toggle Dropdown</span></button><ul class="dropdown-menu"><li><a href="#" data-type="file">Upload file</a></li><li><a href="#" data-type="dir">Upload path</a></li></ul></div><div class="file_upload_info" style="display:none;"><span>Total process <i class="uploadProgress"></i>, uploading <i class="uploadNumber"></i>,</span><span style="display:none">Upload fail <i class="uploadError"></i></span><span>Speed <i class="uploadSpeed">Getting</i>,</span><span>Expect time <i class="uploadEstimate">Getting</i></span><i></i></div></div><div class="upload_file_body '+(""==html?"active":"")+'">'+(""!=html?'<ul class="dropUpLoadFileHead" style="padding-right:'+(is_show?"15":"0")+'px"><li class="fileTitle"><span class="filename">File name</span><span class="filesize">File size</span><span class="fileStatus">File status</span></li></ul><ul class="dropUpLoadFile list-list">'+html+"</ul>":"<span>Please drag the file here"+(that.is_webkit?"":'<i style="display: block;font-style: normal;margin-top: 10px;color: red;font-size: 17px;">The current browser does not support drag upload. Commend to use Chrome browser or WebKit kernel for browsing</i>')+"</span>")+"</div></div>",success:function(layers){$("#mask_layer").hide(),layers.find(".layui-layer-btn2").css("margin","0 300px 0 0"),$(".file_dir_uploads .layui-layer-max").hide(),$(".upload_btn_groud .upload_file_btn").click((function(){$(".upload_btn_groud .dropdown-menu [data-type=file]").click()})),$(".upload_btn_groud .dropdown-menu a").click((function(){var type=$(this).attr("data-type");$('<input type="file" multiple="true" autocomplete="off" '+("dir"==type?'webkitdirectory=""':"")+" />").change((function(e){for(var files=e.target.files,arry=[],i=0;i<files.length;i++){var config={file:files[i],path:bt.get_file_path("/"+files[i].webkitRelativePath).replace("//","/"),icon:bt_file.get_ext_name(files[i].name),name:files[i].name.replace("//","/"),size:that.to_size(files[i].size),upload:0,is_upload:!0};that.filesList.push(config),bt_file.file_drop.uploadAllSize+=files[i].size}that.dialog_view(that.filesList)})).click()}));var el="";that.event_relation({el:$(".upload_file_body")[0],callback:function(e){$(this).hasClass("active")&&$(this).css("borderColor","#4592f0").find("span").css("color","#4592f0")}},{el:$(".upload_file_body")[0],callback:function(e){$(this).hasClass("active")&&$(this).removeAttr("style").find("span").removeAttr("style")}},{el:$(".upload_file_body")[0],callback:function(e){var active=$(".upload_file_body");active.hasClass("active")&&active.removeAttr("style").find("span").removeAttr("style"),that.ev_drop(e),that.isLayuiDrop=!0}})},yes:function(index,layero){if(!that.uploading){if(0==that.filesList.length)return layer.msg("Please select file",{icon:0}),!1;$(".layui-layer-btn0").css({cursor:"no-drop",background:"#5c9e69"}).attr("data-upload","true").text("Uploading"),that.upload_file(),that.initTimer=new Date,that.uploading=!0}},btn2:function(index,layero){if(that.uploading)return layer.confirm("Do you want to cancel the upload of files? It need to delete the uploaded files manually. Continue?",{title:"Cancel file upload",icon:0},(function(indexs){layer.close(index),layer.close(indexs)})),!1;layer.close(index)},btn3:function(index,layero){return that.uploading?(layer.confirm("Do you want to cancel the upload of files? It need to delete the uploaded files manually. Continue?",{title:"Cancel file upload",icon:0},(function(indexs){$(".upload_file_body").addClass("active").html("<span>Please drag the file here</span>"),$('.file_upload_info').css('display','none').siblings().css('display','block'),that.filesList.length=0})),!1):($(".upload_file_body").addClass("active").html("<span>Please drag the file here</span>"),$('.file_upload_info').css('display','none').siblings().css('display','block'),that.filesList.length=0,!1)},end:function(){that.clear_drop_stauts(!0)},min:function(){$(".file_dir_uploads .layui-layer-max").show(),$("#layui-layer-shade"+$(".file_dir_uploads").attr("times")).fadeOut()},restore:function(){$(".file_dir_uploads .layui-layer-max").hide(),$("#layui-layer-shade"+$(".file_dir_uploads").attr("times")).fadeIn()}})}else{if(null==config&&!that.isLayuiDrop)return!1;if(that.isLayuiDrop&&(config=that.filesList),$(".upload_file_body").html('<ul class="dropUpLoadFileHead" style="padding-right:'+(config.length>11?"15":"0")+'px"><li class="fileTitle"><span class="filename">File name</span><span class="filesize">File size</span><span class="fileStatus">File status</span></li></ul><ul class="dropUpLoadFile list-list"></ul>').removeClass("active"),Array.isArray(config)){for(var i=0;i<config.length;i++){var item;html+='<li><div class="fileItem"><span class="filename" title="File path:'+(item=config[i]).path+"/"+item.name+" File type:"+item.file.type+" Size:"+item.size+'"><i class="ico ico-'+item.icon+'"></i>'+(item.path+"/"+item.name).replace("//","/")+'</span><span class="filesize">'+item.size+'</span><span class="fileStatus">'+that.is_upload_status(item.upload)+'</span></div><div class="fileLoading"></div></li>'}$(".dropUpLoadFile").append(html)}else $(".dropUpLoadFile").append('<li><div class="fileItem"><span class="filename" title="File path:'+(config.path+"/"+config.name).replace("//","/")+" File type:"+config.type+" Size:"+config.size+'"><i class="ico ico-'+config.icon+'"></i>'+(config.path+"/"+config.name).replace("//","/")+'</span><span class="filesize">'+config.size+'</span><span class="fileStatus">'+that.is_upload_status(config.upload)+'</span></div><div class="fileLoading"></div></li>')}},is_upload_status:function(status,val){switch(void 0===val&&(val=""),status){case-1:return'<span class="upload_info upload_error" title="Fail'+(""!=val?","+val:"")+'">Fail'+(""!=val?","+val:"")+"</span>";case 0:return'<span class="upload_info upload_primary">Waiting to upload</span>';case 1:return'<span class="upload_info upload_success">Uploaded</span>';case 2:return'<span class="upload_info upload_warning">Uploading '+val+"</span>";case 3:return'<span class="upload_info upload_success">Stoped</span>'}},set_upload_view:function(index,config){var item=$(".dropUpLoadFile li:eq("+index+")"),that=this,file_info=$(".file_upload_info");0==$(".file_upload_info .uploadProgress").length&&$(".file_upload_info").html('<span>Total process <i class="uploadProgress"></i>,Uploading <i class="uploadNumber"></i>,</span><span style="display:none">Fail <i class="uploadError"></i></span><span>Speed <i class="uploadSpeed">Getting</i>,</span><span>Expect time <i class="uploadEstimate">Getting</i></span><i></i>'),file_info.show().prev().hide().parent().css("paddingRight",0),this.errorLength>0&&file_info.find(".uploadError").text("("+this.errorLength+"份)").parent().show(),file_info.find(".uploadNumber").html("("+this.uploadLength+"/"+this.filesList.length+")"),file_info.find(".uploadProgress").html((this.uploadedSize/this.uploadAllSize*100).toFixed(2)+"%"),1===config.upload||-1===config.upload?(this.filesList[index].is_upload=!0,this.uploadLength+=1,item.find(".fileLoading").css({width:"100%",opacity:".5",background:-1==config.upload?"#ffadad":"#20a53a21"}),item.find(".filesize").text(config.size),item.find(".fileStatus").html(this.is_upload_status(config.upload,1===config.upload?"(Time:"+this.diff_time(this.startTime,this.endTime)+")":config.errorMsg)),item.find(".fileLoading").fadeOut(500,(function(){$(this).remove();var uploadHeight=$(".dropUpLoadFile");if(0==uploadHeight.length)return!1;uploadHeight[0].scrollHeight>uploadHeight.height()&&uploadHeight.scrollTop(uploadHeight.scrollTop()+40)}))):(item.find(".fileLoading").css("width",config.percent),item.find(".filesize").text(config.upload_size+"/"+config.size),item.find(".fileStatus").html(this.is_upload_status(config.upload,"("+config.percent+")")))},clear_drop_stauts:function(status){var time=new Date,that=this;if(!status)try{var s_peed=bt_file.file_drop.to_size(bt_file.file_drop.uploadedSize/((time.getTime()-bt_file.file_drop.initTimer.getTime())/1e3));$(".file_upload_info").html("<span>"+this.uploadLength+" uploaded,"+(this.errorLength>0?this.errorLength+"failures, ":"")+"time"+this.diff_time(this.initTimer,time)+",speed "+s_peed+"/s</span>").append($('<i class="ico-tips-close"></i>').click((function(){$(".file_upload_info").hide().prev().show()})))}catch(e){}$(".layui-layer-btn0").removeAttr("style data-upload").text(lan.upload.upload),$.extend(bt_file.file_drop,{startTime:0,endTime:0,uploadLength:0,splitSize:2097152,filesList:[],errorLength:0,isUpload:!1,isUploadNumber:800,uploadAllSize:0,uploadedSize:0,topUploadedSize:0,uploadExpectTime:0,initTimer:0,speedInterval:null,timerSpeed:0,uploading:!1}),clearInterval(this.speedInterval)},upload_file:function(fileStart,index){if(null==fileStart&&0==this.uploadSuspend.length&&(fileStart=0,index=0),this.filesList.length===index)return clearInterval(this.speedInterval),this.clear_drop_stauts(),bt_file.reader_file_list({path:bt_file.file_path,is_operating:!1}),!1;var that=this;that.splitEndTime=(new Date).getTime(),that.get_timer_speed(),that.splitStartTime=(new Date).getTime();var item=this.filesList[index],fileEnd="";if(null==item)return!1;fileEnd=Math.min(item.file.size,fileStart+this.splitSize),that.fileSize=fileEnd-fileStart,form=new FormData,0==fileStart&&(that.startTime=new Date,item=$.extend(item,{percent:"0%",upload:2,upload_size:"0B"})),form.append("f_path",this.f_path+item.path),form.append("f_name",item.name),form.append("f_size",item.file.size),form.append("f_start",fileStart),form.append("blob",item.file.slice(fileStart,fileEnd)),that.set_upload_view(index,item),$.ajax({url:"/files?action=upload",type:"POST",data:form,async:!0,processData:!1,contentType:!1,success:function(data){"number"==typeof data?(that.set_upload_view(index,$.extend(item,{percent:(data/item.file.size*100).toFixed(2)+"%",upload:2,upload_size:that.to_size(data)})),that.uploadedSize+=fileEnd!=data?data:parseInt(fileEnd-fileStart),that.upload_file(data,index)):data.status?(that.endTime=new Date,that.uploadedSize+=parseInt(fileEnd-fileStart),that.set_upload_view(index,$.extend(item,{upload:1,upload_size:item.size})),that.upload_file(0,index+=1)):(that.set_upload_view(index,$.extend(item,{upload:-1,errorMsg:data.msg})),that.errorLength++)},error:function(e){if(void 0===that.filesList[index].req_error&&(that.filesList[index].req_error=1),that.filesList[index].req_error>2)return that.set_upload_view(index,$.extend(that.filesList[index],{upload:-1,errorMsg:"error"==e.statusText?lan.public.network_err:e.statusText})),that.errorLength++,that.upload_file(fileStart,index+=1),!1;that.filesList[index].req_error+=1,that.upload_file(fileStart,index)}})},get_timer_speed:function(speed){var done_time=(new Date).getTime();if(done_time-this.speedLastTime>1e3){var that=this,num=0;null==speed&&(speed=200);var s_time=(this.splitEndTime-this.splitStartTime)/1e3;if(this.timerSpeed=(this.fileSize/s_time).toFixed(2),this.updateedSizeLast=this.uploadedSize,this.timerSpeed<2)return;$(".file_upload_info .uploadSpeed").text(this.to_size(isNaN(this.timerSpeed)?0:this.timerSpeed)+"/s");var estimateTime=this.time(parseInt((this.uploadAllSize-this.uploadedSize)/this.timerSpeed*1e3));isNaN(this.timerSpeed)||$(".file_upload_info .uploadEstimate").text(-1==estimateTime.indexOf("NaN")?estimateTime:"0 "+lan.bt.s),this.speedLastTime=done_time}},time:function(date){var hours=Math.floor(date/36e5),minutes=Math.floor(date/6e4),seconds=parseInt(date%6e4/1e3),result=seconds+"sec";return minutes>0&&(result=minutes+"min"+seconds+"sec"),hours>0&&(result=hours+"hour"+Math.floor((date-36e5*hours)/6e4)+"min"),result},diff_time:function(start_date,end_date){var diff=end_date.getTime()-start_date.getTime(),minutes=Math.floor(diff/6e4),leave3,seconds=diff%6e4/1e3,result=seconds.toFixed(minutes>0?0:2)+lan.bt.s;return minutes>0&&(result=minutes+"min"+seconds.toFixed(0)+lan.bt.s),result},to_size:function(a){for(var d=[" B"," KB"," MB"," GB"," TB"," PB"],e=1024,b=0;b<d.length;b+=1){if(a<e){var num=(0===b?a:a.toFixed(2))+d[b];return isNaN(0===b?a:a.toFixed(2))||void 0===num?"0B":num}a/=e}}},init:function(){null!=bt.get_cookie("rank")&&null!=bt.get_cookie("rank")&&"a"!=bt.get_cookie("rank")&&"b"!=bt.get_cookie("rank")||bt.set_cookie("rank","list"),this.area=[window.innerWidth,window.innerHeight],this.file_path=bt.get_cookie("Path"),this.event_bind(),this.reader_file_list({is_operating:!0}),this.render_file_disk_list(),this.file_drop.init(),this.set_file_table_width()},event_bind:function(){var that=this;$(window).resize((function(ev){$(this)[0].innerHeight!=that.area[1]&&(that.area[1]=$(this)[0].innerHeight,that.set_file_view()),$(this)[0].innerWidth!=that.area[0]&&(that.area[0]=$(this)[0].innerWidth,that.set_dir_view_resize(),that.set_menu_line_view_resize(),that.set_file_table_width())})).keydown((function(e){var keyCode=(e=window.event||e).keyCode,tagName=e.target.tagName.toLowerCase();that.is_editor||(e.ctrlKey&&86==keyCode&&"input"!=tagName&&"textarea"!=tagName&&that.paste_file_or_dir(),8==keyCode&&"input"!==tagName&&"textarea"!==tagName&&void 0===$(e.target).attr("data-backspace")&&$(".file_path_upper").click())})),$(".search_path_views").find(".file_search_checked").unbind("click").click((function(){$(this).hasClass("active")?$(this).removeClass("active"):$(this).addClass("active")})),$(".search_path_views").on("click",".path_btn",(function(e){var _obj={path:that.file_path,search:$(".file_search_input").val()};$("#search_all").hasClass("active")&&(_obj.all="True"),that.loadT=bt.load("Searching file, please wait..."),that.reader_file_list(_obj,(function(res){res.msg||that.loadT.close()})),e.stopPropagation()})),$(".search_path_views").on("click",".file_search_config label",(function(e){$(this).prev().click()})),$(".search_path_views .file_search_input").on("focus keyup",(function(e){e=e||window.event;var _obj={path:that.file_path,search:$(this).val()};switch(e.type){case"keyup":var isCheck;if($(".file_search_checked").hasClass("active")&&(_obj.all="True"),13!=e.keyCode&&"keyup"==e.type)return!1;that.loadT=bt.load("Searching file, please wait..."),that.reader_file_list(_obj,(function(res){res.msg||that.loadT.close()}))}e.stopPropagation(),e.preventDefault()})),$(".file_path_input .path_input").on("focus blur keyup",(function(e){e=e||window.event;var path=$(this).attr("data-path"),_this=$(this);switch(e.type){case"focus":$(this).addClass("focus").val(path).prev().hide();break;case"blur":$(this).removeClass("focus").val("").prev().show();break;case"keyup":if(13!=e.keyCode&&"keyup"==e.type)return!1;$(this).data("path")!=$(this).val()&&that.reader_file_list({path:that.path_check($(this).val()),is_operating:!0},(function(res){!1===res.status?_this.val(path):(_this.val(that.path_check(res.PATH)),_this.blur().prev().show())}))}e.stopPropagation()})),$(".file_path_input .file_dir_view").on("click",".file_dir",(function(){that.reader_file_list({path:$(this).attr("title"),is_operating:!0})})),$(".forward_path span").click((function(){var index=$(this).index(),path="";if(!$(this).hasClass("active")){switch(index){case 0:that.file_pointer=that.file_pointer-1,path=that.file_operating[that.file_pointer];break;case 1:that.file_pointer=that.file_pointer+1,path=that.file_operating[that.file_pointer]}that.reader_file_list({path:path,is_operating:!1})}})),$(".file_path_input .file_dir_view").on("click",".file_dir_omit",(function(e){var _this=this,new_down_list=$(this).children(".nav_down_list");$(this).addClass("active"),new_down_list.addClass("show"),$(document).one("click",(function(){$(_this).removeClass("active"),new_down_list.removeClass("show"),e.stopPropagation()})),e.stopPropagation()})),$(".file_path_input .file_dir_view").on("click",".file_dir_item i",(function(e){var children_list=$(this).siblings(".nav_down_list"),_path=$(this).siblings("span").attr("title");children_list.show().parent().siblings().find(".nav_down_list").removeAttr("style"),that.render_path_down_list(children_list,_path),$(document).one("click",(function(){children_list.removeAttr("style"),e.stopPropagation()})),e.stopPropagation()})),$(".file_path_input .file_dir_view").on("click",".file_dir_item .nav_down_list li",(function(e){that.reader_file_list({path:$(this).data("path"),is_operating:!0})})),$(".file_path_upper").click((function(){that.reader_file_list({path:that.retrun_prev_path(that.file_path),is_operating:!0})})),$(".file_path_refresh").click((function(){that.reader_file_list({path:that.file_path},(function(res){res.msg||layer.msg("Refresh succeeded")}))})),$(".upload_file").on("click",(function(e){that.file_drop.dialog_view()})),$(".upload_download").on("click",(function(e){that.open_download_view()})),$(".file_nav_view .create_file_or_dir li").on("click",(function(e){if($(this).index()>1)return that.file_groud_event({open:"soft_link"}),!1;var type=$(this).data("type"),nav_down_list=$(".create_file_or_dir .nav_down_list");if(nav_down_list.css({display:function(){return setTimeout((function(){nav_down_list.removeAttr("style")}),100),"none"}}),that.is_editor)return!1;that.is_editor=!0,$(".file_list_content").prepend('<div class="file_tr createModel active"><div class="file_td file_checkbox"></div><div class="file_td file_name"><div class="file_ico_type"><i class="file_icon '+("newBlankDir"==type?"file_folder":"")+'"></i></div>'+("icon"==bt.get_cookie("rank")?'<span class="file_title file_'+("newBlankDir"==type?"dir":"file")+'_status"><textarea name="createArea" onfocus="select()">'+("newBlankDir"==type?"New directory":"New blank file")+"</textarea></span>":'<span class="file_title file_'+("newBlankDir"==type?"dir":"file")+'_status"><input name="createArea" value="'+("newBlankDir"==type?"New directory":"New blank file")+'" onfocus="select()" type="text"></span>')+"</div></div>"),$(("icon"==bt.get_cookie("rank")?"textarea":"input")+"[name=createArea]").on("input",(function(){"icon"==bt.get_cookie("rank")&&(this.style.height="auto",this.style.height=this.scrollHeight+"px")})).keyup((function(e){13==e.keyCode&&$(this).blur()})).blur((function(e){var _val=$(this).val().replace(/[\r\n]/g,"");if(that.match_unqualified_string(_val))return layer.msg('Name cannot contain /\\:*?"<>| symbol',{icon:2});""==_val&&(_val="newBlankDir"==type?"New directory":"New blank file"),setTimeout((function(){that.create_file_req({type:"newBlankDir"==type?"folder":"file",path:that.file_path+"/"+_val},(function(res){res.status&&that.reader_file_list({path:that.file_path}),layer.msg(res.msg,{icon:res.status?1:2})})),$(".createModel").remove(),that.is_editor=!1}),300),e.preventDefault()})).focus(),e.stopPropagation(),e.preventDefault()})),$(".file_nav_view .favorites_file_path ul").on("click","li",(function(e){var _href=$(this).data("path"),_type=$(this).data("type"),nav_down_list=$(".favorites_file_path .nav_down_list");if("dir"==_type)that.reader_file_list({path:_href,is_operating:!0});else{if(null!=$(this).data("null"))return!1;var _file=$(this).attr("title").split("."),_fileT=_file[_file.length-1],_fileE;switch(that.determine_file_type(_fileT)){case"text":openEditorView(0,_href);break;case"video":that.open_video_play(_href);break;case"images":that.open_images_preview({filename:$(this).attr("title"),path:_href});break;default:that.reader_file_list({path:that.retrun_prev_path(_href),is_operating:!0})}}nav_down_list.css({display:function(){return setTimeout((function(){nav_down_list.removeAttr("style")}),100),"none"}}),e.stopPropagation(),e.preventDefault()})),$(".terminal_view").on("click",(function(){web_shell()})),$(".share_file_list").on("click",(function(){that.open_share_view()})),$(".mount_disk_list").on("click",".nav_btn",(function(){var path=$(this).data("menu");that.reader_file_list({path:path,is_operating:!0})})),$(".mount_disk_list").on("click",".nav_down_list li",(function(){var path=$(this).data("disk"),disk_list=$(".mount_disk_list.thezoom .nav_down_list");disk_list.css({display:function(){return setTimeout((function(){disk_list.removeAttr("style")}),100),"none"}}),that.reader_file_list({path:path,is_operating:!0})})),$(".file_nav_view").on("click",".manage_backup",(function(ev){that.manage_backup(),ev.stopPropagation(),ev.preventDefault()})),$(".file_nav_view").on("click",".recycle_bin",(function(ev){that.recycle_bin_view(),ev.stopPropagation(),ev.preventDefault()})),$(".file_nav_view .multi").on("click",".nav_btn_group",(function(ev){var batch_type=$(this).data("type");void 0!==batch_type&&that.batch_file_manage(batch_type),ev.stopPropagation(),ev.preventDefault()})),$(".file_nav_view .multi").on("click",".nav_btn_group li",(function(ev){var batch_type=$(this).data("type");that.batch_file_manage(batch_type),ev.stopPropagation(),ev.preventDefault()})),$(".file_nav_view").on("click",".file_all_paste",(function(){that.paste_file_or_dir()})),$(".file_list_header").on("click",".file_name,.file_size,.file_mtime,.file_accept,.file_user",(function(e){var _tid=$(this).attr("data-tid"),_reverse=$(this).find(".icon_sort").hasClass("active"),_active=$(this).hasClass("active");return!$(this).find(".icon_sort").hasClass("active")&&$(this).hasClass("active")?$(this).find(".icon_sort").addClass("active"):$(this).find(".icon_sort").removeClass("active"),$(this).addClass("active").siblings().removeClass("active").find(".icon_sort").removeClass("active").empty(),$(this).find(".icon_sort").html('<i class="iconfont icon-xiala"></i>'),_active||(_reverse=!0),bt.set_cookie("files_sort",_tid),bt.set_cookie("name_reverse",_reverse?"True":"False"),that.reader_file_list({reverse:_reverse?"True":"False",sort:_tid}),!1})),$(".file_list_header .file_th").each((function(index,item){var files_sort=bt.get_cookie("files_sort"),name_reverse=bt.get_cookie("name_reverse");$(this).attr("data-tid")===files_sort&&($(this).addClass("active").siblings().removeClass("active").find(".icon_sort").removeClass("active").empty(),$(this).find(".icon_sort").html('<i class="iconfont icon-xiala"></i>'),"False"===name_reverse&&$(this).find(".icon_sort").addClass("active"))})),$(".file_list_header .file_check").on("click",(function(e){var checkbox;switch(parseInt($(this).data("checkbox"))){case 0:$(this).addClass("active").removeClass("active_2").data("checkbox",1),$(".file_list_content .file_tr").addClass("active").removeClass("active_2"),$(".nav_group.multi").removeClass("hide"),$(".file_menu_tips").addClass("hide"),that.file_table_arry=that.file_list.slice();break;case 2:$(this).addClass("active").removeClass("active_2").data("checkbox",1),$(".file_list_content .file_tr").addClass("active"),$(".nav_group.multi").removeClass("hide"),$(".file_menu_tips").addClass("hide"),that.file_table_arry=that.file_list.slice();break;case 1:$(this).removeClass("active active_2").data("checkbox",0),$(".file_list_content .file_tr").removeClass("active"),$(".nav_group.multi").addClass("hide"),$(".file_menu_tips").removeClass("hide"),that.file_table_arry=[]}that.calculate_table_active()})),$(".file_list_content").on("click",".file_checkbox",(function(e){var _tr=$(this).parents(".file_tr"),index=_tr.data("index"),filename=_tr.data("filename");_tr.hasClass("active")?(_tr.removeClass("active"),that.remove_check_file(that.file_table_arry,"filename",filename)):(_tr.addClass("active"),_tr.attr("data-filename",that.file_list[index].filename),that.file_table_arry.push(that.file_list[index])),that.calculate_table_active(),e.stopPropagation()})),$(".file_list_content").scroll((function(e){$(this).scrollTop()==$(this)[0].scrollHeight-$(this)[0].clientHeight?($(this).prev().css("opacity",1),$(this).next().css("opacity",0)):$(this).scrollTop()>0?$(this).prev().css("opacity",1):0==$(this).scrollTop()&&($(this).prev().css("opacity",0),$(this).next().css("opacity",1))})),$(".file_table_view .file_list_content").on("click",".file_tr",(function(e){if($(e.target).hasClass("foo_menu_title")||$(e.target).parents().hasClass("foo_menu_title"))return!0;$(this).addClass("active").siblings().removeClass("active"),that.file_table_arry=[that.file_list[$(this).data("index")]],that.calculate_table_active(),e.stopPropagation(),e.preventDefault()})),$(".file_table_view .file_list_content").on("click",".file_name .iconfont",(function(e){var file_tr,index=$(this).parents(".file_tr").data("index"),data=that.file_list[index];data.index=index,$(this).hasClass("icon-share1")&&that.info_file_share(data),$(this).hasClass("icon-favorites")&&that.cancel_file_favorites(data),e.stopPropagation()})),$(".file_table_view .file_list_content").on("dblclick",".file_tr",(function(e){var index=$(this).data("index"),data=that.file_list[index];if($(e.target).hasClass("file_check")||$(e.target).parents(".foo_menu").length>0||$(e.target).hasClass("set_file_ps")||that.is_editor)return!1;if("dir"==data.type){if("Recycle_bin"==data.filename)return that.recycle_bin_view();that.reader_file_list({path:that.file_path+"/"+data.filename,is_operating:!0})}else switch(data.open_type){case"text":openEditorView(0,data.path);break;case"video":that.open_video_play(data);break;case"images":that.open_images_preview(data);break;case"compress":that.unpack_file_to_path(data)}e.stopPropagation(),e.preventDefault()})),$(".file_table_view .file_list_content").on("click",".file_title i,.file_ico_type .file_icon",(function(e){var file_tr,index=$(this).parents(".file_tr").data("index"),data=that.file_list[index];if("dir"==data.type){if("Recycle_bin"==data.filename)return that.recycle_bin_view();that.reader_file_list({path:that.file_path+"/"+data.filename,is_operating:!0})}else layer.msg("compress"==data.open_type?"Double click to unzip the file":"Double click to edit the file");e.stopPropagation(),e.preventDefault()})),$(".file_list_content").on("contextmenu",(function(ev){return"createArea"==$(ev.target).attr("name")||"rename_file_input"==$(ev.target).attr("name")})),$(".selection_right_menu").on("contextmenu",(function(ev){return!1})),$(".file_list_content").on("mousedown",".file_tr",(function(ev){if(1===ev.which&&($(ev.target).hasClass("foo_menu_title")||$(ev.target).parents().hasClass("foo_menu_title")))that.render_file_groud_menu(ev,this),$(ev.target).parent().addClass("foo_menu_click"),$(this).siblings().find(".foo_menu").removeClass("foo_menu_click"),$(this).addClass("active").siblings().removeClass("active");else{if(3!==ev.which||that.is_editor)return!0;that.file_table_arry.length>1?that.render_files_multi_menu(ev):(that.render_file_groud_menu(ev,this),$(".content_right_menu").removeAttr("style"),$(this).addClass("active").siblings().removeClass("active"))}ev.stopPropagation(),ev.preventDefault()})),$(".filePage").on("change",".showRow",(function(){var val=$(this).val();bt.set_cookie("showRow",val),that.reader_file_list({showRow:val,p:1,is_operating:!1})})),$(".filePage").on("click","div:nth-child(2) a",(function(e){var num=$(this).attr("href").match(/p=([0-9]+)$/)[1];that.reader_file_list({path:that.path,p:num}),e.stopPropagation(),e.preventDefault()})),$(".file_list_content").on("click",".folder_size",(function(e){var data=that.file_list[$(this).parents(".file_tr").data("index")],_this=this;that.get_file_size({path:data.path},(function(res){$(_this).text(bt.format_size(res.size))})),e.stopPropagation(),e.preventDefault()})),$(".filePage").on("click","#file_all_size",(function(e){if("/"===that.file_path)return layer.tips('The current directory is document root (/),calculate size will occupy<span class="bt_danger">massive server IO</span>,continue?',this,{tips:[1,"red"],time:5e3}),!1;that.get_dir_size({path:that.file_path})})),$(".file_list_content").on("mousedown",(function(ev){if($(ev.target).hasClass("file_checkbox")||$(ev.target).hasClass("file_check")||$(ev.target).hasClass("icon-share1")||$(ev.target).hasClass("icon-favorites")||"i"==ev.target.localName||$(ev.target).parents(".app_menu_group").length>0||$(ev.target).hasClass("createModel")||$(ev.target).hasClass("editr_tr")||"createArea"==$(ev.target).attr("name")||"rename_file_input"==$(ev.target).attr("name")||$(ev.target).hasClass("set_file_ps")||that.is_editor)return!0;if(3==ev.which&&!that.is_editor)return $(".selection_right_menu").removeAttr("style"),that.render_file_all_menu(ev,this),!0;$(".file_list_content").bind("mousewheel",(function(){return!1}));var container=$(this),scroll_h=0,con_t=container.offset().top,con_l=container.offset().left,startPos={top:ev.clientY-$(this).offset().top,left:ev.clientX-$(this).offset().left};$(document).unbind("mousemove").mousemove((function(ev){var endPos={top:ev.clientY-con_t>0&&ev.clientY-con_t<container.height()?ev.clientY-con_t:ev.clientY-(con_t+container.height())>1?container.height():0,left:ev.clientX-con_l>0&&ev.clientX-con_l<container.width()?ev.clientX-con_l:ev.clientX-(con_l+container.width())>1?container.width():0},fixedPoint={top:endPos.top>startPos.top?startPos.top:endPos.top,left:endPos.left>startPos.left?startPos.left:endPos.left};"list"==bt.get_cookie("rank")&&(fixedPoint.top=fixedPoint.top+40);var w=Math.min(Math.abs(endPos.left-startPos.left),con_l+container.width()-fixedPoint.left),h=Math.min(Math.abs(endPos.top-startPos.top),con_t+container.height()-fixedPoint.top);if(ev.clientY-con_t<0){var beyond_t=Math.abs(ev.clientY-con_t);container.scrollTop(container.scrollTop()-beyond_t),0!=container.scrollTop()&&(scroll_h+=beyond_t),h+=scroll_h}if(ev.clientY-(con_t+container.height())>1){var beyond_b=ev.clientY-(con_t+container.height());container.scrollTop(container.scrollTop()+beyond_b),container[0].scrollHeight-container[0].scrollTop!==container[0].clientHeight&&(scroll_h+=beyond_b),h+=scroll_h,fixedPoint.top=fixedPoint.top-scroll_h}if(startPos.top==endPos.top||startPos.left==endPos.left)return!0;that.enter_files_box().show().css({left:fixedPoint.left+"px",top:fixedPoint.top+"px",width:w+"px",height:h+"px"});var box_offset_top=that.enter_files_box().offset().top,box_offset_left=that.enter_files_box().offset().left,box_offset_w=that.enter_files_box().offset().left+that.enter_files_box().width(),box_offset_h=that.enter_files_box().offset().top+that.enter_files_box().height();$(container).find(".file_tr").each((function(i,item){var offset_top=$(item).offset().top,offset_left=$(item).offset().left,offset_h=$(item).offset().top+$(item).height(),offset_w=$(item).offset().left+$(item).width();"icon"==bt.get_cookie("rank")?offset_w>=box_offset_left&&offset_left<=box_offset_w&&offset_h>=box_offset_top&&offset_top<=box_offset_h?$(item).addClass("active"):$(item).removeClass("active"):offset_w>=box_offset_left&&offset_h>=box_offset_top&&offset_top<=box_offset_h?$(item).addClass("active"):$(item).removeClass("active")}))})),$(document).on("mouseup",(function(){var _move_array=[],box_offset_top=that.enter_files_box().offset().top,box_offset_left=that.enter_files_box().offset().left,box_offset_w=that.enter_files_box().offset().left+that.enter_files_box().width(),box_offset_h=that.enter_files_box().offset().top+that.enter_files_box().height();$(container).find(".file_tr").each((function(i,item){var offset_top=$(item).offset().top,offset_left=$(item).offset().left,offset_h=$(item).offset().top+$(item).height(),offset_w=$(item).offset().left+$(item).width();"icon"==bt.get_cookie("rank")?offset_w>=box_offset_left&&offset_left<=box_offset_w&&offset_h>=box_offset_top&&offset_top<=box_offset_h&&_move_array.push($(item).data("index")):offset_w>=box_offset_left&&offset_h>=box_offset_top&&offset_top<=box_offset_h&&_move_array.push($(item).data("index"))})),that.render_file_selected(_move_array),that.enter_files_box().remove(),$(".file_list_content").unbind("mousewheel")})),ev.stopPropagation(),ev.preventDefault()})),$(".file_list_content").on("blur",".set_file_ps",(function(ev){var tr_index=$(this).parents(".file_tr").data("index"),item=that.file_list[tr_index],nval=$(this).val(),oval=$(this).data("value"),_this=this;if(nval==oval)return!1;bt_tools.send("files/set_file_ps",{filename:item.path,ps_type:0,ps_body:nval},(function(rdata){$(_this).data("value",nval)}),{tips:"Set ps",tips:!0})})),$(".file_list_content").on("keyup",".set_file_ps",(function(ev){13==ev.keyCode&&$(this).blur(),ev.stopPropagation()})),$(".file_list_header").on("mousedown",".file_width_resize",(function(ev){return!1;var th,Minus_v,_header,maxlen})),$(".cut_view_model").on("click",(function(){var type=$(this).data("type");$(".file_table_view").addClass("icon"==type?"icon_view":"list_view").removeClass("icon"!=type?"icon_view":"list_view").scrollLeft(0),bt.set_cookie("rank",type),$(this).addClass("active").siblings().removeClass("active")})),$(".file_list_content").on("click",".set_operation_group a",(function(ev){var data=$(this).parents(".file_tr").data(),type=$(this).data("type"),item=that.file_list[data.index];if("more"==type)return!0;item.open=type,item.index=data.index,item.type_tips="file"==item.type?"File":"Directory",that.file_groud_event(item)}))},enter_files_box:function(){return 0==$("#web_mouseDrag").length&&$("<div></div>",{id:"web_mouseDrag",style:["position:absolute; top:0; left:0;","border:1px solid #072246; background-color: #cce8ff;","filter:Alpha(Opacity=15); opacity:0.15;","overflow:hidden;display:none;z-index:9;"].join("")}).appendTo(".file_table_view"),$("#web_mouseDrag")},clear_table_active:function(){this.file_table_arry=[],$(".file_list_header .file_check").removeClass("active active_2"),$(".file_list_content .file_tr").removeClass("active app_menu_operation"),$(".file_list_content .file_tr .file_ps .foo_menu").removeClass("foo_menu_click"),$(".app_menu_group").remove()},calculate_table_active:function(){var that=this,header_check=$(".file_list_header .file_check");0==this.file_table_arry.length?header_check.removeClass("active active_2").data("checkbox",0):this.file_table_arry.length==this.file_list.length?header_check.addClass("active").removeClass("active_2").data("checkbox",1):header_check.addClass("active_2").removeClass("active").data("checkbox",2),this.file_table_arry.length>0?($(document).unbind("keydown").on("keydown",(function(e){var keyCode=e.keyCode,tagName=e.target.localName.toLowerCase(),is_mac=window.navigator.userAgent.indexOf("Mac")>-1;if("input"==tagName||"textarea"==tagName)return!0;e.ctrlKey&&67==keyCode&&(1==that.file_table_arry.length?(that.file_groud_event($.extend(that.file_table_arry[0],{open:"copy"})),$(".file_all_paste").removeClass("hide")):that.file_table_arry.length>1&&that.batch_file_manage("copy")),e.ctrlKey&&88==keyCode&&(1==that.file_table_arry.length?(that.file_groud_event($.extend(that.file_table_arry[0],{open:"shear"})),$(".file_all_paste").removeClass("hide")):that.file_table_arry.length>1&&that.batch_file_manage("shear"))})),this.file_table_arry.length>1?($(".nav_group.multi").removeClass("hide"),$(".file_menu_tips").addClass("hide")):($(".nav_group.multi").addClass("hide"),$(".file_menu_tips").removeClass("hide"))):($(".nav_group.multi").addClass("hide"),$(".file_menu_tips.multi").removeClass("hide"),$(document).unbind("keydown")),$(".selection_right_menu,.file_path_input .file_dir_item .nav_down_list").removeAttr("style"),that.set_menu_line_view_resize()},set_dir_view_resize:function(){var file_path_input=$(".file_path_input"),file_dir_view=$(".file_path_input .file_dir_view"),_path_width=file_dir_view.attr("data-width"),file_item_hide=null;if(_path_width?parseInt(_path_width):(_path_width=file_dir_view.width(),file_dir_view.attr("data-width",_path_width)),file_dir_view.width()-_path_width<90){var width=0;$($(".file_path_input .file_dir_view .file_dir_item").toArray().reverse()).each((function(){var item_width=0;$(this).attr("data-width")?item_width=parseInt($(this).attr("data-width")):($(this).attr("data-width",$(this).width()),item_width=$(this).width()),width+=item_width,file_path_input.width()-width<=90?$(this).addClass("hide"):$(this).removeClass("hide")}))}var file_item_hide=file_dir_view.children(".file_dir_item.hide").clone(!0);0==file_dir_view.children(".file_dir_item.hide").length?file_path_input.removeClass("active").find(".file_dir_omit").addClass("hide"):(file_item_hide.each((function(){0==$(this).find(".glyphicon-hdd").length&&$(this).find(".file_dir").before('<span class="file_dir_icon"></span>')})),file_path_input.addClass("active").find(".file_dir_omit").removeClass("hide"),file_path_input.find(".file_dir_omit .nav_down_list").empty().append(file_item_hide),file_path_input.find(".file_dir_omit .nav_down_list .file_dir_item").removeClass("hide"))},set_menu_line_view_resize:function(){var menu_width=$(".file_nav_view").width(),disk_list_width=0,batch_list_width=0,_width=0,disk_list=$(".mount_disk_list"),batch_list=$(".nav_group.multi");disk_list.attr("data-width")||disk_list.attr("data-width",disk_list.innerWidth()),batch_list.attr("data-width")||0==batch_list.innerWidth()||-1==batch_list.innerWidth()||batch_list.attr("data-width",batch_list.innerWidth()),disk_list_width=parseInt(disk_list.attr("data-width")),batch_list_width=parseInt(batch_list.attr("data-width")),$(".file_nav_view>.nav_group").not(".mount_disk_list").each((function(){_width+=$(this).innerWidth()})),menu_width-(_width+=$(".menu-header-foot").innerWidth())<disk_list_width+5?$(".nav_group.mount_disk_list").addClass("thezoom").find(".disk_title_group_btn").removeClass("hide"):$(".nav_group.mount_disk_list,.nav_group.multi").removeClass("thezoom"),this.area[0]<1700?(indexs=Math.ceil((1700-this.area[0])/68),$(".batch_group_list>.nav_btn_group").each((function(index){index>=$(".batch_group_list>.nav_btn_group").length-(indexs+2)?$(this).hide():$(this).show()})),$(".batch_group_list>.nav_btn_group:last-child").removeClass("hide").show()):($(".batch_group_list>.nav_btn_group").css("display","inline-block"),$(".batch_group_list>.nav_btn_group:last-child").addClass("hide"))},set_file_forward:function(){var that=this,forward_path=$(".forward_path span");1==this.file_operating.length?forward_path.addClass("active"):this.file_pointer==this.file_operating.length-1?(forward_path.eq(0).removeClass("active"),forward_path.eq(1).addClass("active")):0==this.file_pointer?(forward_path.eq(0).addClass("active"),forward_path.eq(1).removeClass("active")):forward_path.removeClass("active")},set_file_view:function(){var file_list_content=$(".file_list_content"),height=this.area[1]-$(".file_table_view")[0].offsetTop-170;$(".file_bodys").height(this.area[1]-100),50*this.file_list.length>height?(file_list_content.attr("data-height",file_list_content.data("height")||file_list_content.height()).css({overflow:"hidden","overflow-y":"auto",height:height+"px"}),$(".file_shadow_bottom").css("opacity",1)):(file_list_content.css({overflow:"hidden","overflow-y":"auto",height:height+"px"}),$(".file_shadow_top,.file_shadow_bottom").css("opacity",0))},open_share_view:function(){var that=this;layer.open({type:1,shift:5,closeBtn:2,area:["850px","580px"],title:"Share list",content:'<div class="divtable mtb10 download_table" style="padding:5px 10px;"> <table class="table table-hover" id="download_url"> <thead><tr><th width="230px">Share name</th><th width="300px">Share address</th><th>Expiration date</th><th style="text-align:right;width:120px;">Opt</th></tr></thead> <tbody class="download_url_list"></tbody> </table> <div class="page download_url_page"></div> </div>',success:function(){that.render_share_list(),$(".download_url_list").on("click",".info_down",(function(){var indexs=$(this).attr("data-index");that.file_share_view(that.file_share_list[indexs],"list")})),$(".download_table .download_url_page").on("click","a",(function(e){var _href=$(this).attr("href").match(/p=([0-9]+)$/)[1];that.render_share_list({p:_href}),e.stopPropagation(),e.preventDefault()}))}})},render_share_list:function(param){var that=this,_list="";void 0===param&&(param={p:1}),bt_tools.send("files/get_download_url_list",param,(function(res){that.file_share_list=res.data,res.data.length>0?$.each(res.data,(function(index,item){_list+='<tr><td><span style="width:230px;white-space: nowrap;overflow: hidden;text-overflow: ellipsis;display: inline-block;" title="'+item.ps+'">'+item.ps+'</span></td><td><span style="width:300px;white-space: nowrap;overflow:hidden;text-overflow: ellipsis;display: inline-block;" title="'+item.filename+'">'+item.filename+"</span></td><td><span>"+bt.format_data(item.expire)+'</span></td><td style="text-align:right;"><a href="javascript:;" class="btlink info_down" data-id="'+item.id+'" data-index="'+index+'">Details</a> | <a href="javascript:;" class="btlink del_down" data-id="'+item.id+'" data-index="'+index+'" data-ps="'+item.ps+'">Close</a></td></tr>'})):_list='<tr><td colspan="4">No share data</td></tr>',$(".download_url_list").html(_list),$(".download_url_page").html(res.page),$(".download_table").on("click",".del_down",(function(){var id=$(this).attr("data-id"),_ps=$(this).attr("data-ps");that.remove_download_url({id:id,fileName:_ps},(function(res){res.status&&that.render_share_list(param),layer.msg(res.msg,{icon:res.status?1:2})}))}))}),"Share list")},remove_check_file:function(arry,key,value){for(var len=arry.length;len--;)arry[len][key]==value&&arry.splice(len,1)},open_download_view:function(){var that=this;that.reader_form_line({url:"DownloadFile",beforeSend:function(data){return{url:data.url,path:data.path,filename:data.filename}},overall:{width:"310px"},data:[{label:"URL address:",name:"url",placeholder:"URL address",value:"http://",eventType:["input","focus"],input:function(){var value,url_list=$(this).val().split("/");$('[name="filename"]').val(url_list[url_list.length-1])}},{label:"Download to:",name:"path",placeholder:"Download to",value:that.file_path},{label:"File name:",name:"filename",placeholder:"Save file name",value:"",eventType:"enter",enter:function(){$(".download_file_view .layui-layer-btn0").click()}}]},(function(form,html){var loadT=bt.open({type:1,title:"Download file",area:"500px",shadeClose:!1,skin:"download_file_view",content:html[0].outerHTML,btn:["Comfirm","Close"],success:function(){form.setEvent()},yes:function(indexo,layero){var ress=form.getVal();if(!bt.check_url(ress.url))return layer.msg("Please enter valid URL address..",{icon:2}),!1;form.submitForm((function(res){that.render_present_task_list(),layer.msg(res.msg,{icon:res.status?1:2}),loadT.close()}))}})}))},set_style_width:function(type,width){var _content=bt.get_cookie("formHeader")||$("#file_list_info").html(),_html="",_reg=new RegExp("\\.file_"+type+"\\s?\\{width\\s?\\:\\s?(\\w+)\\s\\!important;\\}","g"),_defined_config={name:150,type:80,size:80,mtime:150,accept:80,user:80,ps:150};_html=_content.replace(_reg,(function(match,$1,$2,$3){return".file_"+type+"{width:"+(width<80?_defined_config[type]+"px":width+"px")+" !important;}"})),$("#file_list_info").html(_html)},set_file_table_width:function(){var that=this,file_header_width=$(".file_table_view")[0].offsetWidth,auto_num=0,width=0,auto_all_width=0,css="",_width=0,tr_heigth=45,other="",config={};$.each(this.file_header,(function(key,item){"auto"==item?(auto_num++,config[key]=0):(width+=item,css+="."+key+"{width:"+("file_operation"!=key?item:item-16)+"px !important;}")})),this.is_mobile&&$(".file_operation.file_th").attr("style","margin-right:-10px !important;"),45*this.file_list.length>$(".file_list_content").height()?(config.file_tr=file_header_width-(this.is_mobile?0:this.scroll_width),file_header_width=file_header_width,other+=".file_td.file_operation{width:"+(this.file_header.file_operation-(this.is_mobile?0:this.scroll_width)-10)+"px !important;}",other+=".file_th.file_operation{padding-right:"+(10+(this.is_mobile?0:this.scroll_width))+"px !important}"):(file_header_width=file_header_width,config.file_tr=file_header_width,this.is_mobile&&(other+=".file_td.file_operation{width:"+(this.file_header.file_operation-20)+"px !important;}")),config.file_list_header=file_header_width,_width=(auto_all_width=file_header_width-width)/auto_num,$.each(config,(function(key,item){css+="."+key+"{width:"+(0==item?_width:item)+"px !important;}"})),$("#file_list_info").html(css+other)},render_path_list:function(callback){var that=this,html='<div class="file_dir_omit hide" title="Expand hidden directories"><span></span><i class="iconfont icon-zhixiang-zuo"></i><div class="nav_down_list"></div></div>',path_before="",dir_list=this.file_path.split("/").splice(1),first_dir=this.file_path.split("/")[0];"Windows"===bt.os?(0==dir_list.length&&(dir_list=[]),dir_list.unshift('<span class="glyphicon glyphicon-hdd"></span><span class="ml5">Local disk ('+first_dir+")</span>")):("/"==this.file_path&&(dir_list=[]),dir_list.unshift("Root dir"));for(var i=0;i<dir_list.length;i++)path_before+="/"+dir_list[i],0==i&&(path_before="/"),html+='<div class="file_dir_item"> <span class="file_dir" title="'+path_before.replace("//","/")+'">'+dir_list[i]+'</span> <i class="iconfont icon-arrow-right"></i> <ul class="nav_down_list"> <li data-path="*"><span>Loading</span></li> </ul> </div>';$(".path_input").val("").attr("data-path",this.file_path);var file_dir_view=$(".file_path_input .file_dir_view");file_dir_view.html(html),file_dir_view.attr("data-width",file_dir_view.width()),this.set_dir_view_resize.delay(this,100)},render_path_down_list:function(el,path,callback){var that=this,_html="",next_path=$(el).parent().next().find(".file_dir").attr("title");this.get_dir_list({path:path},(function(res){$.each(that.data_reconstruction(res.DIR),(function(index,item){var _path=("/"!=path?path:"")+"/"+item.filename;_html+='<li data-path="'+_path+'" title="'+_path+'" class="'+(_path===next_path?"active":"")+'"><i class="file_menu_icon newly_file_icon"></i><span>'+item.filename+"</span></li>"})),$(el).html(_html)}))},reader_file_list:function(data,callback){var that=this,select_page_num="",next_path="",model=bt.get_cookie("rank"),isPaste=bt.get_cookie("record_paste_type");"null"!=isPaste&&null!=isPaste?$(".file_nav_view .file_all_paste").removeClass("hide"):$(".file_nav_view .file_all_paste").addClass("hide"),$(".file_table_view").removeClass(".list_view,.icon_view").addClass("list"==model?"list_view":"icon_view"),$(".cut_view_model:nth-child("+("list"==model?"2":"1")+")").addClass("active").siblings().removeClass("active"),this.file_images_list=[],this.get_dir_list(data,(function(res){if(!1===res.status&&res.msg.indexOf("The specified directory does not exist!")>-1)return that.reader_file_list({path:"/www"});that.file_path=that.path_check(res.PATH),that.file_list=$.merge(that.data_reconstruction(res.DIR,"DIR"),that.data_reconstruction(res.FILES)),that.is_recycle=res.FILE_RECYCLE,that.file_store_list=res.STORE,bt.set_cookie("Path",that.path_check(res.PATH)),that.reader_file_list_content(that.file_list,(function(rdata){$(".path_input").attr("data-path",that.file_path),$(".file_nav_view .multi").addClass("hide"),$(".selection_right_menu").removeAttr("style"),$.each(["100","200","500","1000","2000"],(function(index,item){select_page_num+='<option value="'+item+'" '+(item==(bt.get_storage("local","showRow")||that.file_page_num)?"selected":"")+">"+item+"</option>"}));var page=$(res.PAGE);page.append('<span class="Pcount-item">per page<select class="showRow">'+select_page_num+"</select>item(s)</span>"),$(".filePage").html('<div class="page_num">Total '+rdata.is_dir_num+" directory, "+(that.file_list.length-rdata.is_dir_num)+'file(s), size:<a href="javascript:;" class="btlink" id="file_all_size">Click to calculate</a></div>'+page[0].outerHTML),data.is_operating&&that.file_operating[that.file_pointer]!=res.PATH&&(void 0!==(next_path=that.file_operating[that.file_pointer+1])&&next_path!=res.PATH&&that.file_operating.splice(that.file_pointer+1),that.file_operating.push(res.PATH),that.file_pointer=that.file_operating.length-1),that.render_path_list(),that.set_file_forward(),that.render_favorites_list(),that.set_file_view(),that.set_file_table_width(),callback&&callback(res)}))}))},data_reconstruction:function(data,type,callback){var that=this,arry=[],info_ps=[["/etc","PS: System files directory"],["/home","PS: Home directory"],["/tmp","PS: Common temporary files directory"],["/root","PS: Main directory of system admin"],["/usr","PS: System application directory"],["/boot","PS: System run directory"],["/lib","PS: System source file directory"],["/mnt","PS: Store temporary mapped file system"],["/www","PS: Aapanel program directory"],["/bin","PS: Store binary executable file directory"],["/dev","PS: Storage device file directory"],["/www/wwwlogs","PS: Default site logs directory"],["/www/server","PS: Aapanel soft installed directory"],["/www/wwwlogs","PS: Site logs directory"],["/www/Recycle_bin",lan.files.recycle_bin_dir],["/www/server/panel","PS: Aapanel main program directory, do not move"],["/www/server/panel/plugin","PS: Aapanel plugin directory"],["/www/server/panel/BTPanel","PS: Aapanel directory"],["/www/server/panel/BTPanel/static","PS: Aapanel static directory"],["/www/server/panel/BTPanel/templates","PS: Aapanel templates directory"],[bt.get_cookie("backup_path"),"PS: Default backup directory"],[bt.get_cookie("sites_path"),"PS: Default site directory"]];return data.length<1?[]:($.each(data,(function(index,item){var itemD=item.split(";"),fileMsg="",fileN=itemD[0].split("."),extName=fileN[fileN.length-1];switch(itemD[0]){case".user.ini":fileMsg=lan.files.php_profile;break;case".htaccess":fileMsg=lan.files.apache_profile;break;case"swap":fileMsg=lan.files.swap_file}-1!=itemD[0].indexOf("Recycle_bin")&&(fileMsg=lan.files.swap_file),-1!=itemD[0].indexOf(".upload.tmp")&&(fileMsg=lan.files.recycle_bin_dir);for(var i=0;i<info_ps.length;i++)that.path_resolve(that.file_path,itemD[0])===info_ps[i][0]&&(fileMsg=info_ps[i][1]);arry.push({caret:"1"==itemD[8],down_id:parseInt(itemD[9]),ext:"DIR"==type?"":extName.toLowerCase(),filename:itemD[0],mtime:itemD[2],ps:fileMsg||itemD[10]||"",is_os_ps:""!=fileMsg,size:itemD[1],type:"DIR"==type?"dir":"file",user:itemD[3],root_level:itemD[4],soft_link:itemD[5]||""})})),arry)},render_file_selected:function(_array){$(document).unbind("mouseup").unbind("mousemove");var that=this,tmp=[];that.clear_table_active(),$.each(_array,(function(index,item){-1==tmp.indexOf(item)&&tmp.push(item)})),$.each(tmp,(function(ind,items){$(".file_list_content .file_tr").eq(items).addClass("active"),that.file_table_arry.push(that.file_list[items])})),that.calculate_table_active()},render_favorites_list:function(){var html="";this.file_store_list.length>0?($.each(this.file_store_list,(function(index,item){html+='<li title="'+item.name+'" data-path="'+item.path+'" data-type="'+item.type+'"><i class="'+("file"==item.type?"file_new_icon":"file_menu_icon create_file_icon")+'"></i><span>'+item.name+"</span></li>"})),html+='<li data-manage="favorites" onclick="bt_file.set_favorites_manage()"><span class="iconfont icon-shezhi1"></span><span>Management</span></li>'):html='<li data-null style="width: 150px;"><i></i><span>(Empty)</span></li>',$(".favorites_file_path .nav_down_list").html(html)},set_favorites_manage:function(){var that=this;layer.open({type:1,title:"Manage Favorites",area:["850px","580px"],closeBtn:2,shift:5,shadeClose:!1,content:"<div class='stroe_tab_list bt-table pd15'> <div class='divtable' style='height:420px'> <table class='table table-hover'> <thead><tr><th>Path</th><th style='text-align:right'>Opt</th></tr></thead> <tbody class='favorites_body'></tbody> </table></div></div>",success:function(layers){that.render_favorites_type_list(),setTimeout((function(){$(layers).css("top",($(window).height()-$(layers).height())/2)}),50)},cancel:function(){that.reader_file_list({path:that.file_path})}})},render_favorites_type_list:function(){var _detail="";this.$http("get_files_store",(function(rdata){rdata.length>0?$.each(rdata,(function(ind,item){_detail+='<tr><td><span class="favorites_span" title="'+item.path+'">'+item.path+'</span></td><td style="text-align:right;"><a class="btlink" onclick="bt_file.del_favorites(\''+item.path+"')\">Del</a></td></tr>"})):_detail='<tr><td colspan="2">No favorites</td></tr>',$(".favorites_body").html(_detail),jQuery.prototype.fixedThead?$(".stroe_tab_list .divtable").fixedThead({resize:!1}):$(".stroe_tab_list .divtable").css({overflow:"auto"})}))},load_favorites_index_list:function(){var that=this;this.$http("get_files_store",(function(rdata){that.file_store_list=rdata,that.render_favorites_list()}))},del_favorites:function(path){var that=this;layer.confirm("Comfirm delete path【"+path+"】?",{title:"Delete favorites",closeBtn:2,icon:3},(function(index){that.$http("del_files_store",{path:path},(function(res){res.status&&that.render_favorites_type_list(),layer.msg(res.msg,{icon:res.status?1:2})}))}))},reader_file_list_content:function(data,callback){var _html="",that=this,is_dir_num=0,images_num=0;$.each(data,(function(index,item){var _title=item.filename,only_id=bt.get_random(10),path=(that.file_path+"/"+item.filename).replace("//","/"),is_compress=that.determine_file_type(item.ext,"compress"),is_editor_tips=function(){var _openTitle="open";switch(that.determine_file_type(item.ext)){case"images":_openTitle="Preview";break;case"video":_openTitle="Play";break;default:_openTitle="compress"==that.determine_file_type(item.ext)?"":"Edit"}return"dir"==item.type&&(_openTitle="Open"),_openTitle}(item);that.file_list[index].only_id=only_id,_html+='<div class="file_tr" data-index="'+index+'" data-filename="'+item.filename+'" '+("icon"==bt.get_cookie("rank")?'title="'+path+" "+lan.files.file_size+":"+bt.format_size(item.size)+" "+lan.files.file_etime+":"+bt.format_data(item.mtime)+" "+lan.files.file_auth+":"+item.user+" "+lan.files.file_own+":"+item.root_level+'"':"")+'><div class="file_td file_checkbox"><div class="file_check"></div></div><div class="file_td file_name"><div class="file_ico_type"><i class="file_icon '+("dir"==item.type?"file_folder":(""==item.ext?"":"file_"+item.ext).replace("//","/"))+'"></i></div><span class="file_title file_'+item.type+'_status" '+("icon"==bt.get_cookie("rank")?"":'title="'+path+'"')+"><i>"+item.filename+item.soft_link+"</i></span>"+(item.caret?'<span class="iconfont icon-favorites" style="'+(0!=item.down_id?"right:30px":"")+'" title="'+lan.files.file_has_been_favorite+'"></span>':"")+(0!=item.down_id?'<span class="iconfont icon-share1" title="'+lan.files.file_has_been_shared+'"></span>':"")+'</div><div class="file_td file_type hide"><span title="'+("dir"==item.type?"directory":that.ext_type_tips(item.ext))+'">'+("dir"==item.type?"directory":that.ext_type_tips(item.ext))+'</span></div><div class="file_td file_accept"><span>'+item.user+" / "+item.root_level+'</span></div><div class="file_td file_size"><span>'+("dir"==item.type?'<a class="btlink folder_size" href="javascript:;" data-path="'+path+'">Calculate</a>':bt.format_size(item.size))+'</span></div><div class="file_td file_mtime"><span>'+bt.format_data(item.mtime)+'</span></div><div class="file_td file_ps"><span class="file_ps_title" title="'+item.ps+'">'+(item.is_os_ps?item.ps:'<input type="text" class="set_file_ps" data-value="'+item.ps+'" value="'+item.ps+'" />')+'</span></div><div class="file_td file_operation"><div class="set_operation_group '+(that.is_mobile?"is_mobile":"")+'"><a href="javascript:;" class="btlink" data-type="open">'+is_editor_tips+'</a> | <a href="javscript:;" class="btlink" data-type="copy">Copy</a> | <a href="javscript:;" class="btlink" data-type="shear">Cut</a> | <a href="javscript:;" class="btlink" data-type="rename">Rename</a> | <a href="javscript:;" class="btlink" data-type="authority">PMSN</a> | <a href="javascript:;" class="btlink" data-type="'+(is_compress?"unzip":"compress")+'">'+(is_compress?"Unzip":"Zip")+'</a> | <a href="javscript:;" class="btlink" data-type="del">Del</a> | <a href="javscript:;" class="btlink foo_menu_title" data-type="more">More<i></i></a></div></div></div>',"dir"==item.type&&is_dir_num++,item.path=path,item.open_type=that.determine_file_type(item.ext),"images"==item.open_type&&(item.images_id=images_num,that.file_images_list.push(item.path),images_num++)})),$(".file_list_content").html(_html),callback&&callback({is_dir_num:is_dir_num}),that.clear_table_active()},render_file_disk_list:function(){var that=this,html="",_li="";that.get_disk_list((function(res){$.each(res,(function(index,item){html+='<div class="nav_btn" data-menu="'+item.path+'"><span class="glyphicon glyphicon-hdd"></span><span>'+("/"==item.path?"Root dir":item.path)+" ("+item.size[2]+")</span></div>",_li+='<li data-disk="'+item.path+'"><i class="glyphicon glyphicon-hdd"></i><span>'+("/"==item.path?"Root dir":item.path)+" ("+item.size[2]+")</span></li>"})),$(".mount_disk_list").html('<div class="disk_title_group_btn hide"><span class="disk_title_group">'+lan.files.mounted_disk+'</span><i class="iconfont icon-xiala"></i><ul class="nav_down_list">'+_li+'</ul></div><div class="file_disk_list">'+html+"</div>"),that.set_menu_line_view_resize()}))},render_file_groud_menu:function(ev,el){var that=this,index=$(el).data("index"),_openTitle="Open",data=this.file_list[index],compression=["zip","rar","gz","war","tgz","bz2"],offsetNum=0,config={open:_openTitle,split_0:!0,download:"Download",share:"Share file",cancel_share:"Cancel share",favorites:"Favorites file",cancel_favorites:"Cancel favorites",split_1:!0,authority:"Permission",split_2:!0,copy:"Copy",shear:"Cut",rename:"Rename",del:"Delete",split_3:!0,compress:"Compress",unzip:"Unzip",open_find_dir:"Open file location",split_4:!0,property:"Properties"};switch(this.determine_file_type(data.ext)){case"images":_openTitle="Preview";break;case"video":_openTitle="Play";break;default:_openTitle="Edit"}config.open="dir"==data.type?"Open":_openTitle,"dir"===data.type&&delete config.download,"compress"==data.open_type&&delete config.open,0!=data.down_id?delete config.share:(delete config.cancel_share,config.share="dir"==data.type?"Share dir":"Share file"),!1!==data.caret?delete config.favorites:(delete config.cancel_favorites,config.favorites="dir"==data.type?"Favorites dir":"Favorites file"),"php"==data.ext&&(config.dir_kill="文件查杀"),"php"!=data.ext&&"dir"!=data.type&&delete config.dir_kill;var num=0;$.each(compression,(function(index,item){item==data.ext&&num++})),0==num&&delete config.unzip,data.is_search?config.open_find_dir="dir"==data.type?"Open dir":"Open file location":delete config.open_find_dir,this.file_selection_operating=config,this.reader_menu_list({el:$(".selection_right_menu"),ev:ev,data:data,list:config})},render_file_all_menu:function(ev,el){var that=this,config={refresh:"Refresh",split_0:!0,upload:"Upload",create:["New file/folder",{create_dir:"New folder",create_files:"New file",soft_link:"Softlink"}],web_shell:"Terminal",split_1:!0,paste:"Paste"},offsetNum=0,isPaste=bt.get_cookie("record_paste_type");"null"!=isPaste&&null!=isPaste||(delete config.split_1,delete config.paste),this.reader_menu_list({el:$(".selection_right_menu"),ev:ev,data:{},list:config})},render_files_multi_menu:function(ev){var that=this,config_group=[["copy","Copy"],["shear","cut"],["authority","Permission"],["compress","Compress"],["del","Delete"]],el=$(".selection_right_menu").find("ul"),el_height=el.height(),el_width=el.width(),left=ev.clientX-(this.area[0]-ev.clientX<el_width?el_width:0);el.empty(),$.each(config_group,(function(index,mitem){var $children=null,type;"split"==mitem[0]?el.append('<li class="separate"></li>'):el.append($('<li><i class="file_menu_icon '+mitem[0]+"_file_icon "+(type=mitem[0],"authority"==type?"iconfont icon-authority":"")+'"></i><span>'+mitem[1]+"</span></li>").append(null).on("click",{type:mitem[0],data:that.file_table_arry},(function(ev){$(".selection_right_menu").removeAttr("style"),that.batch_file_manage(ev.data.type),ev.stopPropagation(),ev.preventDefault()})))})),$(".selection_right_menu").css({left:left,top:ev.clientY-(this.area[1]-ev.clientY<el_height?el_height:0)}).removeClass("left_menu right_menu").addClass(this.area[0]-(left+el_width)<230?"left_menu":"right_menu"),$(document).one("click",(function(e){$(ev.currentTarget).removeClass("selected"),$(".selection_right_menu").removeAttr("style"),e.stopPropagation(),e.preventDefault()}))},reader_menu_list:function(config){var that=this,el=config.el.find("ul"),el_height=0,el_width=el.width(),left=config.ev.clientX-(this.area[0]-config.ev.clientX<el_width?el_width:0),top=0;el.empty(),$.each(config.list,(function(key,item){var $children=null,$children_list=null;"boolean"==typeof item?el.append('<li class="separate"></li>'):(Array.isArray(item)&&($children=$('<div class="file_menu_down"><span class="glyphicon glyphicon-triangle-right" aria-hidden="true"></span><ul class="set_group"></ul></div>'),$children_list=$children.find(".set_group"),$.each(item[1],(function(keys,items){$children_list.append($('<li><i class="file_menu_icon '+keys+'_file_icon"></i><span>'+items+"</span></li>").on("click",{type:keys,data:config.data},(function(ev){that.file_groud_event($.extend(ev.data.data,{open:ev.data.type,index:parseInt($(config.ev.currentTarget).data("index")),element:config.ev.currentTarget,type_tips:"dir"==config.data.type?"folder":"file"})),config.el.removeAttr("style"),ev.stopPropagation(),ev.preventDefault()})))}))),el.append($('<li><i class="file_menu_icon '+key+"_file_icon "+function(type){switch(type){case"share":case"cancel_share":return"iconfont icon-share1";case"dir_kill":return"iconfont icon-dir_kill";case"authority":return"iconfont icon-authority"}return""}(key)+'"></i><span>'+(Array.isArray(item)?item[0]:item)+"</span></li>").append($children).on("click",{type:key,data:config.data},(function(ev){that.file_groud_event($.extend(ev.data.data,{open:ev.data.type,index:parseInt($(config.ev.currentTarget).data("index")),element:config.ev.currentTarget,type_tips:"dir"==config.data.type?"folder":"file"})),"compress"!=key&&"create"!=key&&config.el.removeAttr("style"),ev.stopPropagation(),ev.preventDefault()}))))})),el_height=el.innerHeight(),top=config.ev.clientY-(this.area[1]-config.ev.clientY<el_height?el_height:0);var element=$(config.ev.target);(element.hasClass("foo_menu_title")||element.parents().hasClass("foo_menu_title"))&&(left=config.ev.clientX-el_width,top=this.area[1]-config.ev.clientY<el_height?config.ev.clientY-el_height-20:config.ev.clientY+15),config.el.css({left:left+10,top:top}).removeClass("left_menu right_menu").addClass(this.area[0]-(left+el_width)<230?"left_menu":"right_menu")},ext_type_tips:function(ext){var config={ai:"Adobe Illustrator format",apk:"Android package",asp:"Dynamic web file",bat:"Shell File",bin:"Bin File",bas:"BASIC File",bak:"Backup File",css:"CSS",cad:"备份文件",cxx:"C++",crt:"Certificate file",cpp:"C++ File",conf:"Configuration file",dat:"",der:"Certification file",doc:"Microsoft Office Word 97-2003",docx:"Microsoft Office Word 2007",exe:"",gif:"Graphic file",go:"Golang source files",htm:"Hypertext document",html:"Hypertext document",ico:"",java:"Java source files",access:"Database file",jsp:"HTML Page",jpe:"Graphic file",jpeg:"Graphic file",jpg:"Graphic file",log:"Log file",link:"Shortcut file",js:"Javascript source files",mdb:"Microsoft Access database",mp3:"Audio file",ape:"CloudMusic.ape",mp4:"Video",avi:"Video",mkv:"Video",rm:"Video",mov:"Video",mpeg:"Video",mpg:"Video",rmvb:"Video",webm:"Video",wma:"Video",wmv:"Video",swf:"Shockwave Flash Object",mng:"Multi-image network graphics",msi:"Windows package",png:"Graphic file",py:"Python source file",pyc:"Python Bytecode file",pdf:"pdf",ppt:"Microsoft Powerpoint 97-2003",pptx:"Microsoft Powerpoint2007",psd:"Adobe photoshop",pl:"Perl Scripting language",rar:"RAR compressed package",reg:"Registry file",sys:"System Files",sql:"Database file",sh:"Shell script file",txt:"text format",vb:"Visual Basic",xml:"",xls:"Microsoft Office Excel 97-2003",xlsx:"Microsoft Office Excel 2007",gz:"Compressed file",zip:"ZIP compressed file",z:"","7z":"7Z Compressed file",json:"JSON",php:"PHP",mht:"MHTML",bmp:"BMP",webp:"WEBP",cdr:"CDR"};return void 0!==config[ext]?config[ext]:"Unknown file"},determine_file_type:function(ext,type){var config={images:["jpg","jpeg","png","bmp","gif","tiff","ico","JPG","webp"],compress:["zip","rar","gz","war","tgz"],video:["mp4","mp3","mpeg","mpg","mov","avi","webm","mkv","mkv","mp3","rmvb","wma","wmv"],ont_text:["iso","xlsx","xls","doc","docx","tiff","exe","so","7z","bz","dmg","apk","pptx","ppt","xlsb","pdf"]},returnVal=!1;if(null!=type)if("text"==type)$.each(config,(function(key,item){$.each(item,(function(index,items){if(items==ext)return returnVal=!0,!1}))})),returnVal=!returnVal;else{if(void 0===config[type])return!1;$.each(config[type],(function(key,item){if(item==ext)return returnVal=!0,!1}))}else $.each(config,(function(key,item){$.each(item,(function(index,items){if(items==ext)return returnVal=key,!1}))})),"boolean"==typeof returnVal&&(returnVal="text");return returnVal},file_groud_event:function(data){var that=this;switch(data.open){case"open":if("dir"==data.type)this.reader_file_list({path:data.path});else switch(data.open_type){case"text":openEditorView(0,data.path);break;case"video":this.open_video_play(data);break;case"images":this.open_images_preview(data)}break;case"download":this.down_file_req(data);break;case"share":this.set_file_share(data);break;case"cancel_share":this.info_file_share(data);break;case"favorites":this.$http("add_files_store",{path:data.path},(function(res){res.status&&(that.file_list[data.index]=$.extend(that.file_list[data.index],{caret:!0}),that.reader_file_list_content(that.file_list),that.load_favorites_index_list()),layer.msg(res.msg,{icon:res.status?1:2})}));break;case"cancel_favorites":this.cancel_file_favorites(data);break;case"authority":this.set_file_authority(data);break;case"dir_kill":this.set_dir_kill(data);break;case"copy":this.copy_file_or_dir(data);break;case"shear":this.cut_file_or_dir(data);break;case"rename":this.rename_file_or_dir(data);break;case"compress":data.open="tar_gz",this.compress_file_or_dir(data);break;case"tar_gz":case"rar":case"zip":this.compress_file_or_dir(data);break;case"unzip":case"folad":this.unpack_file_to_path(data);break;case"refresh":$(".file_path_refresh").click();break;case"upload":this.file_drop.dialog_view();break;case"soft_link":this.set_soft_link();break;case"create_dir":$(".file_nav_view .create_file_or_dir li").eq(0).click();break;case"create_files":$(".file_nav_view .create_file_or_dir li").eq(1).click();break;case"del":this.del_file_or_dir(data);break;case"paste":this.paste_file_or_dir();break;case"web_shell":web_shell();break;case"open_find_dir":this.reader_file_list({path:this.retrun_prev_path(data.path)});break;case"property":this.open_property_view(data)}},batch_file_manage:function(stype){var that=this,_api="",_fname=[],_obj={},_path=$("");switch($.each(this.file_table_arry,(function(index,item){_fname.push(item.filename)})),stype){case"copy":case"shear":_api="SetBatchData",_obj.data=JSON.stringify(_fname),_obj.type="copy"==stype?"1":"2",_obj.path=that.file_path;break;case"del":return _obj.data=JSON.stringify(_fname),_obj.type="4",_obj.path=that.file_path,that.batch_file_delect(_obj);case"authority":return _obj.filename="批量",_obj.type="3",_obj.filelist=JSON.stringify(_fname),_obj.path=that.file_path,that.set_file_authority(_obj,!0);case"compress":var arry_f=that.file_path.split("/"),file_title=arry_f[arry_f.length-1];return _obj.filename=_fname.join(","),_obj.open="tar_gz",_obj.path=that.file_path+"/"+file_title,that.compress_file_or_dir(_obj,!0)}that.$http(_api,_obj,(function(res){res.status&&(bt.set_cookie("record_paste_type","copy"==stype?"1":"2"),that.clear_table_active(),$(".nav_group.multi").addClass("hide"),$(".file_menu_tips").removeClass("hide"),$(".file_nav_view .file_all_paste").removeClass("hide")),layer.msg(res.msg,{icon:res.status?1:2})}))},batch_file_delect:function(obj){var that=this;this.is_recycle?layer.confirm(lan.files.del_to_recycle_bin,{title:lan.files.del_in_bulk,closeBtn:2,icon:3},(function(){that.$http("SetBatchData",obj,(function(res){res.status&&that.reader_file_list({path:that.file_path}),layer.msg(res.msg,{icon:res.status?1:2})}))})):bt.show_confirm(lan.files.del_in_bulk,'<span><i style="font-size: 15px;font-style: initial;color: red;">'+lan.files.recycle_bin_warning+"</i></span>",(function(){that.$http("SetBatchData",obj,(function(res){res.status&&that.reader_file_list({path:that.file_path}),layer.msg(res.msg,{icon:res.status?1:2})}))}))},batch_file_paste:function(){var that=this,_pCookie=bt.get_cookie("record_paste_type");this.check_exists_files_req({dfile:this.file_path},(function(result){if(result.length>0){for(var tbody="",i=0;i<result.length;i++)tbody+='<tr><td><span class="exists_files_style">'+result[i].filename+"</td><td>"+ToSize(result[i].size)+"</td><td>"+getLocalTime(result[i].mtime)+"</td></tr>";var mbody;SafeMessage("The following files will be overwritten",'<div class="divtable" style="max-height:350px;overflow:auto;"><table class="table table-hover" width="100%" border="0" cellpadding="0" cellspacing="0"><thead><th>File name</th><th>Size</th><th>Last edit time</th></thead> <tbody>'+tbody+"</tbody> </table></div>",(function(){that.$http("BatchPaste",{type:_pCookie,path:that.file_path},(function(rdata){rdata.status&&(bt.set_cookie("record_paste_type",null),that.reader_file_list({path:that.file_path})),layer.msg(rdata.msg,{icon:rdata.status?1:2})}))}))}else that.$http("BatchPaste",{type:_pCookie,path:that.file_path},(function(rdata){rdata.status&&(bt.set_cookie("record_paste_type",null),that.reader_file_list({path:that.file_path})),layer.msg(rdata.msg,{icon:rdata.status?1:2})}))}))},recycle_bin_view:function(){var that=this;layer.open({type:1,shift:5,closeBtn:2,area:["80%","606px"],title:lan.files.recycle_bin_title,content:'<div class="recycle_bin_view"> <div class="re-head"> <div style="margin-left: 3px;" class="ss-text"> <em>'+lan.files.recycle_bin_on+'</em> <div class="ssh-item"> <input class="btswitch btswitch-ios" id="Set_Recycle_bin" type="checkbox"> <label class="btswitch-btn" for="Set_Recycle_bin" onclick="bt_file.Set_Recycle_bin()"></label> </div> <em style="margin-left: 20px;">'+lan.files.recycle_bin_on_db+'</em> <div class="ssh-item"> <input class="btswitch btswitch-ios" id="Set_Recycle_bin_db" type="checkbox"> <label class="btswitch-btn" for="Set_Recycle_bin_db" onclick="bt_file.Set_Recycle_bin(1)"></label> </div> </div> <span style="line-height: 32px; margin-left: 30px;">'+lan.files.recycle_bin_ps+'</span> <button style="float: right" class="btn btn-default btn-sm" onclick="bt_file.CloseRecycleBin();">'+lan.files.recycle_bin_close+'</button> </div> <div class="re-con"> <div class="re-con-menu"> <p class="on" data-type="1">'+lan.files.recycle_bin_type1+'</p> <p data-type="2">'+lan.files.recycle_bin_type2+'</p> <p data-type="3">'+lan.files.recycle_bin_type3+'</p> <p data-type="4">'+lan.files.recycle_bin_type4+'</p> <p data-type="5">'+lan.files.recycle_bin_type5+'</p> <p data-type="6">'+lan.files.recycle_bin_type6+'</p> </div> <div class="re-con-con"> <div style="margin: 15px;" class="divtable"> <table width="100%" class="table table-hover"> <thead> <tr> <th>'+lan.files.recycle_bin_th1+"</th> <th>"+lan.files.recycle_bin_th2+"</th> <th>"+lan.files.recycle_bin_th3+'</th> <th width="150">'+lan.files.recycle_bin_th4+'</th> <th style="text-align: right;" width="110">'+lan.files.recycle_bin_th5+'</th> </tr> </thead> <tbody id="RecycleBody" class="list-list"></tbody> </table> </div> </div> </div> </div>',success:function(){-1!=window.location.href.indexOf("database")?($(".re-con-menu p:last-child").addClass("on").siblings().removeClass("on"),that.render_recycle_list(6)):that.render_recycle_list(1),$(".re-con-menu").on("click","p",(function(){var _type=$(this).data("type");$(this).addClass("on").siblings().removeClass("on"),that.render_recycle_list(_type)}))}})},render_recycle_list:function(num){var that=this;this.$http("Get_Recycle_bin",(function(rdata){var body="";switch($("#Set_Recycle_bin").attr("checked",rdata.status),$("#Set_Recycle_bin_db").attr("checked",rdata.status_db),num){case 1:for(var i=0;i<rdata.dirs.length;i++){var shortwebname=rdata.dirs[i].name.replace(/'/,"\\'"),shortpath=rdata.dirs[i].dname;shortwebname.length>20&&(shortwebname=shortwebname.substring(0,20)+"..."),shortpath.length>20&&(shortpath=shortpath.substring(0,20)+"..."),body+='<tr> <td><span class=\'ico ico-folder\'></span><span class="tname" title="'+rdata.dirs[i].name+'">'+shortwebname+'</span></td> <td><span title="'+rdata.dirs[i].dname+'">'+shortpath+"</span></td> <td>"+ToSize(rdata.dirs[i].size)+"</td> <td>"+getLocalTime(rdata.dirs[i].time)+'</td> <td style="text-align: right;"> <a class="btlink" href="javascript:;" onclick="bt_file.ReRecycleBin(\''+rdata.dirs[i].rname.replace(/'/,"\\'")+"',this)\">"+lan.files.recycle_bin_re+'</a> | <a class="btlink" href="javascript:;" onclick="bt_file.DelRecycleBin(\''+rdata.dirs[i].rname.replace(/'/,"\\'")+"',this)\">"+lan.files.recycle_bin_del+"</a> </td> </tr>"}for(var i=0;i<rdata.files.length;i++)if(-1==rdata.files[i].name.indexOf("BTDB_")){var shortwebname=rdata.files[i].name.replace(/'/,"\\'"),shortpath=rdata.files[i].dname;shortwebname.length>20&&(shortwebname=shortwebname.substring(0,20)+"..."),shortpath.length>20&&(shortpath=shortpath.substring(0,20)+"..."),body+='<tr> <td><span class="ico ico-'+that.get_ext_name(rdata.files[i].name)+'"></span><span class="tname" title="'+rdata.files[i].name+'">'+shortwebname+'</span></td> <td><span title="'+rdata.files[i].dname+'">'+shortpath+"</span></td> <td>"+ToSize(rdata.files[i].size)+"</td> <td>"+getLocalTime(rdata.files[i].time)+'</td> <td style="text-align: right;"> <a class="btlink" href="javascript:;" onclick="bt_file.ReRecycleBin(\''+rdata.files[i].rname.replace(/'/,"\\'")+"',this)\">"+lan.files.recycle_bin_re+'</a> | <a class="btlink" href="javascript:;" onclick="bt_file.DelRecycleBin(\''+rdata.files[i].rname.replace(/'/,"\\'")+"',this)\">"+lan.files.recycle_bin_del+"</a> </td> </tr>"}else{var shortwebname=rdata.files[i].name.replace(/'/,"\\'"),shortpath=rdata.files[i].dname;shortwebname.length>20&&(shortwebname=shortwebname.substring(0,20)+"..."),shortpath.length>20&&(shortpath=shortpath.substring(0,20)+"..."),body+='<tr> <td><span class="ico ico-'+that.get_ext_name(rdata.files[i].name)+'"></span><span class="tname" title="'+rdata.files[i].name+'">'+shortwebname.replace("BTDB_","")+'</span></td> <td><span title="'+rdata.files[i].dname+'">mysql://'+shortpath.replace("BTDB_","")+"</span></td> <td>-</td> <td>"+getLocalTime(rdata.files[i].time)+'</td> <td style="text-align: right;"> <a class="btlink" href="javascript:;" onclick="bt_file.ReRecycleBin(\''+rdata.files[i].rname.replace(/'/,"\\'")+"',this)\">"+lan.files.recycle_bin_re+'</a> | <a class="btlink" href="javascript:;" onclick="bt_file.DelRecycleBin(\''+rdata.files[i].rname.replace(/'/,"\\'")+"',this)\">"+lan.files.recycle_bin_del+"</a> </td> </tr>"}return void $("#RecycleBody").html(body);case 2:for(var i=0;i<rdata.dirs.length;i++){var shortwebname=rdata.dirs[i].name.replace(/'/,"\\'"),shortpath=rdata.dirs[i].dname;shortwebname.length>20&&(shortwebname=shortwebname.substring(0,20)+"..."),shortpath.length>20&&(shortpath=shortpath.substring(0,20)+"..."),body+='<tr> <td><span class=\'ico ico-folder\'></span><span class="tname" title="'+rdata.dirs[i].name+'">'+shortwebname+'</span></td> <td><span title="'+rdata.dirs[i].dname+'">'+shortpath+"</span></td> <td>"+ToSize(rdata.dirs[i].size)+"</td> <td>"+getLocalTime(rdata.dirs[i].time)+'</td> <td style="text-align: right;"> <a class="btlink" href="javascript:;" onclick="bt_file.ReRecycleBin(\''+rdata.dirs[i].rname.replace(/'/,"\\'")+"',this)\">"+lan.files.recycle_bin_re+'</a> | <a class="btlink" href="javascript:;" onclick="bt_file.DelRecycleBin(\''+rdata.dirs[i].rname.replace(/'/,"\\'")+"',this)\">"+lan.files.recycle_bin_del+"</a> </td> </tr>"}return void $("#RecycleBody").html(body);case 3:for(var i=0;i<rdata.files.length;i++)if(-1==rdata.files[i].name.indexOf("BTDB_")){var shortwebname=rdata.files[i].name.replace(/'/,"\\'"),shortpath=rdata.files[i].dname;shortwebname.length>20&&(shortwebname=shortwebname.substring(0,20)+"..."),shortpath.length>20&&(shortpath=shortpath.substring(0,20)+"..."),body+='<tr> <td><span class="ico ico-'+that.get_ext_name(rdata.files[i].name)+'"></span><span class="tname" title="'+rdata.files[i].name+'">'+shortwebname+'</span></td> <td><span title="'+rdata.files[i].dname+'">'+shortpath+"</span></td> <td>"+ToSize(rdata.files[i].size)+"</td> <td>"+getLocalTime(rdata.files[i].time)+'</td> <td style="text-align: right;"> <a class="btlink" href="javascript:;" onclick="bt_file.ReRecycleBin(\''+rdata.files[i].rname.replace(/'/,"\\'")+"',this)\">"+lan.files.recycle_bin_re+'</a> | <a class="btlink" href="javascript:;" onclick="bt_file.DelRecycleBin(\''+rdata.files[i].rname.replace(/'/,"\\'")+"',this)\">"+lan.files.recycle_bin_del+"</a> </td> </tr>"}return void $("#RecycleBody").html(body);case 4:for(var i=0;i<rdata.files.length;i++)if(ReisImage(getFileName(rdata.files[i].name))){var shortwebname=rdata.files[i].name.replace(/'/,"\\'"),shortpath=rdata.files[i].dname;shortwebname.length>20&&(shortwebname=shortwebname.substring(0,20)+"..."),shortpath.length>20&&(shortpath=shortpath.substring(0,20)+"..."),body+='<tr> <td><span class="ico ico-'+that.get_ext_name(rdata.files[i].name)+'"></span><span class="tname" title="'+rdata.files[i].name+'">'+shortwebname+'</span></td> <td><span title="'+rdata.files[i].dname+'">'+shortpath+"</span></td> <td>"+ToSize(rdata.files[i].size)+"</td> <td>"+getLocalTime(rdata.files[i].time)+'</td> <td style="text-align: right;"> <a class="btlink" href="javascript:;" onclick="bt_file.ReRecycleBin(\''+rdata.files[i].rname.replace(/'/,"\\'")+"',this)\">"+lan.files.recycle_bin_re+'</a> | <a class="btlink" href="javascript:;" onclick="bt_file.DelRecycleBin(\''+rdata.files[i].rname.replace(/'/,"\\'")+"',this)\">"+lan.files.recycle_bin_del+"</a> </td> </tr>"}return void $("#RecycleBody").html(body);case 5:for(var i=0;i<rdata.files.length;i++)if(-1==rdata.files[i].name.indexOf("BTDB_")&&!ReisImage(getFileName(rdata.files[i].name))){var shortwebname=rdata.files[i].name.replace(/'/,"\\'"),shortpath=rdata.files[i].dname;shortwebname.length>20&&(shortwebname=shortwebname.substring(0,20)+"..."),shortpath.length>20&&(shortpath=shortpath.substring(0,20)+"..."),body+='<tr> <td><span class="ico ico-'+that.get_ext_name(rdata.files[i].name)+'"></span><span class="tname" title="'+rdata.files[i].name+'">'+shortwebname+'</span></td> <td><span title="'+rdata.files[i].dname+'">'+shortpath+"</span></td> <td>"+ToSize(rdata.files[i].size)+"</td> <td>"+getLocalTime(rdata.files[i].time)+'</td> <td style="text-align: right;"> <a class="btlink" href="javascript:;" onclick="bt_file.ReRecycleBin(\''+rdata.files[i].rname.replace(/'/,"\\'")+"',this)\">"+lan.files.recycle_bin_re+'</a> | <a class="btlink" href="javascript:;" onclick="bt_file.DelRecycleBin(\''+rdata.files[i].rname.replace(/'/,"\\'")+"',this)\">"+lan.files.recycle_bin_del+"</a> </td> </tr>"}return void $("#RecycleBody").html(body);case 6:for(var i=0;i<rdata.files.length;i++)if(-1!=rdata.files[i].name.indexOf("BTDB_")){var shortwebname=rdata.files[i].name.replace(/'/,"\\'"),shortpath=rdata.files[i].dname;shortwebname.length>20&&(shortwebname=shortwebname.substring(0,20)+"..."),shortpath.length>20&&(shortpath=shortpath.substring(0,20)+"..."),body+='<tr> <td><span class="ico ico-'+that.get_ext_name(rdata.files[i].name)+'"></span><span class="tname" title="'+rdata.files[i].name+'">'+shortwebname.replace("BTDB_","")+'</span></td> <td><span title="'+rdata.files[i].dname+'">mysql://'+shortpath.replace("BTDB_","")+"</span></td> <td>-</td> <td>"+getLocalTime(rdata.files[i].time)+'</td> <td style="text-align: right;"> <a class="btlink" href="javascript:;" onclick="bt_file.ReRecycleBin(\''+rdata.files[i].rname.replace(/'/,"\\'")+"',this)\">"+lan.files.recycle_bin_re+'</a> | <a class="btlink" href="javascript:;" onclick="bt_file.DelRecycleBin(\''+rdata.files[i].rname.replace(/'/,"\\'")+"',this)\">"+lan.files.recycle_bin_del+"</a> </td> </tr>"}return void $("#RecycleBody").html(body)}function getFileName(name){var text=name.split("."),n;return text=text[text.length-1]}function ReisImage(fileName){for(var exts=["jpg","jpeg","png","bmp","gif","tiff","ico"],i=0;i<exts.length;i++)if(fileName==exts[i])return!0;return!1}$("#RecycleBody").html(body)}))},recycle_bin_view:function(){var that=this;layer.open({title:lan.files.recycle_bin_title,type:1,skin:"recycle_view",area:["80%","672px"],closeBtn:2,content:'<div class="recycle_bin_view"> <div class="re-head"> <div style="margin-left: 3px;" class="ss-text"> <em>'+lan.files.recycle_bin_on+'</em> <div class="ssh-item"> <input class="btswitch btswitch-ios" id="Set_Recycle_bin" type="checkbox"> <label class="btswitch-btn" for="Set_Recycle_bin" onclick="bt_file.Set_Recycle_bin()"></label> </div> <em style="margin-left: 20px;">'+lan.files.recycle_bin_on_db+'</em> <div class="ssh-item"> <input class="btswitch btswitch-ios" id="Set_Recycle_bin_db" type="checkbox"> <label class="btswitch-btn" for="Set_Recycle_bin_db" onclick="bt_file.Set_Recycle_bin(1)"></label> </div> </div> <span style="line-height: 32px; margin-left: 30px;">'+lan.files.recycle_bin_ps+'</span> <button style="float: right" class="btn btn-default btn-sm" onclick="bt_file.CloseRecycleBin();">'+lan.files.recycle_bin_close+'</button> </div> <div class="re-con"> <div class="re-con-menu"> <p class="on" data-type="1">'+lan.files.recycle_bin_type1+'</p> <p data-type="2">'+lan.files.recycle_bin_type2+'</p> <p data-type="3">'+lan.files.recycle_bin_type3+'</p> <p data-type="4">'+lan.files.recycle_bin_type4+'</p> <p data-type="5">'+lan.files.recycle_bin_type5+'</p> <p data-type="6">'+lan.files.recycle_bin_type6+'</p> </div> <div class="re-con-con pd15" id="recycle_table"></div> </div> </div>',success:function(){-1!=window.location.href.indexOf("database")?($(".re-con-menu p:last-child").addClass("on").siblings().removeClass("on"),$(".re-con-menu p:eq(5)").click()):$(".re-con-menu p:eq(0)").click();var render_recycle=that.render_recycle_list();$(".re-con-menu").on("click","p",(function(){var _type=$(this).data("type");$(this).addClass("on").siblings().removeClass("on"),render_recycle.$refresh_table_list(!0)}))}})},render_recycle_list:function(){var that=this;$("#recycle_table").empty();var recycle_list=bt_tools.table({el:"#recycle_table",url:"/files?action=Get_Recycle_bin",height:480,dataFilter:function(res){var files=[];switch($(".re-con-menu p.on").index()){case 0:for(let i=0;i<res.dirs.length;i++){const item=res.dirs[i];files.push($.extend(item,{type:"folder"}))}for(let j=0;j<res.files.length;j++){const item=res.files[j],ext_list=item.dname.split("."),ext=that.determine_file_type(ext_list[ext_list.length-1]);item.name.indexOf("BTDB_")>-1?(item.dname=item.dname.replace("BTDB_",""),item.name=item.name.replace("BTDB_",""),files.push($.extend(item,{type:"files"}))):"images"==ext?files.push($.extend(item,{type:ext})):files.push($.extend(item,{type:"files"}))}break;case 1:for(let i=0;i<res.dirs.length;i++){const item=res.dirs[i];files.push($.extend(item,{type:"files"}))}break;case 2:for(let j=0;j<res.files.length;j++){const item=res.files[j],ext_list=item.dname.split("."),ext=that.determine_file_type(ext_list[ext_list.length-1]);-1==item.name.indexOf("BTDB")&&files.push($.extend(item,{type:ext}))}break;case 3:for(let j=0;j<res.files.length;j++){const item=res.files[j],ext_list=item.dname.split("."),ext=that.determine_file_type(ext_list[ext_list.length-1]);"images"==ext&&files.push($.extend(item,{type:ext}))}break;case 4:for(let j=0;j<res.files.length;j++){const item=res.files[j],ext_list=item.dname.split("."),ext=that.determine_file_type(ext_list[ext_list.length-1]);"images"!=ext&&"compress"!=ext&&"video"!=ext&&-1==item.name.indexOf("BTDB")&&files.push($.extend(item,{type:ext}))}break;case 5:for(let j=0;j<res.files.length;j++){const item=res.files[j];item.name.indexOf("BTDB_")>-1&&(item.dname=item.dname.replace("BTDB_",""),item.name=item.name.replace("BTDB_",""),console.log(),files.push($.extend(item,{type:"files"})))}}return $("#Set_Recycle_bin").attr("checked",res.status),$("#Set_Recycle_bin_db").attr("checked",res.status_db),{data:files}},column:[{type:"checkbox",class:"",width:18},{fid:"name",title:lan.files.recycle_bin_th1,width:155,template:function(row){return'<div class="text-overflow" style="width:150px" title="'+row.name+'"><i class="file_icon file_'+row.type+'"></i><span style="width:100px">'+row.name+"</span></div>"}},{fid:"dname",title:lan.files.recycle_bin_th2,template:function(row){return'<span class="text-overflow" style="min-width:150px" title="'+row.dname+'">'+row.dname+"</span>"}},{fid:"size",title:lan.files.recycle_bin_th3,width:85,template:function(row){return'<span class="text-overflow" title="'+row.size+'">'+bt.format_size(row.size)+"</span>"}},{fid:"time",title:lan.files.recycle_bin_th4,width:180,template:function(row,index){return'<span title="'+row.time+'">'+bt.format_data(row.time)+"</span>"}},{type:"group",align:"right",width:250,title:lan.files.recycle_bin_th5,group:[{title:lan.files.recycle_bin_re,event:function(row,index,ev,key,that){bt_file.ReRecycleBin(row.rname,(function(){that.$delete_table_row(index)}))}},{title:lan.files.recycle_bin_del,event:function(row,index,ev,key,that){bt_file.DelRecycleBin(row.rname,(function(){that.$delete_table_row(index)}))}}]}],tootls:[{type:"batch",positon:["left","bottom"],placeholder:"Please Choose",buttonValue:"Execute",disabledSelectValue:"Please select the port that needs batch operation!",selectList:[{title:"Restore",url:"/files?action=Re_Recycle_bin",load:!0,param:function(row){return{path:row.rname}},callback:function(that){bt.confirm({title:"Restore files",msg:"Batch restore selected files, do you want to continue?",icon:0},(function(index){layer.close(index),that.start_batch({},(function(list){for(var html="",i=0;i<list.length;i++){var item=list[i];html+="<tr><td>"+item.name+'</td><td><div style="float:right;"><span style="color:'+(item.request.status?"#20a53a":"red")+'">'+(item.request.status?"Successful recovery":"Recovery failed")+"</span></div></td></tr>"}recycle_list.$batch_success_table({title:"Restore files",th:"File name",html:html}),recycle_list.$refresh_table_list(!0)}))}))}},{title:"Delete files permanently",url:"/files?action=Del_Recycle_bin",load:!0,param:function(row){return{path:row.rname}},callback:function(that){bt.confirm({title:"Delete selected files",msg:"Delete the selected file. The file will be completely deleted and cannot be recovered. Do you want to continue?",icon:0},(function(index){layer.close(index),that.start_batch({},(function(list){for(var html="",i=0;i<list.length;i++){var item=list[i];html+="<tr><td>"+item.name+'</td><td><div style="float:right;"><span style="color:'+(item.request.status?"#20a53a":"red")+'">'+(item.request.status?"Successfully deleted":"Failed to delete")+"</span></div></td></tr>"}recycle_list.$batch_success_table({title:"Delete multiple files",th:"File name",html:html}),recycle_list.$refresh_table_list(!0)}))}))}}]}]});return bt_tools.$fixed_table_thead("#recycle_table .divtable"),recycle_list},Set_Recycle_bin:function(db){var loadT=layer.msg(lan.public.the,{icon:16,time:0,shade:[.3,"#000"]}),that=this,data={};1==db&&(data={db:db}),$.post("/files?action=Recycle_bin",data,(function(rdata){layer.close(loadT),rdata.status&&null==db&&(that.is_recycle=$("#Set_Recycle_bin").prop("checked")),layer.msg(rdata.msg,{icon:rdata.status?1:5})}))},ReRecycleBin:function(path,obj){layer.confirm(lan.files.recycle_bin_re_msg,{title:lan.files.recycle_bin_re_title,closeBtn:2,icon:3},(function(){var loadT=layer.msg(lan.files.recycle_bin_re_the,{icon:16,time:0,shade:[.3,"#000"]});$.post("/files?action=Re_Recycle_bin","path="+encodeURIComponent(path),(function(rdata){layer.close(loadT),layer.msg(rdata.msg,{icon:rdata.status?1:5}),$(obj).parents("tr").remove()}))}))},DelRecycleBin:function(path,obj){layer.confirm(lan.files.recycle_bin_del_msg,{title:lan.files.recycle_bin_del_title,closeBtn:2,icon:3},(function(){var loadT=layer.msg(lan.files.recycle_bin_del_the,{icon:16,time:0,shade:[.3,"#000"]});$.post("/files?action=Del_Recycle_bin","path="+encodeURIComponent(path),(function(rdata){layer.close(loadT),layer.msg(rdata.msg,{icon:rdata.status?1:5}),$(obj).parents("tr").remove()}))}))},CloseRecycleBin:function(){var _this=this;layer.confirm(lan.files.recycle_bin_close_msg,{title:lan.files.recycle_bin_close,closeBtn:2,icon:3},(function(){var loadT=layer.msg("<div class='myspeed'>"+lan.files.recycle_bin_close_the+"</div>",{icon:16,time:0,shade:[.3,"#000"]});setTimeout((function(){getSpeed(".myspeed")}),1e3),$.post("/files?action=Close_Recycle_bin","",(function(rdata){layer.close(loadT),layer.msg(rdata.msg,{icon:rdata.status?1:5}),_this.render_recycle_list()}))}))},open_property_view:function(data){console.log(data);var _this=this;_this.$http("get_file_attribute",{filename:data.path},(function(res){layer.open({type:1,closeBtn:2,title:"[ "+data.filename+" ] - "+(data.is_dir?"Folder":"File")+" properties",area:["580px","500px"],shadeClose:!1,content:'<div class="bt-property-setting pd15"> <div class="tab-nav"> <span class="on">General</span> <span>Detail</span> <span>History</span> </div> <div class="tab-con"> <div class="property-box file_list_content active"> <div class="attr-box"> <div class="attr-name" style="height: 60px;line-height: 60px;"><i class="file_icon file_'+(res.is_link?"link":res.is_dir?"folder":res.st_type)+'"></i></div> <div class="attr-content" style="height: 60px;line-height: 60px;"><input type="text" disabled value="'+data.filename+'" /></div> </div> <div class="dividing"></div> <div class="attr-box" > <div class="attr-name">Type:</div> <div class="attr-content">'+(res.is_dir||res.is_link?res.st_type:_this.ext_type_tips(res.st_type))+'</div> </div> <div class="attr-box" > <div class="attr-name">Location:</div> <div class="attr-content"><span title="'+res.path+'">'+res.path+'</span></div> </div> <div class="attr-box" > <div class="attr-name">Size:</div> <div class="attr-content">'+bt.format_size(res.st_size)+" ("+_this.font_thousandth(res.st_size)+' byte)</div> </div> <div class="dividing"></div> <div class="attr-box"> <div class="attr-name">Permissions:</div> <div class="attr-content">'+res.mode+'</div> </div> <div class="attr-box"> <div class="attr-name">Group:</div> <div class="attr-content">'+res.group+'</div> </div> <div class="attr-box"> <div class="attr-name">User:</div> <div class="attr-content">'+res.user+'</div> </div> <div class="dividing"></div> <div class="attr-box"> <div class="attr-name">Visit time:</div> <div class="attr-content">'+bt.format_data(res.st_atime)+'</div> </div> <div class="attr-box"> <div class="attr-name">Modified time:</div> <div class="attr-content">'+bt.format_data(res.st_mtime)+'</div> </div> </div> <div class="property-box details_box_view"> <table> <thead><tr><th><div style="width:100px">Properties</div></th><th><div style="width:400px">Value</div></th></tr></thead> <tbody class="details_list"></tbody> </table> </div> <div class="property-box history_box_view" > <table> <thead><tr><th><div style="width:140px;">Modified time</div></th><th><div style="width:85px;">Size</div></th><th><div >MD5</div></th><th><div style="width:90px;text-align:right;">OPT</div></th></tr></thead> <tbody class="history_list"></tbody> </table> </div> </div> </div>',success:function(layero,index){$(".bt-property-setting .tab-nav span").click((function(){var index=$(this).index();$(this).addClass("on").siblings().removeClass("on"),$(".property-box:eq("+index+")").addClass("active").siblings().removeClass("active")})),$(".history_box_view").on("click",".open_history_file",(function(){var _history=$(this).attr("data-time");openEditorView(0,data.path),setTimeout((function(){aceEditor.openHistoryEditorView({filename:data.path,history:_history},(function(){layer.close(index),$(".ace_conter_tips").show(),$(".ace_conter_tips .tips").html("Read-only file, the file is "+_item.path+", historic version [ "+bt.format_data(new Number(_history))+' ]<a href="javascript:;" class="ml35 btlink" data-path="'+_item.path+'" data-history="'+_history+'">Click to restore</a>')}))}),500)})),$(".history_box_view").on("click",".recovery_file_historys",(function(){aceEditor.event_ecovery_file(this)}));var config={filename:["Name",data.filename],type:["Type",res.is_dir||res.is_link?res.st_type:_this.ext_type_tips(res.st_type)],path:"Location",st_size:["Size",bt.format_size(res.st_size)+" ("+_this.font_thousandth(res.st_size)+" byte)"],st_atime:["Visit time",bt.format_data(res.st_atime)],st_mtime:["Modified time",bt.format_data(res.st_mtime)],st_ctime:["Metadata modification time",bt.format_data(res.st_ctime)],md5:"MD5",sha1:"sha1",user:"User",group:"Group",mode:"Permissions",st_uid:"UID",st_gid:"GID",st_nlink:"Num of inode links",st_ino:"inode node num",st_mode:"inode protection mode",st_dev:"inode resident device"},html="",html2="";for(var key in config)if(Object.hasOwnProperty.call(config,key)){var element=config[key],value=$.isArray(element)?element[1]:res[key];html+='<tr><td><div style="width:110px">'+($.isArray(element)?element[0]:element)+'</div></td><td><div class="ellipsis" style="width:400px" title="'+value+'">'+value+"</div></td></tr>"}for(let i=0;i<res.history.length;i++){const item=res.history[i];html2+='<tr><td><div style="width:140px;">'+bt.format_data(item.st_mtime)+'</div></td><td><div style="width:85px;">'+bt.format_size(item.st_size)+"</div></td><td><div>"+item.md5+'</div></td><td><div style="width:90px;text-align:right;"><a href="javascript:;" class="btlink open_history_file" data-time="'+item.st_mtime+'">view</a> | <a href="javascript:;" class="btlink recovery_file_historys" data-history="'+item.st_mtime+'" data-path="'+data.path+'">restore</a></div></td></tr>'}""===html2&&(html2+='<tr><td colspan="4"><div style="text-align: center;">No historical version</div></td></tr>'),$(".details_list").html(html),$(".history_list ").html(html2),_this.fixed_table_thead(".details_box_view"),_this.fixed_table_thead(".history_box_view ")}})}))},fixed_table_thead:function(el){$(el).scroll((function(){var scrollTop=this.scrollTop;this.querySelector("thead").style.transform="translateY("+scrollTop+"px)"}))},font_thousandth:function(num){var source=String(num).split(".");return source[0]=source[0].replace(new RegExp("(\\d)(?=(\\d{3})+$)","ig"),"$1,"),source.join(".")},open_images_preview:function(data){var that=this,mask=$('<div class="preview_images_mask"><div class="preview_head"><span class="preview_title">'+data.filename+'</span><span class="preview_small hidden" title="Zoom out"><span class="glyphicon glyphicon-resize-small" aria-hidden="true"></span></span><span class="preview_full" title="Zoom in"><span class="glyphicon glyphicon-resize-full" aria-hidden="true"></span></span><span class="preview_close" title="Close preview view"><span class="glyphicon glyphicon-remove" aria-hidden="true"></span></span></div><div class="preview_body"><img id="preview_images" src="/download?filename='+data.path+'" data-index="'+data.images_id+'"></div><div class="preview_toolbar"><a href="javascript:;" title="Left rotation"><span class="glyphicon glyphicon-repeat reverse-repeat" aria-hidden="true"></span></a><a href="javascript:;" title="Right rotation"><span class="glyphicon glyphicon-repeat" aria-hidden="true"></span></a><a href="javascript:;" title="Zoom in"><span class="glyphicon glyphicon-zoom-in" aria-hidden="true"></span></a><a href="javascript:;" title="Zoom out"><span class="glyphicon glyphicon-zoom-out" aria-hidden="true"></span></a><a href="javascript:;" title="Reset"><span class="glyphicon glyphicon-refresh" aria-hidden="true"></span></a><a href="javascript:;" title="Image list"><span class="glyphicon glyphicon-list" aria-hidden="true"></span></a></div><div class="preview_cut_view"><a href="javascript:;" title="Up"><span class="glyphicon glyphicon-menu-left" aria-hidden="true"></span></a><a href="javascript:;" title="Next"><span class="glyphicon glyphicon-menu-right" aria-hidden="true"></span></a></div></div>'),images_config={natural_width:0,natural_height:0,init_width:0,init_height:0,preview_width:0,preview_height:0,current_width:0,current_height:0,current_left:0,current_top:0,rotate:0,scale:1,images_mouse:!1};if($(".preview_images_mask").length>0)return $("#preview_images").attr("src","/download?filename="+data.path),!1;function auto_images_size(transition){var rotate=Math.abs(images_config.rotate/90),preview_width=rotate%2==0?images_config.preview_width:images_config.preview_height,preview_height=rotate%2==0?images_config.preview_height:images_config.preview_width,preview_images=$("#preview_images"),css_config={};images_config.init_width=images_config.natural_width,images_config.init_height=images_config.natural_height,images_config.init_width>preview_width&&(images_config.init_width=preview_width,images_config.init_height=parseFloat((preview_width/images_config.natural_width*images_config.init_height).toFixed(2))),images_config.init_height>preview_height&&(images_config.init_width=parseFloat((preview_height/images_config.natural_height*images_config.init_width).toFixed(2)),images_config.init_height=preview_height),images_config.current_width=parseFloat(images_config.init_width*images_config.scale),images_config.current_height=parseFloat(images_config.init_height*images_config.scale),images_config.current_left=parseFloat(((images_config.preview_width-images_config.current_width)/2).toFixed(2)),images_config.current_top=parseFloat(((images_config.preview_height-images_config.current_height)/2).toFixed(2)),css_config={width:images_config.current_width,height:images_config.current_height,top:images_config.current_top,left:images_config.current_left,display:"inline",transform:"rotate("+images_config.rotate+"deg)",opacity:1,transition:"all 100ms"},!1===transition&&delete css_config.transition,preview_images.css(css_config)}$("body").css("overflow","hidden").append(mask),images_config.preview_width=mask[0].clientWidth,images_config.preview_height=mask[0].clientHeight,$(".preview_body img").load((function(){var img=$(this)[0];$(this).attr("data-index")||$(this).attr("data-index",data.images_id),images_config.natural_width=img.naturalWidth,images_config.natural_height=img.naturalHeight,auto_images_size(!1)})),$(".preview_images_mask .preview_head").on("mousedown",(function(e){e=e||window.event;var drag=$(this).parent();if($("body").addClass("select"),$(this).onselectstart=$(this).ondrag=function(){return!1},!$(e.target).hasClass("preview_close")){var diffX=e.clientX-drag.offset().left,diffY=e.clientY-drag.offset().top;$(document).on("mousemove",(function(e){var left=(e=e||window.event).clientX-diffX,top=e.clientY-diffY;left<0?left=0:left>window.innerWidth-drag.width()&&(left=window.innerWidth-drag.width()),top<0?top=0:top>window.innerHeight-drag.height()&&(top=window.innerHeight-drag.height()),drag.css({left:left,top:top,margin:0})})).on("mouseup",(function(){$(this).unbind("mousemove mouseup")}))}})),$(".preview_images_mask #preview_images").on("mousedown",(function(e){e=e||window.event,$(this).onselectstart=$(this).ondrag=function(){return!1};var images=$(this),preview=$(".preview_images_mask").offset(),diffX=e.clientX-preview.left,diffY=e.clientY-preview.top;$(".preview_images_mask").on("mousemove",(function(e){var offsetX=(e=e||window.event).clientX-preview.left-diffX,offsetY=e.clientY-preview.top-diffY,rotate=Math.abs(images_config.rotate/90),preview_width=rotate%2==0?images_config.preview_width:images_config.preview_height,preview_height=rotate%2==0?images_config.preview_height:images_config.preview_width,left,top;if(images_config.current_width>preview_width){var max_left=preview_width-images_config.current_width;(left=images_config.current_left+offsetX)>0?left=0:left<max_left&&(left=max_left),images_config.current_left=left}if(images_config.current_height>preview_height){var max_top=preview_height-images_config.current_height;(top=images_config.current_top+offsetY)>0?top=0:top<max_top&&(top=max_top),images_config.current_top=top}images_config.current_height>preview_height&&images_config.current_top<=0&&images_config.current_height-preview_height<=images_config.current_top&&(images_config.current_top-=offsetY),images.css({left:images_config.current_left,top:images_config.current_top})})).on("mouseup",(function(){$(this).unbind("mousemove mouseup")})).on("dragstart",(function(){e.preventDefault()}))})).on("dragstart",(function(){return!1})),$(".preview_close").click((function(e){$(".preview_images_mask").remove()})),$(".preview_toolbar a").click((function(){var index=$(this).index(),images=$("#preview_images");switch(index){case 0:case 1:images_config.rotate=index?images_config.rotate+90:images_config.rotate-90,auto_images_size();break;case 2:case 3:if(3==images_config.scale&&2==index||.2==images_config.scale&&3==index)return layer.msg(images_config.scale>=1?"The image is the maximum size":"The image is the minimum size"),!1;images_config.scale=(2==index?Math.round(10*(images_config.scale+.4)):Math.round(10*(images_config.scale-.4)))/10,auto_images_size();break;case 4:var scale_offset=images_config.rotate%360;scale_offset>=180?images_config.rotate+=360-scale_offset:images_config.rotate-=scale_offset,images_config.scale=1,auto_images_size()}})),$(".preview_full,.preview_small").click((function(){$(this).hasClass("preview_full")?($(this).addClass("hidden").prev().removeClass("hidden"),images_config.preview_width=that.area[0],images_config.preview_height=that.area[1],mask.css({width:that.area[0],height:that.area[1],top:0,left:0,margin:0}).data("type","full"),auto_images_size()):($(this).addClass("hidden").next().removeClass("hidden"),$(".preview_images_mask").removeAttr("style"),images_config.preview_width=750,images_config.preview_height=650,auto_images_size())})),$(".preview_cut_view a").click((function(){var images_src="",preview_images=$("#preview_images"),images_id=parseInt(preview_images.attr("data-index"));$(this).index()?(images_id=images_id==that.file_images_list.length-1?0:images_id+1,images_src=that.file_images_list[images_id]):(images_id=0===images_id?that.file_images_list.length-1:images_id-1,images_src=that.file_images_list[images_id]),preview_images.attr("data-index",images_id).attr("src","/download?filename="+images_src),$(".preview_title").html(that.get_path_filename(images_src))}))},open_video_play:function(data){var old_filename=data.path,imgUrl="/download?filename="+data.path,p_tmp=data.path.split("/"),path=p_tmp.slice(0,p_tmp.length-1).join("/");layer.open({type:1,closeBtn:2,title:'Playing [<a class="btvideo-title">'+p_tmp[p_tmp.length-1]+"</a>]",area:["890px","402px"],shadeClose:!1,skin:"movie_pay",content:'<div id="btvideo"><video type="" src="'+imgUrl+'&play=true" data-filename="'+data.path+'" controls="controls" autoplay="autoplay" width="640" height="360"> Your browser does not support video tags </video></div><div class="video-list"></div>',success:function(){$.post("/files?action=get_videos",{path:path},(function(rdata){for(var video_list='<table class="table table-hover" style="margin-bottom:0;"><thead style="display: none;"><tr><th style="word-break: break-all;word-wrap:break-word;width:165px;">File name</th><th style="width:65px" style="text-align:right;">Size</th></tr></thead>',index=0,i=0;i<rdata.length;i++){var filename=path+"/"+rdata[i].name;filename===old_filename&&(index=i),video_list+='<tr class="'+(filename===old_filename?"video-avt":"")+'"><td style="word-break: break-all;word-wrap:break-word;width:150px" onclick="bt_file.play_file(this,\''+filename+'\')" title="Size: '+filename+"\nType: "+rdata[i].type+'"><a>'+rdata[i].name+'</a></td><td style="font-size: 8px;text-align:right;width:'+(65+bt_file.scroll_width)+'px;">'+ToSize(rdata[i].size)+"</td></tr>"}video_list+="</table>",$(".video-list").html(video_list).scrollTop(34*index)}))}})},play_file:function(obj,filename){if($("#btvideo video").attr("data-filename")==filename)return!1;var imgUrl,v='<video src="'+("/download?filename="+filename+"&play=true")+'" controls="controls" data-fileName="'+filename+'" autoplay="autoplay" width="640" height="360">Your browser does not support the [video] tag.</video>';$("#btvideo").html(v);var p_tmp=filename.split("/");$(".btvideo-title").html(p_tmp[p_tmp.length-1]),$(".video-avt").removeClass("video-avt"),$(obj).parents("tr").addClass("video-avt")},copy_file_or_dir:function(data){bt.set_cookie("record_paste",data.path),bt.set_cookie("record_paste_type","copy"),$(".file_all_paste").removeClass("hide"),layer.msg("Copy successfully. Please click [Paste] or Ctrl + V to paste")},cut_file_or_dir:function(data){bt.set_cookie("record_paste",data.path),bt.set_cookie("record_paste_type","cut"),$(".file_all_paste").removeClass("hide"),layer.msg("Cut successfully. Please click [Paste] or Ctrl + V to paste")},paste_file_or_dir:function(){var that=this,_isPaste=bt.get_cookie("record_paste_type"),_paste=bt.get_cookie("record_paste"),_filename="";if("null"!=_paste&&null!=_paste&&(_filename=_paste.split("/").pop()),that.file_path.indexOf(_paste)>-1)return layer.msg("Can not paste ["+_filename+"] here, Because the item cannot be pasted into itself.",{icon:0}),!1;if("null"!=_isPaste&&null!=_isPaste)switch(_isPaste){case"cut":case"copy":this.check_exists_files_req({dfile:this.file_path,filename:_filename},(function(result){if(result.length>0){for(var tbody="",i=0;i<result.length;i++)tbody+='<tr><td><span class="exists_files_style">'+result[i].filename+"</span></td><td>"+ToSize(result[i].size)+"</td><td>"+getLocalTime(result[i].mtime)+"</td></tr>";var mbody;SafeMessage("This files will be overwritten",'<div class="divtable"><table class="table table-hover" width="100%" border="0" cellpadding="0" cellspacing="0"><thead><th>File name</th><th>Size</th><th>Last edit time</th></thead> <tbody>'+tbody+"</tbody> </table></div>",(function(){that.config_paste_to(_paste,_filename)}))}else that.config_paste_to(_paste,_filename)}));break;case"1":case"2":that.batch_file_paste()}},config_paste_to:function(path,_filename){var that=this,_type=bt.get_cookie("record_paste_type");this.$http("copy"==_type?"CopyFile":"MvFile",{sfile:path,dfile:this.file_path+"/"+_filename},(function(rdata){rdata.status&&(bt.set_cookie("record_paste",null),bt.set_cookie("record_paste_type",null),that.reader_file_list({path:that.file_path})),layer.msg(rdata.msg,{icon:rdata.status?1:2})}))},rename_file_or_dir:function(data){var that=this;that.is_editor=!0,$(".file_list_content .file_tr:nth-child("+(data.index+1)+")").addClass("editr_tr").find(".file_title").empty().append($("icon"==bt.get_cookie("rank")?'<textarea name="rename_file_input" onfocus="this.select()">'+data.filename+"</textarea>":'<input name="rename_file_input" onfocus="this.select()" type="text" value="'+data.filename+'">')),"icon"==bt.get_cookie("rank")&&$("textarea[name=rename_file_input]").css({height:$("textarea[name=rename_file_input]")[0].scrollHeight}),$(("icon"==bt.get_cookie("rank")?"textarea":"input")+"[name=rename_file_input]").on("input",(function(){if("icon"==bt.get_cookie("rank")&&(this.style.height="auto",this.style.height=this.scrollHeight+"px"),"file"==data.type){var ext_arry=$(this).val().split("."),ext=ext_arry[ext_arry.length-1];$(this).parent().prev().find(".file_icon").removeAttr("class").addClass("file_icon file_"+ext)}})).keyup((function(e){13==e.keyCode&&$(this).blur(),e.stopPropagation(),e.preventDefault()})).blur((function(){var _val=$(this).val().replace(/[\r\n]/g,""),config={sfile:data.path,dfile:that.path_resolve(that.file_path,_val)};return data.filename==_val||""==_val?($(".file_list_content .file_tr:nth-child("+(data.index+1)+")").removeClass("editr_tr").find(".file_title").empty().append($("<i>"+data.filename+"</i>")),that.is_editor=!1,!1):that.match_unqualified_string(_val)?layer.msg('The name cannot have /\\:*?"<>| symbol',{icon:2}):(that.rename_file_req(config,(function(res){that.reader_file_list({path:that.file_path},(function(){layer.msg(res.msg,{icon:res.status?1:2})}))})),void(that.is_editor=!1))})).focus()},set_file_share:function(data){var that=this;this.loadY=bt.open({type:1,shift:5,closeBtn:2,area:"450px",title:"Set share "+data.type_tips+"-["+data.filename+"]",btn:["Create","Cancel"],content:'<from class="bt-form" id="outer_url_form" style="padding:30px 15px;display:inline-block"><div class="line"><span class="tname">Share name</span><div class="info-r"><input name="ps" class="bt-input-text mr5" type="text" placeholder="No sharing name" style="width:270px" value="'+data.filename+'"></div></div><div class="line"><span class="tname">Expiration date</span><div class="info-r"><label class="checkbox_grourd"><input type="radio" name="expire" value="24" checked><span> A Day</span></label><label class="checkbox_grourd"><input type="radio" name="expire" value="168"><span> A Deek</span></label><label class="checkbox_grourd"><input type="radio" name="expire" value="1130800"><span> Permanent</span></label></div></div><div class="line"><span class="tname">Extraction code</span><div class="info-r"><input name="password" class="bt-input-text mr5" placeholder="No code if it is empty" type="text" style="width:195px" value=""><button type="button" id="random_paw" class="btn btn-success btn-sm btn-title">Random</button></div></div></from>',yes:function(indexs,layers){var ps=$("[name=ps]").val(),expire=$("[name=expire]:checked").val(),password=$("[name=password]").val();if(""===ps)return layer.msg("No sharing name!",{icon:2}),!1;that.create_download_url({filename:data.path,ps:ps,password:password,expire:expire},(function(res){if(!res.status)return layer.msg(res.msg,{icon:res.status?1:2}),!1;var rdata=res.msg;that.file_list[data.index]=$.extend(that.file_list[data.index],{down_id:rdata.id,down_info:rdata}),that.loadY.close(),that.info_file_share(data),that.reader_file_list_content(that.file_list)}))},success:function(layers,index){$("#random_paw").click((function(){$(this).prev().val(bt.get_random(6))}))}})},info_file_share:function(data){var that=this;if(void 0===data.down_info)return this.get_download_url_find({id:data.down_id},(function(res){that.file_list[data.index]=$.extend(that.file_list[data.index],{down_info:res}),that.file_share_view(that.file_list[data.index],"fonticon")})),!1;this.file_share_view(data,"fonticon")},file_share_view:function(datas,type){var data=datas;"fonticon"==type&&(data=datas.down_info);var that=this,download_url=location.origin+"/down/"+data.token;this.loadY=bt.open({type:1,shift:5,closeBtn:2,area:"550px",title:"Share details-["+data.filename+"]",content:'<div class="bt-form pd20 pb70"><div class="line"><span class="tname">Share name</span><div class="info-r"><input readonly class="bt-input-text mr5" type="text" style="width:365px" value="'+data.ps+'"></div></div><div class="line external_link"><span class="tname">Share chain</span><div class="info-r"><input readonly class="bt-input-text mr5" type="text" style="width:280px" value="'+download_url+'"><button type="button" id="copy_url" data-clipboard-text="'+download_url+'" class="btn btn-success btn-sm btn-title copy_url" style="margin-right:5px" data-clipboard-target="#copy_url"><img style="width:16px" src="data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAABAAAAAQCAYAAAAf8/9hAAABIUlEQVQ4T6XTsSuFURjH8d+3/AFm0x0MyqBEUQaUIqUU3YwWyqgMptud/BlMSt1SBiklg0K3bhmUQTFZDZTxpyOvznt7z3sG7/T2vOf5vM85z3nQPx+KfNuHkhoZ7xXYjNfEwIukXUnvNcg2sJECnoHhugpsnwBN21PAXVgbV/AEjNhuVSFA23YHWLNt4Cc3Bh6BUdtLcbzAgHPbp8BqCngAxjJbOANWUkAPGA8fE8icpD1gOQV0gclMBRfAYgq4BaZtz/YhA5IGgY7tS2AhBdwAM7b3JX1I+iz1G45sXwHzKeAa6P97qZgcEA6v/ZsR3v9aHCmt0P9UBVuShjKz8CYpXPkDYKJ0kaKhWpe0UwOFxDATx5VACFZ0Ivbuga8i8A3NFqQRZ5pz7wAAAABJRU5ErkJggg=="></button><button type="button" class="btn btn-success QR_code btn-sm btn-title"><img style="width:16px" src="data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAABAAAAAQCAYAAAAf8/9hAAABUklEQVQ4T6WSIU9DQRCEvwlYLIoEgwEECs3rDyCpobbtL6AKRyggMQ9TJBjUMzgMCeUnIEAREoICFAoEZMk2dy/Xo4KGNZu7nZ2bnT3xz1DsN7MFYCnhe5V0n/Kb2QowL2kY70cEoXAHVEnDG/ABXAJXmVDHVZKqSFAA58AqsAY8AW3A68/AQ7hbBG6BbeDGlaQEh8AucA3suzDgC5gFXHID2At5YxJBNwA6ocFBM8B3OL8DTaCcpMDN2QojxHHdk9Qrx9SeAyf1CMFIJ3DjYqxLOgo192gs4ibSNfrMOaj2yBvMrCnpImYHR4C/vizpIPkX/mpbUtfMepJKMxtKKsyslNTLCZxkBzgFjoE5oCVp08yKvyhwgkGyRl9nX1LDzDz3kzxS8kuBpFYygq8xJ4gjjBMEpz+BF+AxcXLg39XMOpLOciW1gtz9ac71GqdpSrE/8U20EQ3XLHEAAAAASUVORK5CYII="></button></div></div><div class="line external_link" style="'+(""==data.password?"display:none;":"display:block")+'"><span class="tname">Extraction code</span><div class="info-r"><input readonly class="bt-input-text mr5" type="text" style="width:243px" value="'+data.password+'"><button type="button" data-clipboard-text="Chain:'+download_url+" Extraction code:"+data.password+'" class="btn btn-success copy_paw btn-sm btn-title">Copy link and code</button></div></div><div class="line"><span class="tname">Expiration date</span><div class="info-r"><span style="line-height:32px; display: block;font-size:14px">'+(data.expire>new Date("2099-01-01 00:00:00").getTime()/1e3?'<span calss="btlink">Permanent</span>':bt.format_data(data.expire))+'</span></div></div><div class="bt-form-submit-btn"><button type="button" class="btn btn-danger btn-sm btn-title layer_close">'+lan.public.close+'</button><button type="button" id="down_del" class="btn btn-danger btn-sm btn-title close_down" style="color:#fff;background-color:#c9302c;border-color:#ac2925;" onclick="">Close sharing chain</button></div></div>',success:function(layers,index){var copy_url=new ClipboardJS(".copy_url"),copy_paw=new ClipboardJS(".copy_paw");copy_url.on("success",(function(e){layer.msg("Copy link succeeded!",{icon:1}),e.clearSelection()})),copy_paw.on("success",(function(e){layer.msg("Copy link and extraction code succeeded!",{icon:1}),e.clearSelection()})),$(".layer_close").click((function(){layer.close(index)})),$(".QR_code").click((function(){layer.closeAll("tips"),layer.tips('<div style="height:140px;width:140px;padding:8px 0" id="QR_code"></div>',".QR_code",{area:["150px","150px"],tips:[1,"#ececec"],time:0,shade:[.05,"#000"],shadeClose:!0,success:function(){jQuery("#QR_code").qrcode({render:"canvas",text:download_url,height:130,width:130})}})})),$(".close_down").click((function(){that.remove_download_url({id:data.id,fileName:data.filename},(function(res){that.loadY.close(),"fonticon"==type&&(that.file_list[datas.index].down_id=0,that.reader_file_list_content(that.file_list)),"list"==type&&that.render_share_list(),layer.msg(res.msg,{icon:res.status?1:2})}))}))}})},del_file_or_dir:function(data){var that=this;that.is_recycle?bt.confirm({title:"Delete "+data.type_tips+"[ "+data.filename+" ]",msg:"<span>Comfirm delete "+data.type_tips+"[ "+data.path+" ],it will move to recycle bin after delete, continue?</span>"},(function(){that.del_file_req(data,(function(res){that.reader_file_list({path:that.file_path}),layer.msg(res.msg,{icon:res.status?1:2})}))})):bt.show_confirm("Delete "+data.type_tips+"[ "+data.filename+" ]",'<i style="font-size: 15px;font-style: initial;color: red;">Recycle bin is not currently open, delete '+("dir"==data.type?"directory":"file")+" cannot be restored after, continue?</i></span>",(function(){that.del_file_req(data,(function(res){that.reader_file_list({path:that.file_path}),layer.msg(res.msg,{icon:res.status?1:2})}))}))},cancel_file_favorites:function(data){var that=this,index=data.index;this.loadY=bt.confirm({title:data.filename+lan.files.unfavorite1,msg:lan.files.unfavorite1+" ["+data.path+"] "+lan.files.continue},(function(){that.$http("del_files_store",{path:data.path},(function(res){res.status&&(that.file_list[index].caret=!1,that.reader_file_list_content(that.file_list),that.load_favorites_index_list()),layer.msg(res.msg,{icon:res.status?1:2})}))}))},set_soft_link:function(data){var that=this;bt_tools.open({title:"Create Softlink",area:"520px",content:{class:"pd20",formLabelWidth:"110px",form:[{label:"Source file",group:{type:"text",name:"sfile",width:"280px",placeholder:"Please select the folder and file to be linked",icon:{type:"glyphicon-folder-open",event:function(ev){},select:"all"},value:"",input:function(ev){}}},{label:"Softlink name",group:{type:"text",name:"name",width:"280px",placeholder:"Please enter the name of the softlink",value:""}}]},init:function(){var e=null,t=setInterval((function(){if($('input[name="sfile"]').length<1&&clearInterval(t),e!=$('input[name="sfile"]').val()){var i=(e=$('input[name="sfile"]').val()).split("/");i.length>1&&$('[name="name"]').val(i[i.length-1])}}),100)},yes:function(e,i,a){delete(e=$.extend(e,{dfile:that.file_path+"/"+e.name})).name,bt_tools.send("files/CreateLink",e,(function(e){e.status&&(layer.close(i),bt.msg(e),that.reader_file_list())}),{tips:"Create Softlink"})}})},set_file_authority:function(data,isPatch){var that=this;that.get_file_authority({path:data.path},(function(rdata){var tex='<div class="info-title-tips" style="padding-left: 7px;margin: 10px 23px;"> <span class="glyphicon glyphicon-alert" style="color: #f39c12; margin-right: 5px;"></span> <span class="backuptip"></span> <button class="restore btn btn-success btn-sm" style="margin-left: 5px;">Backup</button> <div style="display: inline-block;width: 1px;height: 13px;background: #20a53a;vertical-align: middle;margin: 0 5px;"></div> <button class="manage btn btn-default btn-sm tolist" style="padding:6px;">Restore</button> </div>';that.loadY=layer.open({type:1,closeBtn:2,title:lan.files.set_auth+"["+data.filename+"]",area:"465px",shadeClose:!1,content:'<div class="setchmod bt-form" style="padding: 0;"> <div class="bt_tab_list"> <div class="bt_tab_index active" data-index="0">Set permission</div> <div class="bt_tab_index backup-list" data-index="1">Backups list</div> </div> <div class="chmodset" style="margin-bottom: 60px;">'+tex+" <fieldset> <legend>"+lan.files.file_own+'</legend> <p><input type="checkbox" id="owner_r" />'+lan.files.file_read+'</p> <p><input type="checkbox" id="owner_w" />'+lan.files.file_write+'</p> <p><input type="checkbox" id="owner_x" />'+lan.files.file_exec+"</p> </fieldset> <fieldset> <legend>"+lan.files.file_group+'</legend> <p><input type="checkbox" id="group_r" />'+lan.files.file_read+'</p> <p><input type="checkbox" id="group_w" />'+lan.files.file_write+'</p> <p><input type="checkbox" id="group_x" />'+lan.files.file_exec+"</p> </fieldset> <fieldset> <legend>"+lan.files.file_public+'</legend> <p><input type="checkbox" id="public_r" />'+lan.files.file_read+'</p> <p><input type="checkbox" id="public_w" />'+lan.files.file_write+'</p> <p><input type="checkbox" id="public_x" />'+lan.files.file_exec+'</p> </fieldset> <div class="setchmodnum"><input class="bt-input-text" type="text" id="access" maxlength="3" value="'+rdata.chmod+'">'+lan.files.file_menu_auth+", <span>"+lan.files.file_own+' <select id="chown" class="bt-input-text"> <option value="www" '+("www"==rdata.chown?'selected="selected"':"")+'>www</option> <option value="mysql" '+("mysql"==rdata.chown?'selected="selected"':"")+'>mysql</option> <option value="root" '+("root"==rdata.chown?'selected="selected"':"")+'>root</option> </select></span> <span><input type="checkbox" id="accept_all" checked /><label for="accept_all" style="position: absolute;margin-top: 4px; margin-left: 5px;font-weight: 400;">Apply to subdir</label></span> </div> </div> <div class="backup_lists"></div> <div class="bt-form-submit-btn"> <button type="button" class="btn btn-danger btn-sm btn-title layer_close">'+lan.public.close+'</button> <button type="button" class="btn btn-success btn-sm btn-title set_access_authority">'+lan.public.ok+"</button> </div> </div>",success:function(index,layers){that.edit_access_authority(),$("#access").keyup((function(){that.edit_access_authority()})),$("input[type=checkbox]").change((function(){for(var idName=["owner","group","public"],onacc="",n=0;n<idName.length;n++){var access=0;access+=$("#"+idName[n]+"_x").prop("checked")?1:0,access+=$("#"+idName[n]+"_w").prop("checked")?2:0,onacc+=access+=$("#"+idName[n]+"_r").prop("checked")?4:0}$("#access").val(onacc)})),$(".set_access_authority").click((function(){var chmod=$("#access").val(),chown,all,_form={};_form={user:$("#chown").val(),access:chmod,all:$("#accept_all").prop("checked")?"True":"False"},isPatch?(_form.type=data.type,_form.path=data.path,_form.data=data.filelist):_form.filename=data.path,that.$http(isPatch?"SetBatchData":"SetFileAccess",_form,(function(res){res.status&&(layer.close(layers),that.reader_file_list({path:that.file_path,is_operating:!1})),layer.msg(res.msg,{icon:res.status?1:2})}))})),$(".layer_close").click((function(){layer.close(layers)})),that.$http("get_path_premissions",{path:data.filename},(function(edata){0==edata.length&&$(".backuptip").text("No backup")})),$("button.restore").click((function(){that.backup_files_permission(data.path,1)})),$(".tolist").click((function(){$(".backup-list").click()})),$(".bt_tab_list .bt_tab_index").click((function(){$(this).addClass("active").siblings().removeClass("active"),0==$(this).index()?($(".backup_lists").empty(),$(".chmodset").show()):that.backup_files_list(data.path)}))}})}))},backup_files_permission:function(file,type){var sub_type=1;1==type&&(sub_type=$("#accept_all").prop("checked")?1:0);var that=this,layerss=layer.open({type:1,closeBtn:2,title:"Confirm backup?",area:"300px",shadeClose:!1,btn:["Yes","No"],content:'<div style="padding: 20px;margin: 0;font-size: 13px;"> <p style="padding: 8px 5px;font-size: 13px;">Please enter the current backup name</p> <div>Remarks <input type="text" class="form-control ml5 mt10" placeholder="Please enter name" style="width: 179px;display: inline-block;"> </div> </div>',yes:function(layerss,index){$(".layer_close").click((function(){layer.close(index)})),that.$http("back_path_permissions",{back_sub_dir:sub_type,path:file,remark:$("input.form-control").val()},(function(edata){if(layer.close(layerss),!edata.status)return layer.msg(edata.msg,{time:1900,icon:2}),!1;if(0==type){var new_back=that.backup_list();$(".buplist").html(new_back)}else if(3==type){var chmod=$("#access").val(),chown=$("#chown").val(),all=$("#accept_all").prop("checked")?"True":"False",data="filename="+encodeURIComponent(file)+"&user="+chown+"&access="+chmod+"&all="+all;Oksend(data),layer.closeAll()}layer.msg(edata.msg,{time:1900,icon:1})}))},btn2:function(){layer.close(layerss)},cancel:function(){layer.close(layerss)}})},backup_list:function(){var all_back="",that=this;this.$http("get_all_back",(function(edata){for(var i=0;i<edata.length;i++){var d=new Date(1e3*edata[i][2]),minut=d.getMinutes(),hours=d.getHours(),second=d.getSeconds();minut<=9&&(minut="0"+minut),hours<=9&&(hours="0"+hours),second<=9&&(second="0"+second);var date=d.getFullYear()+"/"+(d.getMonth()+1)+"/"+d.getDate()+" "+hours+":"+minut+":"+second;all_back+='<tr style="padding: 5px;margin: 0;border: #e6e6e6 1px solid;border-top: none;" data-id="'+edata[i][0]+'"> <td>'+date+'</td> <td style="max-width: 297px;min-width: 297px;"> <a style="width: 287px;overflow: hidden;text-overflow: ellipsis;white-space: nowrap;display: inline-block;" class="btlink" title="'+edata[i][3]+'" href="javascript:openPath(\''+edata[i][3]+"');\">"+edata[i][3]+'</a> </td> <td style="max-width: 77px;min-width: 77px;overflow: hidden;text-overflow: ellipsis;text-align: left;" title="'+edata[i][1]+'">'+edata[i][1]+'</td> <td style="min-width: 60px;text-align: center;"><a class="btlink del_back">Del</a></td> </tr>'}$(".allback .buplist").html(all_back)}))},manage_backup:function(){var that=this,layerss=layer.open({type:1,closeBtn:2,title:"Manage Backups",area:["630px","500px"],shadeClose:!1,content:'<div class="allback pd20" style="padding-bottom: 0;"> <div class="info-r c4 mb15 text-left relative"> <input class="bt-input-text" id="server_path" type="text" name="path" placeholder="Please select the project path" style="width:75%;"> <div style="display: inline-block;position: absolute;right:0;text-align: right;"> <span data-id="path" class="glyphicon cursor glyphicon-folder-open" style="margin-right: 31px;" onclick="ChangePath(\'server_path\',\'dir\')"></span> <button class="btn btn-success btn-sm btn-backup" id="btn-backup">Backup</button> </div> </div> <table class="text-left table table-hover" style="margin-bottom: 0;"> <thead style="background: #f6f6f6;margin: 0;border: #e6e6e6 1px solid;border-bottom: none;"> <tr> <th style="color: #666;font-weight: 600;padding: 10px 8px;width: 151px;border-bottom: none;">Backup time</th> <th style="color: #666;font-weight: 600;padding: 10px 8px;width: 290px;border-bottom: none;">Backup path</th> <th style="color: #666;font-weight: 600;padding: 10px 8px;text-align: center;border-bottom: none;">Name</th> <th style="color: #666;font-weight: 600;padding: 10px 8px;text-align: center;border-bottom: none;">Delect</th> </tr> </thead> </table> <div style="height: 337px;overflow: auto;"> <table class="text-left table table-hover"> <tbody class="buplist"></tbody> </table> </div> </div>',cancel:function(){layer.close(layerss)},success:function(){that.backup_list(),$("#btn-backup").click((function(e){var backup_path=$("#server_path").val();that.backup_files_permission(backup_path,0)})),$(".allback").on("click",".del_back",(function(){var _id=$(this).parents("tr").attr("data-id");that.del_backup(_id)}))}})},del_backup:function(id){var that=this;layer.confirm("The backup cannot be restored after deletion.<br>Continue to delete?",{title:"Confirm delete?",btn:["Yes","No"],closeBtn:2},(function(index,layero){that.$http("del_path_premissions",{id:id},(function(edata){var file=$(".layui-layer-title:eq(0)").text();"Manage Backups"!==file?(file=$(".backup_list").attr("data-path"),that.backup_files_list(file)):$(".allback tbody tr[data-id="+id+"]").remove(),layer.msg(edata.msg,{icon:edata.status?1:2})}))}))},backup_files_list:function(fileName){var that=this;that.$http("get_path_premissions",{path:fileName},(function(edata){var tbody="",cont="";if(0==edata.length)tbody='<tr><td colspan="5" align="center">No data</td></tr>';else for(var i=0;i<edata.length;i++){var d=new Date(1e3*edata[i][3]),minut=d.getMinutes(),hours=d.getHours();minut<=9&&(minut="0"+minut),hours<=9&&(hours="0"+hours);var date=d.getFullYear()+"/"+(d.getMonth()+1)+"/"+d.getDate();tbody+='<tr> <td><span style="display: inline-block;width: 60px; overflow: hidden;text-overflow: ellipsis;">'+edata[i][4]+"</span></td> <td>"+edata[i][2]+"</td> <td>"+edata[i][1]+"</td> <td>"+date+'</td> <td style="color: #666;text-align: right;"><a data-time="'+edata[i][3]+'" class="btlink restore_backup">Restore</a> | <a data-id="'+edata[i][5]+'" class="btlink del_back">Del</a></td> </tr>'}cont='<div class="divtable" style="height: 260px; overflow: auto;padding:11px 13px 3px;"> <div class="info-title-tips" style="text-align:left;margin-bottom: 7px;"> <span class="glyphicon glyphicon-alert" style="color: #f39c12; margin-right: 5px;"></span> <span>Fix all permissions to [ Folder: 755, File: 644 ]</span> <button class="manage btn btn-default btn-sm btn-success fixper" style="padding:6px;margin-left: 7px;">Fix permissions</button> </div> <table width="100%" border="0" cellpadding="0" cellspacing="0" class="table table-hover"> <thead> <tr> <th width="60">Name</th> <th width="35">permission</th> <th width="45">Owner</th> <th>Backup Time</th> <th style="text-align: right;">Opt</th> </tr> </thead> <tbody class="backup_list" data-path="'+fileName+'"> '+tbody+" </tbody> </table> </div>",$(".chmodset").hide(),$(".backup_lists").html(cont),$(".fixper").click((function(){layer.confirm("Note: Under the file or folder all permissions will be fixed to [ Folder: 755, File: 644 ]",{title:"Fix Permissions?",btn:["Confirm","Cancel"],closeBtn:2},(function(index,layero){that.$http("fix_permissions",{path:fileName},(function(res){layer.closeAll(),that.reader_file_list({path:that.file_path,is_operating:!1}),layer.msg(res.msg,{icon:res.status?1:2})}))}))})),$(".restore_backup").click((function(){that.restore_file_permission($(this).attr("data-time"),fileName)})),$(".backup_list").on("click",".del_back",(function(){var _id=$(this).attr("data-id");that.del_backup(_id)}))}))},restore_file_permission:function(restore_time,fileName){var that=this,sub_type=$("#accept_all").prop("checked")?1:0,layerss=layer.open({type:1,closeBtn:2,title:"Confirm restore",area:"330px",shadeClose:!1,btn:["Yes","No"],content:'<div style="padding: 20px;font-size: 14px;"> Restore would overwrite the current settings, continue? </div>',yes:function(layerss,index){that.$http("restore_path_permissions",{restore_sub_dir:sub_type,date:restore_time,path:fileName},(function(edata){layer.closeAll(),layer.msg(edata.msg,{icon:1,time:1900})}))},btn2:function(){layer.close(layerss)},cancel:function(){layer.close(layerss)}})},get_present_task_view:function(){this.file_present_task=layer.open({type:1,title:"Real-time task queue",area:"500px",closeBtn:2,skin:"present_task_list",shadeClose:!1,shade:!1,offset:"auto",content:'<div style="margin: 10px;" class="message-list"></div>'})},render_present_task_list:function(){var that=this;this.get_task_req({status:-3},(function(lists){if(0==lists.length)return layer.close(that.file_present_task),that.file_present_task=null,void that.reader_file_list({path:that.file_path,is_operating:!1});var task_body="",is_add=!1;$.each(lists,(function(index,item){-1==item.status?(that.file_present_task||that.get_present_task_view(),"1"==item.type?task_body+='<div class="mw-con"> <ul class="waiting-down-list"> <li> <div class="down-filse-name"><span class="fname" style="width:80%;" title="'+lan.layout.download+item.shell+'">'+lan.layout.download+item.shell+'</span><span style="position: absolute;left: 84%;top: 25px;color: #999;">'+item.log.pre+'%</span><span class="btlink" onclick="bt_file.remove_present_task('+item.id+')" style="position: absolute;top: 25px;right: 20px;">'+lan.public.cancel+'</span></div> <div class="down-progress"><div class="done-progress" style="width:'+item.log.pre+'%"></div></div> <div class="down-info"><span class="total-size"> '+item.log.used+"/"+ToSize(item.log.total)+'</span><span class="speed-size">'+(0==item.log.speed?lan.layout.connect:item.log.speed)+'/s</span><span style="margin-left: 20px;">'+lan.files.expected_to_be+": "+item.log.time+"</span></div> </li> </ul> </div>":task_body+='<div class="mw-title"><span style="max-width: 88%;display: block;overflow: hidden;text-overflow: ellipsis;white-space: nowrap;">'+item.name+": "+item.shell+'</span><span class="btlink" onclick="bt_file.remove_present_task('+item.id+')" style="position: absolute;top: 10px;right: 15px;">'+lan.public.cancel+'</span></div> <div class="mw-con codebg"> <code>'+item.log+"</code> </div>"):(is_add||(task_body+='<div class="mw-title">'+lan.layout.wait_task+'</div><div class="mw-con"><ul class="waiting-list">',is_add=!0),task_body+='<li><span class="wt-list-name" style="width: 90%;">'+item.name+": "+item.shell+'</span><span class="mw-cancel" onclick="bt_file.remove_present_task('+item.id+')">X</span></li>')})),that.file_present_task&&(is_add&&(task_body+="</ul></div>"),$(".message-list").html(task_body)),setTimeout((function(){that.render_present_task_list()}),1e3)}))},remove_present_task:function(id){var that=this;layer.confirm("Do you want to cancel the upload of files? It need to delete the uploaded files manually. Continue?",{title:"Cancel file upload",icon:0},(function(indexs){bt.send("remove_task","task/remove_task",{id:id},(function(rdata){layer.msg(rdata.msg,{icon:1}),layer.close(that.file_present_task),that.file_present_task=null})),layer.close(indexs)}))},edit_access_authority:function(){for(var access=$("#access").val(),idName=["owner","group","public"],n=0;n<idName.length;n++)$("#"+idName[n]+"_x").prop("checked",!1),$("#"+idName[n]+"_w").prop("checked",!1),$("#"+idName[n]+"_r").prop("checked",!1);for(var i=0;i<access.length;i++){var onacc=access.substr(i,1);if(!(i>idName.length))switch(onacc>7&&$("#access").val(access.substr(0,access.length-1)),onacc){case"1":$("#"+idName[i]+"_x").prop("checked",!0);break;case"2":$("#"+idName[i]+"_w").prop("checked",!0);break;case"3":$("#"+idName[i]+"_x").prop("checked",!0),$("#"+idName[i]+"_w").prop("checked",!0);break;case"4":$("#"+idName[i]+"_r").prop("checked",!0);break;case"5":$("#"+idName[i]+"_r").prop("checked",!0),$("#"+idName[i]+"_x").prop("checked",!0);break;case"6":$("#"+idName[i]+"_r").prop("checked",!0),$("#"+idName[i]+"_w").prop("checked",!0);break;case"7":$("#"+idName[i]+"_r").prop("checked",!0),$("#"+idName[i]+"_w").prop("checked",!0),$("#"+idName[i]+"_x").prop("checked",!0)}}},get_file_authority:function(data,callback){this.$http("GetFileAccess",{filename:data.path},(function(rdata){callback&&callback(rdata)}))},set_dir_kill:function(data){var that=this;"php"==data.ext?that.$http("file_webshell_check",{filename:data.path},(function(rdata){layer.msg(rdata.msg,{icon:rdata.status?1:2})})):layer.confirm("目录查杀将包含子目录中的php文件,是否操作?",{title:"目录查杀["+data.filename+"]",closeBtn:2,icon:3},(function(index){that.$http("dir_webshell_check",{path:data.path},(function(rdata){layer.msg(rdata.msg,{icon:rdata.status?1:2})}))}))},path_resolve:function(paths,param){var path="",split="";return Array.isArray(param)||(param=[param]),paths.replace(/([\/|\/]*)$/,(function($1){return split=$1,"www"})),$.each(param,(function(index,item){path+="/"+item})),(paths+path).replace("//","/")},get_ext_name:function(fileName){for(var extArr=fileName.split("."),exts=["folder","folder-unempty","sql","c","cpp","cs","flv","css","js","htm","html","java","log","mht","php","url","xml","ai","bmp","cdr","gif","ico","jpeg","jpg","JPG","png","psd","webp","ape","avi","mkv","mov","mp3","mp4","mpeg","mpg","rm","rmvb","swf","wav","webm","wma","wmv","rtf","docx","fdf","potm","pptx","txt","xlsb","xlsx","7z","cab","iso","rar","zip","gz","bt","file","apk","bookfolder","folder-empty","fromchromefolder","documentfolder","fromphonefolder","mix","musicfolder","picturefolder","videofolder","sefolder","access","mdb","accdb","fla","doc","docm","dotx","dotm","dot","pdf","ppt","pptm","pot","xls","csv","xlsm"],extLastName=extArr[extArr.length-1],i=0;i<exts.length;i++)if(exts[i]==extLastName)return exts[i];return"file"},get_path_filename:function(path){var paths=path.split("/");return paths[paths.length-1]},retrun_prev_path:function(path){var dir_list=path.split("/");return dir_list.splice(dir_list.length-1),""==dir_list&&(dir_list=["/"]),dir_list.join("/")},path_check:function(path){return"/"===(path=path.replace("//","/"))?path:path=path.replace(/\/+$/g,"")},get_file_access:function(data,callback){var that=this;this.layerT=bt.load("Getting file permissions, please wait..."),bt.send("GetFileAccess","files/GetFileAccess",{path:data.path},(function(res){that.loadT.close(),callback&&callback()}))},create_download_url:function(data,callback){var that=this;this.layerT=bt.load("sharing file, please wait..."),bt.send("create_download_url","files/create_download_url",{filename:data.filename,ps:data.ps,password:data.password,expire:data.expire},(function(res){that.layerT.close(),callback&&callback(res)}))},get_download_url_find:function(data,callback){var that=this;this.layerT=bt.load("Getting sharing file datals, please wait..."),bt.send("get_download_url_find","files/get_download_url_find",{id:data.id},(function(res){that.layerT.close(),callback&&callback(res)}))},remove_download_url:function(data,callback){var that=this;layer.confirm("Comfirm to stop sharing【"+data.fileName+"】, continue?",{title:"Cancel sharing",closeBtn:2,icon:3},(function(){this.layerT=bt.load("Canceling sharing files, please wait..."),bt.send("remove_download_url","files/remove_download_url",{id:data.id},(function(res){callback&&callback(res)}))}))},get_disk_list:function(callback){bt_tools.send("system/GetDiskInfo",(function(res){callback&&callback(res)}),"Getting disk list, please wait...")},create_file_req:function(data,callback){var _req="folder"===data.type?"CreateDir":"CreateFile";bt.send(_req,"files/"+_req,{path:data.path},(function(res){callback&&callback(res)}))},rename_file_req:function(data,callback){bt_tools.send("files/MvFile",{sfile:data.sfile,dfile:data.dfile,rename:data.rename||!0},(function(res){callback&&callback(res)}),"Renaming")},shear_file_req:function(data,callback){this.rename_file_req({sfile:data.sfile,dfile:data.dfile,rename:!1},(function(res){callback&&callback(res)}),"Cutting")},check_exists_files_req:function(data,callback){var layerT=bt.load("Checking files, please wait...");bt.send("CheckExistsFiles","files/CheckExistsFiles",{dfile:data.dfile,filename:data.filename},(function(res){layerT.close(),callback&&callback(res)}))},copy_file_req:function(data,callback){bt.send("CopyFile","files/CopyFile",{sfile:data.sfile,dfile:data.dfile},(function(res){callback&&callback(res)}))},compress_file_req:function(data,callback){bt.send("Zip","files/Zip",{sfile:data.sfile,dfile:data.dfile,z_type:data.z_type,path:data.path},(function(res){callback&&callback(res)}))},get_task_req:function(data,callback){bt.send("get_task_lists","task/get_task_lists",{status:data.status},(function(res){callback&&callback(res)}))},get_file_access:function(){bt.send("GetFileAccess","files/GetFileAccess",{filename:data.filename},(function(res){callback&&callback(res)}))},set_file_access:function(){bt.send("SetFileAccess","files/SetFileAccess",{filename:data.filename,user:data.user,access:data.access,all:data.all},(function(res){callback&&callback(res)}))},del_file_req:function(data,callback){var _req="dir"===data.type?"DeleteDir":"DeleteFile",layerT=bt.load("Deleting file, please wait...");bt.send(_req,"files/"+_req,{path:data.path},(function(res){layerT.close(),layer.msg(res.msg,{icon:res.status?1:2}),callback&&callback(res)}))},down_file_req:function(data,callback){window.open("/download?filename="+encodeURIComponent(data.path))},get_file_size:function(data,callback){bt_tools.send("files/get_path_size",{path:data.path},callback,"Getting directory size, please wait...")},get_dir_size:function(data,callback){bt_tools.send("files/GetDirSize",{path:data.path},(function(rdata){$("#file_all_size").text(rdata),callback&&callback(rdata)}),{tips:"Counting, please wait...",verify:!0})},get_dir_list:function(data,callback){var that=this,f_sort=bt.get_cookie("files_sort");f_sort&&(data.sort=f_sort,data.reverse=bt.get_cookie("name_reverse")),bt_tools.send("files/GetDir",$.extend({p:1,showRow:bt.get_storage("local","showRow")||this.file_page_num,path:bt.get_cookie("Path")||data.path},data),callback,{tips:!1})},compress_file_or_dir:function(data,isbatch){var that=this;$(".selection_right_menu").removeAttr("style"),this.reader_form_line({url:"Zip",overall:{width:"310px"},data:[{label:"Compress type",type:"select",name:"z_type",value:data.open,list:[["tar_gz","tar.gz"],["zip","zip"],["rar","rar"]]},{label:"Compress path",id:"compress_path",name:"dfile",placeholder:"URL address",value:data.path+"."+("tar_gz"==data.open?"tar.gz":data.open)}],beforeSend:function(updata){var ind=data.path.lastIndexOf("/"),_url=data.path.substring(0,ind+1);return{sfile:data.filename,dfile:updata.dfile,z_type:"tar_gz"==updata.z_type?"tar.gz":updata.z_type,path:_url}}},(function(form,html){var loadT=layer.open({type:1,title:"Compress "+data.type_tips+"[ "+data.filename+" ]",area:"520px",shadeClose:!1,closeBtn:2,skin:"compress_file_view",btn:["Compress","Close"],content:html[0].outerHTML,success:function(){$("select[name=z_type]").change((function(){var _type=$(this).val(),_inputVel=$("input[name=dfile]").val(),path_list=[];path_list=(_inputVel=_inputVel.substring(0,_inputVel.lastIndexOf("/"))).split("/"),$("input[name=dfile]").val(_inputVel+"/"+(isbatch?path_list[path_list.length-1]:data.filename)+"."+_type)})),$(".compress_file_view .line:nth-child(2)").find(".info-r").append('<span class="glyphicon glyphicon-folder-open cursor" style="margin-left: 10px;" onclick="ChangePath(\'compress_path\')"></span>')},yes:function(){var ress;if(""==form.getVal().dfile)return layer.msg("Please select a valid address",{icon:2});form.submitForm((function(res,datas){setTimeout((function(){that.reader_file_list({path:datas.path})}),1e3),null!=res&&null!=res||layer.msg(lan.files.zip_ok,{icon:1}),res.status&&that.render_present_task_list(),layer.close(loadT)}))}})}))},unpack_file_to_path:function(data){var that=this,_type="zip",spath="";spath=data.path.substring(0,data.path.lastIndexOf("/")),this.reader_form_line({url:"UnZip",overall:{width:"310px"},data:[{label:"File name",name:"z_name",placeholder:"Compress file name",value:data.path},{label:"Compress path",name:"z_path",placeholder:"Compress path",value:spath},{label:"Encoding",name:"z_code",type:"select",value:"UTF-8",list:[["UTF-8","UTF-8"],["gb18030","GBK"]]}],beforeSend:function(updata){return{sfile:updata.z_name,dfile:updata.z_path,type:_type,coding:updata.z_code,password:updata.z_password}}},(function(form,html){var loadT=layer.open({type:1,title:"Decompress file",area:"520px",shadeClose:!1,closeBtn:2,skin:"unpack_file_view",btn:["Comfirm","Cancel"],content:html[0].outerHTML,success:function(){"gz"==data.ext&&(_type="tar"),"zip"==_type&&$(".unpack_file_view .line:nth-child(2)").append('<div class="line"><span class="tname">Password</span><div class="info-r"><input type="text" name="z_password" class="bt-input-text " placeholder="No password let it empty" style="width:310px" value=""></div></div>')},yes:function(){var ress=form.getVal();return""==ress.z_name?layer.msg("Please enter the file name path",{icon:2}):""==ress.z_path?layer.msg("Please enter the decompression address",{icon:2}):void form.submitForm((function(res,datas){layer.close(loadT),setTimeout((function(){that.reader_file_list({path:datas.path})}),1e3),res.status&&that.render_present_task_list(),layer.msg(res.msg,{icon:res.status?1:2})}))}})}))},match_unqualified_string:function(item){var containSpecial;return RegExp(/[(\ )(\*)(\|)(\\)(\:)(\")(\/)(\<)(\>)(\?)(\)]+/).test(item)},reader_form_line:function(config,callback){var that=this,random=bt.get_random(10),html=$('<form id="'+random+'" class="bt-form pd20"></form>'),data=config,eventList=[],that=this;Array.isArray(config)||(data=config.data),$.each(data,(function(index,item){var labelWidth=item.labelWidth||config.overall.labelWidth||null,event_random=bt.get_random(10),width=item.labelWidth||config.overall.width||null,form_line=$('<div class="line"><span class="tname" '+(labelWidth?"width:"+labelWidth:"")+">"+(item.label||"")+'</span><div class="info-r"></div></div>'),form_el=$(function(){switch(item.type){case"select":return"<select "+(item.disabled?"disabled":"")+" "+(item.readonly?"readonly":"")+' class="bt-input-text mr5 '+(item.readonly?"readonly-form-input":"")+'" name="'+item.name+'" '+(item.eventType?'data-event="'+event_random+'"':"")+' style="'+(width?"width:"+width:"")+'">'+function(item){var options_list="";return $.each(item.list,(function(key,items){Array.isArray(items)?options_list+='<option value="'+items[0]+'" '+(item.value===items[0]?"selected":"")+">"+items[1]+"</option>":options_list+='<option value="'+items+'" '+(item.value===key?"selected":"")+">"+items+"</option>"})),options_list}(item)+"</select>";case"text":default:return"<input "+(item.disabled?"disabled":"")+" "+(item.readonly?"readonly":"")+" "+(item.eventType?'data-event="'+event_random+'"':"")+' type="text" name="'+item.name+'" '+(item.id?'id="'+item.id+'"':"")+' class="bt-input-text '+(item.readonly?"readonly-form-input":"")+'" placeholder="'+(item.placeholder||"")+'" style="'+(width?"width:"+width:"")+'" value="'+(item.value||"")+'"/>'}}(item));(item.eventType||item.event)&&(Array.isArray(item.eventType)||(item.eventType=[item.eventType]),$.each(item.eventType,(function(index,items){if(eventList.push({el:event_random,type:items||"click",event:item[items]||null}),config.el){var els=$('[data-event="'+item.el+'"]');if(item[items])"enter"==items?els.on("keyup",(function(e){13==e.keyCode&&item.event(e)})):els.on(item||"click",item.event);else if("focus"==items){var vals=els.val();""!=vals&&els.val("").focus().val(vals)}else els[items]()}}))),form_line.find(".info-r").append(form_el),html.append(form_line)})),config.el&&$(config.el).empty().append(html),callback&&callback({getVal:function(){return $("#"+random).serializeObject()},setEvent:function(){$.each(eventList,(function(index,item){var els=$('[data-event="'+item.el+'"]');if(null===item.event)if("focus"==item.type){var vals=els.val();""!=vals&&els.val("").focus().val(vals)}else els[item.type]();else"enter"==item.type?els.on("keyup",(function(e){13==e.keyCode&&item.event(e)})):els.on(item.type,item.event)}))},submitForm:function(callback){var data=this.getVal();config.beforeSend&&(data=config.beforeSend(data)),that.loadT=bt.load("submitting the form, please wait..."),bt.send(config.url,"files/"+config.url,data,(function(rdata){that.loadT.close(),callback&&callback(rdata,data)}))}},html)},$http:function(data,parem,callback){var that=this,loadT="";"string"==typeof data?("object"!=typeof parem&&(callback=parem,parem={}),Array.isArray(this.method_list[data])||(this.method_list[data]=["files",this.method_list[data]]),this.$http({method:data,tips:!!this.method_list[data][1]&&this.method_list[data][1],module:this.method_list[data][0],data:parem,msg:!0},callback)):(void 0!==data.tips&&data.tips&&(loadT=bt.load(data.tips)),bt.send(data.method,(data.module||"files")+"/"+data.method,data.data||{},(function(res){if(""!=loadT&&loadT.close(),"string"==typeof res&&(res=JSON.parse(res)),!1===res.status&&res.msg)return bt.msg(res),!1;parem&&parem(res)})))}};bt_file.init(),Function.prototype.delay=function(that,arry,time){return Array.isArray(arry)||(time=arry,arry=[]),void 0===time&&(time=0),setTimeout(this.apply(that,arry),time),this},jQuery.prototype.serializeObject=function(){var a,o,h,i,e;for(a=this.serializeArray(),h=(o={}).hasOwnProperty,i=0;i<a.length;i++)e=a[i],h.call(o,e.name)||(o[e.name]=e.value);return o}; |