One Hat Cyber Team
  • Dir : ~/www/server/panel/BTPanel/static/js/
  • Edit File: tools.min.js
    ";$.each(["blur","focus","input"],function(u,t){if(r.tips){var v=null;switch(t){case"blur":v=function(x,w){if($(this).val()===""){$(this).next().show()}layer.close(w.tips.loadT)};break;case"focus":v=function(x,w){$(this).next().hide();w.tips.loadT=layer.tips(p,$(this),{tips:[1,"#20a53a"],time:0,area:$(this).width()})};break}}d[r.name][t]?(d[r.name][t]["added"]=v):(d[r.name][t]={type:r.type,cust:false,event:r[t],added:v})});if(r.tips){var p="";if(typeof r.tips.list==="undefined"){p=r.tips.text}else{p=r.tips.list.join("
    ")}g+='
    "+p+"
    ";d[r.name+"_tips"]={click:{type:"textarea_tips",config:r}}}break;case"select":g+=h.$reader_select(r,j,k,f);h.event_list.custom_select={click:{type:"custom_select",children:".bt_select_value"}};h.event_list.custom_select_item={click:{type:"custom_select_item",children:"li.item"}};break;case"link":o="event_"+bt.get_random(6);g+='"+r.title+"";h.event_list[o]={click:{type:"link_event",event:r.event}};break;case"help":var l="";$.each(r.list,function(u,t){l+="
  • "+t+"
  • "});g+='";break}h.form_config[r.name]=r});$.extend(h.event_list,d);return g},$create_event_config:function(e){var d={};if(typeof e.name==="undefined"){return{}}$.each(this.event_type,function(g,f){if(e[f]){d[(f==="event"?"click":f)]={type:e.type,event:e[f],cust:(["select","checkbox","radio"].indexOf(e.type)>-1?true:false),config:e}}});return d},$reader_style:function(e){var d="";if(typeof e==="string"){return e}if(typeof e==="undefined"){return""}$.each(e,function(f,g){d+=f+":"+g+";"});return d},$local_refresh:function(e,d){this.element.find("[data-name="+e+"]").replaceWith(this.$reader_form_find(d))},$reader_select:function(l,d,e,j){var i=this,k="",h="",g={};if(!Array.isArray(l.list)){var f=l.list;bt_tools.send({url:f.url,data:f.param||{}},function(m){if(m.status!==false){l.list=l.list.dataFilter?l.list.dataFilter(m):m;i.$replace_render_content(j)}else{bt.msg(m)}})}$.each(l.list,function(n,m){try{if(m.value===l.value){g=m}else{g=l.list[0]}}catch(o){}k+='
  • '+m.title+"
  • ";h+='"});if(!g.title&&Array.isArray(l.list)){g=l.list[0]}return'
    '+(g.title||"Getting data...")+'
      '+(k||"")+"
    "+(h||"")+"
    "},$replace_render_content:function(e){var f=this,d=this.config.form[e];$("[data-form="+f.random+"]").find(".line:eq("+e+")").replaceWith(f.$reader_content_row(e,d))},$event_bind:function(f,g){var e=this,d={};e.element=$(typeof f==="object"?e.element:("[data-form="+e.random+"]"));if(typeof f==="undefined"){d=e.event_list}console.log(d);$.each(d,function(h,i){if($.isEmptyObject(i)){return true}$.each(i,function(l,j){var k="";if(typeof j.cust==="boolean"){k="["+(j.cust?"data-":"")+"name="+h+"]"}else{k="."+h}(function(m,n){if(m.onEvent===false){switch(m.type){case"input_checked":$(k).on(l!="event"?l:"click",function(o){m.event.apply(this,[o,e])});break}return true}else{e.element.on(l!="event"?l:"click",m.children?m.children:k,function(s){var r=e.$get_form_element(true),t=e.$get_form_value(),p=e.form_config[n];switch(m.type){case"textarea_tips":$(this).hide().prev().focus();break;case"custom_select":if($(this).parent().hasClass("bt-disabled")){return false}var o=$(this).next();if(!o.hasClass("show")){$(".bt_select_list").removeClass("show");o.addClass("show")}else{o.removeClass("show")}$(document).click(function(){e.element.find(".bt_select_list").removeClass("show");$(this).unbind("click");return false});return false;break;case"custom_select_item":p=e.form_config[$(this).parents(".bt_select_updown").attr("data-name")],item_config=p.list[$(this).index()];if($(this).hasClass("disabled")){$(this).parent().removeClass("show");if(item_config.tips){layer.msg(item_config.tips,{icon:2})}return true}if(!$(this).hasClass("active")&&!$(this).hasClass("disabled")){$(this).parent().prev().find(".bt_select_content").text($(this).text());$(this).addClass("active").siblings().removeClass("active");$(this).parent().next().val(item_config.value.toString());$(this).parent().removeClass("show");$(this).parent().next().trigger("change")}break;case"select_path":bt.select_path("event_"+$(this).prev().attr("name")+"_"+e.random,m.config.icon.select||"");break;case"checkbox":var q=$(this).is(":checked");if(q){$(this).prev().addClass("active")}else{$(this).prev().removeClass("active")}break}if(m.event){m.event.apply(this,[t,r,e,p,s])}if(m.added){m.added.apply(this,[s,p,r])}})}}(j,h))})});if(g){g()}},$get_form_value:function(){return this.element.serializeObject()},$set_find_value:function(e,g){var d={},f=this;typeof e!="string"?d=e:d[e]=g;$.each(d,function(h,i){f.form_element[h].val(i)})},$get_form_element:function(f){var e={},d=this;if(f||$.isEmptyObject(d.form_element)){this.element.find(":input").each(function(g){e[$(this).attr("name")]=$(this)});d.form_element=e;return e}else{return d.form_element}},$verify_group:function(d,f){var e=this,g="";$.each(f,function(h,i){if(typeof d[i]==="undefined"){return true}if(["disabled","readonly"].indexOf(i)>-1){g+=" "+(d[i]?(i+'="'+i+'"'):"")}else{g+=" "+i+'="'+d[i]+'"'}});return g},$verify_bind_event:function(e,g,f){var d={};$.each(f,function(i,h){var j=g[h];if(j){if(typeof d[e]==="object"){if(!Array.isArray(d[e])){d[e]=[d[e]]}d[e].push({event:j,eventType:h})}else{d[e]={event:j,eventType:h}}}});return d},$verify:function(f,d,e){if(!f){return""}if(e===true){return f?" "+d:""}if(e==="style"){return d?d+":"+f+";":f}return d?" "+d+'="'+f+'"':" "+f},$verify_form:function(){var k={},e=this.config.form,j=this.$get_form_value(),g=this.$get_form_element(true);for(var m=0;m'+l.title+"";g+='
    '+(m?l.content:"")+"
    "});i.element=$('
    '+h+'
    '+g+"
    ");return i.element[0].outerHTML},$reader_find:function(){},$event_bind:function(){var e=this,d=e.theme,f=d.active||"active";if(!e.el){e.element=$("#tab_"+e.random)}e.element.on("click",("."+d.nav.replace(/\s+/g,".")+" span"),function(){var h=$(this).index(),g=e.config.list[h];$(this).addClass(f).siblings().removeClass(f);$("."+d.body+">div:eq("+h+")").addClass(f).siblings().removeClass(f);e.active=h;if(!g.init){$("."+d.body+">div:eq("+h+")").html(g.content);if(g.success){g.success()}g.init=true}})}};return new c(a)},load:function(b){var a=layer.msg(b+",please wait...",{icon:16,time:0,shade:0.3});if(b===true){a=layer.load()}return{close:function(){layer.close(a)}}},open:function(a){var d={},c=null,b=null;d=$.extend({type:1,area:"640px",closeBtn:2,btn:["Yes","No"]},a);if(typeof d.content=="object"){var e=d.content;b=bt_tools.form(e);d.success=function(f,g){b.$event_bind();if(typeof d.init!="undefined"){d.init(f,g)}};d.yes=function(i,f){var g=b.$verify_form();if(!g){return false}if(typeof a.yes!="undefined"){var h=a.yes.apply(b,[g,i,f]);if(!h){return false}}};d.content=b.$reader_content()}c=layer.open(d);return{close:function(){layer.close(c)},form:b}},msg:function(e,c){var b=null,d="",a={};if(typeof e==="object"){if(typeof e.status==="boolean"){d=e.msg,a={icon:e.status?1:2}}}if(typeof e==="string"){d=e,a={icon:typeof c!=="undefined"?c:1}}b=layer.msg(d,a);return{close:function(){layer.close(b)}}},$verify:function(c,a,b){if(!c){return""}if(b===true){return c?" "+a:""}if(b==="style"){return a?a+":"+c+";":c}return a?" "+a+'="'+c+'"':" "+c},select_path:function(a,f,d,b){if(typeof d!=="number"){d=1}if(typeof b!=="number"){b=false}bt.set_cookie("Path","/www/server/panel/BTPanel/static");var e=this,c={type:d,type_tips:d==0?"目录":(d==1?"文件":"目录或文件"),type_limit:d==0?"dir":(d==1?"file":"all"),select_list:[],select_path:bt.get_cookie("Path")||(bt.os=="Windows"?setup_path:"/www/wwwroot"),select_config:{},scroll_width:0,file_path:bt.get_cookie("Path"),file_operating:[],area:[window.innerWidth,window.innerHeight],reader_view:function(){var g=this;this.scroll_width=c.getScrollbarWidth();layer.open({type:1,title:a.title||("选择"+g.type_tips),shadeClose:false,closeBtn:2,area:["650px","555px"],content:'
    名称修改时间类型
    文件修改时间类型
    '+g.type_tips+'名:
    ',success:function(){g.render_file_list();$(".select_list_thaed").css("right",g.scroll_width+"px")}})},render_file_list:function(j,l){var h="",i="",k=this,g={path:this.select_path,sort:"type",disk:true};if(typeof j=="undefined"){j=g}if(typeof j=="function"){l=j,j=g}k.select_config=$.extend(g,j);e.$http("GetDir",k.select_config,function(n){var m=n.DISK,o=$.merge(k.data_reconstruction(n.DIR,"DIR"),k.data_reconstruction(n.FILES));k.select_list=o;k.render_path_list();$.each(m,function(q,r){var p=(r.path=="/"?"根目录":r.path.indexOf(":/")>-1?("本地磁盘("+r.path.match(/[A-Z]+/)[0])+":)":r.path);h+='
    '+p+"
    "});$.each(o,function(q,s){if((k.type==0)&&s.type!=k.type_limit){return true}var p=bt.format_data(s.mtime),r=(s.type=="dir"?"文件夹":"文件");i+=' '+s.filename+" "+p+" "+(s.type=="dir"?"文件夹":"文件")+" "});$("#select_mount_list").html(h);$("#select_dir_list").html(i);if(l){l(n)}})},data_reconstruction:function(i,h,j){if(i.length<1){return[]}var g=[];$.each(i,function(k,n){var l=n.split(";"),o="",p=l[0].split("."),m=p[p.length-1];switch(l[0]){case".user.ini":o="PS: PHP用户配置文件(防跨站)!";break;case".htaccess":o="PS: Apache用户配置文件(伪静态)";break;case"swap":o="PS: 宝塔默认设置的SWAP交换分区文件";break}if(l[0].indexOf("Recycle_bin")!=-1){o="PS: 回收站目录,勿动!"}if(l[0].indexOf(".upload.tmp")!=-1){o="PS: 宝塔文件上传临时文件,重新上传从断点续传,可删除"}g.push({caret:l[8]=="1"?true:false,down_id:l[9],ext:(h=="DIR"?"":m),filename:l[0],mtime:l[2],ps:o||l[10],size:l[1],type:h=="DIR"?"dir":"file",user:l[3],root_level:l[4]})});return g},render_path_list:function(o){var n=this,k='
    ',h="",m=this.file_path.split("/").splice(1),l=this.file_path.split("/")[0];if(bt.os==="Windows"){if(m.length==0){m=[]}m.unshift('本地磁盘('+l+")")}else{if(this.file_path=="/"){m=[]}m.unshift("根目录")}for(var j=0;j '+m[j]+'
    '}$(".path_input").val("").attr("data-path",this.file_path);var g=$(".file_path_input .file_dir_view");g.html(k);g.attr("data-width",g.width());n.set_dir_view_resize()},set_select_width:function(j,i){var k=this,h=".select_dir_list tbody td:nth-child("+(j+1)+")>span,.select_dir_list thead th:nth-child("+(j+1)+")>span",g=$("#th-index-"+j);if(g.length>0){g.html(h+"{"+i+"}")}else{$("#select_file_style").append('")}},cut_style_object:function(h){var g={},i=h.split(";");console.log(i);return g},getScrollbarWidth:function(){var k=document.createElement("div"),j={width:"100px",height:"100px",overflowY:"scroll"},g,h;for(g in j){k.style[g]=j[g]}document.body.appendChild(k);h=k.offsetWidth-k.clientWidth;k.remove();return h},set_dir_view_resize:function(){var i=$(".file_path_input"),g=$(".file_path_input .file_dir_view"),k=g.attr("data-width"),j=null;if(k){parseInt(k)}else{k=g.width();g.attr("data-width",k)}if(g.width()-k<90){var h=0;$($(".file_path_input .file_dir_view .file_dir_item").toArray().reverse()).each(function(){var l=0;if(!$(this).attr("data-width")){$(this).attr("data-width",$(this).width());l=$(this).width()}else{l=parseInt($(this).attr("data-width"))}h+=l;if((i.width()-h)<=90){$(this).addClass("hide")}else{$(this).removeClass("hide")}})}var j=g.children(".file_dir_item.hide").clone(true);if(g.children(".file_dir_item.hide").length==0){i.removeClass("active").find(".file_dir_omit").addClass("hide")}else{j.each(function(){if($(this).find(".glyphicon-hdd").length==0){$(this).find(".file_dir").before('')}});i.addClass("active").find(".file_dir_omit").removeClass("hide");i.find(".file_dir_omit .nav_down_list").empty().append(j);i.find(".file_dir_omit .nav_down_list .file_dir_item").removeClass("hide")}},reader_file_list:function(h,k){var j=this,g="",i="";if(typeof h==="function"){k=h,h={is_operating:false}}if(typeof h==="undefined"){h={is_operating:false}}if(b){layer.msg("只能在该目录下操作",{icon:2});return false}this.loadT=bt.load("正在获取文件列表,请稍候...");this.file_images_list=[];j.get_dir_list(h,function(n){j.loadT.close();j.file_list=$.merge(j.data_reconstruction(n.DIR,"DIR"),j.data_reconstruction(n.FILES));j.file_path=n.PATH;j.is_recycle=n.FILE_RECYCLE;j.file_store_list=n.STORE;bt.set_cookie("Path",n.PATH);var m="",p="",q=n.DISK,r=j.file_list;j.select_list=j.file_list;j.render_path_list();$.each(q,function(t,u){var s=(u.path=="/"?"根目录":u.path.indexOf(":/")>-1?("本地磁盘("+u.path.match(/[A-Z]+/)[0])+":)":u.path);m+='
    '+s+"
    "});$.each(r,function(t,v){if((j.type==0)&&v.type!=j.type_limit){return true}var s=bt.format_data(v.mtime),u=(v.type=="dir"?"文件夹":"文件");p+=' '+v.filename+" "+s+" "+(v.type=="dir"?"文件夹":"文件")+" "});$("#select_mount_list").html(m);$("#select_dir_list").html(p);var o=n.PATH.lastIndexOf("/"),l=n.PATH.substring(o+1,n.PATH.length);if(k){k(rdata)}})},reader_file_list_content:function(i,k){var g="",j=this,h=0;$.each(i,function(l,n){var m=n.filename+n.ps;j.file_list[l]=n=j.$file_data_dispose(n);j.file_list[l]["only_index"]=l;if(n.filename.indexOf("Recycle_bin")){_tips="PS: 回收站目录,勿动!"}if(m.length>20){m=m.substring(0,20)+"..."}if(bt.check_chinese(m)&&m.length>10){m=m.substring(0,10)+"..."}g+='
    '+n.filename+n.ps+""+(n.caret?'':"")+(n.down_id?'':"")+'
    '+n.type_tips+'
    '+(n.type=="dir"?'点击计算':bt.format_size(n.size))+'
    '+bt.format_data(n.mtime)+"
    ";if(n.type=="dir"){h++}if(n.ispreview){j.file_images_list.push(n.path);if(typeof n.images_id){n.images_id=j.file_images_list.length-1}}});$(".file_list_content").html(g);if(k){k({is_dir_num:h})}},$file_data_dispose:function(g){var h={languages:null,model:null};return $.extend(g,{only_id:bt.get_random(10),type_tips:g.type==="dir"?"文件夹":this.ext_type_tips(g.ext),open_type:this.determine_file_type(g.ext),languages:h.languages,path:g.path||this.path_resolve(this.file_path,g.filename),model:h.model})},path_resolve:function(j,i){var h="",g="";if(!Array.isArray(i)){i=[i]}j.replace(/([\/|\/]*)$/,function(k){g=k;return"www"});$.each(i,function(k,l){h+="/"+l});return j+h},$get_file_model:function(k){var h=this.vscode_editor.config;for(languages in h.supportedModes){var i=h.supportedModes[languages];for(var g=0;g'+(k.path=="/"?"根目录":k.path)+" ("+k.size[2]+")"});$(".mount_disk_list").html(g)})},determine_file_type:function(j,i){var g={images:["jpg","jpeg","png","bmp","gif","tiff","ico"],compress:["zip","rar","gz","war","tgz"],video:["mp4","mpeg","mpg","mov","avi","webm","mkv"],ont_text:["iso","xlsx","xsl","doc","docx","tiff","exe","so","7z","bz","dmg","apk"]},h=false;if(i!=undefined){if(i=="text"){$.each(g,function(k,l){$.each(l,function(n,m){if(m==j){h=true;return false}})});h=!h}else{if(typeof g[i]=="undefined"){return false}$.each(g[i],function(k,l){if(l==j){h=true;return false}})}}else{$.each(g,function(k,l){$.each(l,function(n,m){if(m==j){h=k;return false}})});if(typeof h=="boolean"){h="text"}}return h},render_file_groud_menu:function(l,g){var j=this,k=$(g).data("index"),h=j.file_list[k],o=[["open","打开"],["split",""],["download","下载"],["share","分享目录/文件"],["cancel_share","取消分享"],["favorites","收藏目录/文件"],["cancel_favorites","取消收藏"],["split",""],["dir_kill","目录查杀"],["authority","权限"],["split",""],["copy","复制"],["shear","剪切"],["rename","重命名"],["del","删除"],["split",""],["killing","创建压缩",[["gzip","tar.gz (推荐)"],["zip","zip (通用格式)"],["rar","rar (中文兼容较好)"]]],["unzip","解压",[["local","解压到当前"],["folad","解压到当前"]]]],n=["zip","rar","gz","war","tgz","bz2"],m=0;if(h.type=="dir"){o.splice(2,1);m++}if(h.down_id!==0){o.splice(3-m,1);m++}else{o.splice(4-m,1);o[3-m][1]=(h.type=="dir"?"分享目录":"分享文件");m++}if(h.caret!==false){o.splice((5-m),1);m++}else{o.splice((6-m),1);o[5-m][1]=(h.type=="dir"?"收藏目录":"收藏文件");m++}if(h.ext!="php"&&h.type!="dir"){o.splice((8-m),1);m++}var i=0;$.each(n,function(p,q){if(q==h.ext){i++}});if(i==0){o.splice((17-m),1);m++}j.reader_menu_list({el:$(".selection_right_menu"),ev:l,data:h,list:o})},render_file_all_menu:function(i,h){var k=this,j=[["refresh","刷新"],["split",""],["upload","上传"],["create","新建文件夹/文件",[["create_dir","新建文件夹"],["create_files","新建文件"]]],["split",""],["paste","粘贴"]],g=0;if(!bt.get_storage("session","copy_path")){j.splice(5,1);g++}k.reader_menu_list({el:$(".selection_right_menu"),ev:i,data:{},list:j})},get_dir_list:function(h,j,g){var i=this;if(typeof j==="boolean"){g=j,j=null}e.$http("GetDir",$.extend({disk:true,path:i.file_path,sort:bt.get_cookie("files_sort")||"type"},h),j,g)},retrun_prev_path:function(g){var h=g.split("/");h.splice(h.length-1);return h.join("/")},reader_menu_list:function(h){var l=this,j=h.el.find("ul"),i=j.height(),g=j.width(),k=h.ev.clientX-((this.area[0]-h.ev.clientX)')}else{if(Array.isArray(p[2])){m=$('
      ');n=m.find(".set_group");$.each(p[2],function(r,q){n.append($('
    • '+q[1]+"
    • ").on("click",{type:q[0],data:h.data},function(s){l.file_groud_event($.extend(s.data.data,{open:s.data.type,index:parseInt($(h.ev.currentTarget).data("index")),element:h.ev.currentTarget,type_tips:p.type?"文件夹":"文件"}));h.el.removeAttr("style");s.stopPropagation();s.preventDefault()}))})}j.append($('
    • '+p[1]+"
    • ").append(m).on("click",{type:p[0],data:h.data},function(q){l.file_groud_event($.extend(q.data.data,{open:q.data.type,index:parseInt($(h.ev.currentTarget).data("index")),element:h.ev.currentTarget,type_tips:p.type?"文件夹":"文件"}));h.el.removeAttr("style");q.stopPropagation();q.preventDefault()}))}});h.el.css({left:k,top:h.ev.clientY-((this.area[1]-h.ev.clientY)0){$(".select_list_shadow").show()}else{$(".select_list_shadow").hide()}if(h>=0){$(".select_list_thaed").css("left",(4-h)+"px")}j.stopPropagation();j.preventDefault()});$(".file_path_refresh").on("click",function(){g.render_file_list()});$(".select_dir_list thead th .icon-drag").on("mousedown",function(m){var o=m.clientX,h=$(this).parent(),j=h.index(),p=h[0].clientWidth,i=parseInt($(this).parent().attr("data-min")),n=null;if(m.which===1){var l=function(t){var r=t.clientX,s=r-o,q=p+s;n=setTimeout(function(){g.set_select_width(j,"width:"+q+"px")},0)},k=function(){console.log(k);$(this).unbind(l);$(this).unbind(k)};$(document).on("mousemove",l).one("mouseup",function(){$(this).unbind(l);$(this).unbind(this)})}m.stopPropagation()});$(".select_dir_list thead th>span").on("click",function(j){var i=$(this).parent(),h=i.data("type"),k=i.hasClass("active"),l=i.hasClass("sort");if(k){i.addClass("sort").removeClass("active")}else{if(l){i.addClass("active").removeClass("sort")}else{i.addClass("active")}}i.siblings().removeClass("active sort");g.render_file_list({sort:h,reverse:k?1:0});j.stopPropagation()});$(".search_path_views input").on("keyup",function(){var h=$(this).val();console.log(h)});$(".search_path_views input").focus(function(){$(this).next().show()}).blur(function(){$(this).next().hide()});$("#select_file_directory .select_file_group").on("click",".select_btn_group .btn-success",function(h){var j=$('[name="select_name"]').val(),i="";if(j==""){layer.msg("只能选择"+g.type_tips,{icon:2})}else{i=g.file_path+"/"+j;console.log(i)}});$("#select_file_directory .select_file_tootls").on("click",".creat_dir",function(i){var h="   ";if($("#tbody tr").length==0){$("#select_dir_list").append(h)}else{$("#select_dir_list tr:first-child").before(h)}$(".newFolderName").focus();$("#nameOk").click(function(){var k=$("#newFolderName").val(),j=$(".file_path_views .path_input").attr("data-path");newTxt=j+"/"+k;e.$http("CreateDir",{path:newTxt},function(l){if(l.status==true){g.reader_file_list({path:j,is_operating:false});layer.msg(l.msg,{icon:1})}else{layer.msg(l.msg,{icon:2})}})})});$("#select_mount_list").on("click",".item",function(){g.reader_file_list({path:$(this).attr("data-menu"),is_operating:true})});$(window).resize(function(h){if($(this)[0].innerHeight!=g.area[1]){g.area[1]=$(this)[0].innerHeight;g.set_file_view()}if($(this)[0].innerWidth!=g.area[0]){g.area[0]=$(this)[0].innerWidth;g.set_dir_view_resize()}if(g.vscode_editor.view){if(g.vscode_editor.is_full_min>0){layer.style(g.vscode_editor.view,{top:0,left:0,width:g.area[0],height:g.area[1]})}}if(g.vscode_editor.view&&$.isEmptyObject(g.vscode_editor.list)){g.vscode.layout()}}).keydown(function(j){j=window.event||j;var i=j.keyCode,h=j.target.tagName.toLowerCase();if(i==8&&h!=="input"&&h!=="textarea"){if(g.vscode_editor.view==null){$(".forward_path span:eq(0)").click()}return false}});$(".file_path_input .path_input").on("focus blur keyup",function(i){i=i||window.event;var h=$(this).attr("data-path");switch(i.type){case"focus":$(this).addClass("focus").val(h).prev().hide();break;case"blur":$(this).removeClass("focus").val("").prev().show();break;case"keyup":if(i.keyCode!=13&&i.type=="keyup"){return false}var j=$(this);if($(this).data("path")!=$(this).val()){g.reader_file_list({path:$(this).val(),is_operating:true},function(k){if(k.status===false){$(j).val(h)}else{$(j).val(k.PATH);$(j).blur().prev().show()}})}break}i.stopPropagation()});$(".file_path_input .file_dir_view").on("click",".file_dir",function(){g.reader_file_list({path:$(this).attr("title"),is_operating:true})});$(".forward_path span").click(function(){var h=$(this).index(),i="";if(!$(this).hasClass("active")){switch(h){case 0:g.file_pointer=g.file_pointer-1;i=g.retrun_prev_path(g.file_path);break;case 1:g.file_pointer=g.file_pointer+1;i=g.file_path+"/"+$(".select_file_group .file_directory").val();break;case 2:g.file_pointer=g.file_pointer-1;i=g.retrun_prev_path(g.file_path);break}g.reader_file_list({path:i,is_operating:false})}});$(".file_path_input .file_dir_view").on("click",".file_dir_omit",function(i){var j=this,h=$(this).children(".nav_down_list");$(this).addClass("active");h.addClass("show");$(document).one("click",function(){$(j).removeClass("active");h.removeClass("show");i.stopPropagation()});i.stopPropagation()});$("#select_dir_list").on("dblclick","tr",function(j){if($(j.target).hasClass("file_check")){return false}var i=$(this).attr("data-path"),h=$(this).attr("data-type");if(h=="dir"){g.reader_file_list({path:g.file_path+"/"+i})}else{}j.stopPropagation();j.preventDefault()});$(".file_path_refresh").click(function(){g.reader_file_list({path:g.file_path})});$(".file_nav_view .upload_or_download").on("click",function(h){g.open_upload_view();h.stopPropagation();h.preventDefault()});$(".file_nav_view .upload_or_download li").on("click",function(i){var h=$(this).data("type");if(h==="uploadFile"){g.open_upload_view()}else{g.open_download_view()}i.stopPropagation();i.preventDefault()});$(".mount_disk_list").on("click",".nav_btn",function(){var h=$(this).data("menu");g.reader_file_list({path:h})});$(".file_list_header").on("click",".file_name,.file_size,.file_mtime,.file_accept,.file_user",function(j){var k=$(this).attr("data-tid"),h=$(this).find(".icon_sort").hasClass("active"),i=$(this).hasClass("active");if(!$(this).find(".icon_sort").hasClass("active")&&$(this).hasClass("active")){$(this).find(".icon_sort").addClass("active")}else{$(this).find(".icon_sort").removeClass("active")}$(this).addClass("active").siblings().removeClass("active").find(".icon_sort").removeClass("active").empty();$(this).find(".icon_sort").html('');if(!i){h=true}bt.set_cookie("files_sort",k);bt.set_cookie("name_reverse",h?1:0);g.reader_file_list();return false});$(".file_list_header .file_th").each(function(i,k){var h=bt.get_cookie("files_sort"),j=bt.get_cookie("name_reverse");if($(this).attr("data-tid")===h){$(this).addClass("active").siblings().removeClass("active").find(".icon_sort").removeClass("active").empty();$(this).find(".icon_sort").html('');if(j===0){$(this).find(".icon_sort").addClass("active")}}});$(".file_list_header .file_check").on("click",function(i){var h=parseInt($(this).data("checkbox"));switch(h){case 0:$(this).addClass("active").removeClass("active_2").data("checkbox",1);$(".file_list_content .file_tr").addClass("active").removeClass("active_2");g.file_table_arry=g.file_list;break;case 2:$(this).addClass("active").removeClass("active_2").data("checkbox",1);$(".file_list_content .file_tr").addClass("active");g.file_table_arry=g.file_list;break;case 1:$(this).removeClass("active active_2").data("checkbox",0);$(".file_list_content .file_tr").removeClass("active");g.file_table_arry=[];break}});$(".file_list_content").on("click",".file_check",function(l){var i=$(this).parents(".file_tr"),k=i.data("index"),h=$(".file_list_header .file_check"),j=i.attr("data-filename");$(".selection_right_menu").removeAttr("style");if(i.hasClass("active")){i.removeClass("active");g.remove_check_file(g.file_table_arry,"filename",j);if(g.file_table_arry.length>0){h.addClass("active_2").removeClass("active").data("checkbox",2)}else{if(g.file_table_arry.length==0){h.removeClass("active active_2").data("checkbox",0)}}}else{i.addClass("active");i.attr("data-filename",g.file_list[k]["filename"]);if(g.file_table_arry.length==g.file_list.length){h.addClass("active").removeClass("active_2").data("checkbox",1)}else{h.addClass("active_2").removeClass("active").data("checkbox",2)}g.file_table_arry.push(g.file_list[k])}l.stopPropagation()});$(".file_list_content").scroll(function(h){if($(this).scrollTop()==($(this)[0].scrollHeight-$(this)[0].clientHeight)){$(this).prev().css("opacity",1);$(this).next().css("opacity",0)}else{if($(this).scrollTop()>0){$(this).prev().css("opacity",1)}else{if($(this).scrollTop()==0){$(this).prev().css("opacity",0);$(this).next().css("opacity",1)}}}});$(".file_table_view .file_list_content").on("click",".file_tr",function(h){$(".selection_right_menu").removeAttr("style");$(this).find(".file_checkbox .file_check").click();h.stopPropagation();h.preventDefault()});$(".file_table_view .file_list_content").on("click",".file_title i",function(k){var i=$(this).parents(".file_tr"),h=i.data("index"),j=g.file_list[h];if(j.type=="dir"){g.reader_file_list({path:g.file_path+"/"+j.filename})}else{}k.stopPropagation()});$(".file_table_view .file_list_content").on("click",".file_name .icon-share1",function(k){var i=$(this).parents(".file_tr"),h=i.data("index"),j=g.file_list[h];g.info_file_share(j,i);k.stopPropagation()});$(".file_table_view .file_list_content").on("click",".file_name .icon-favorites",function(k){var i=$(this).parents(".file_tr"),h=i.data("index"),j=g.file_list[h];j.typeText=j.type?"文件夹":"文件";g.cancel_file_favorites(j,i);k.stopPropagation()});$(".file_table_view .file_list_content").on("dblclick",".file_tr",function(j){if($(j.target).hasClass("file_check")){return false}var h=$(this).data("index"),i=g.file_list[h];if(i.type=="dir"){g.reader_file_list({path:g.file_path+"/"+i.filename})}else{}j.stopPropagation();j.preventDefault()});$(".file_list_content").on("contextmenu",".file_tr",function(i){var h=this;if(i.which==3){g.render_file_groud_menu(i,this);$(".content_right_menu").removeAttr("style");$(this).addClass("selected").siblings().removeClass("selected");$(document).one("click",function(j){$(h).removeClass("selected");$(".selection_right_menu").removeAttr("style");j.stopPropagation();j.preventDefault()})}i.stopPropagation();i.preventDefault()});$(".file_list_content").on("contextmenu",function(l){var h=$(".content_right_menu"),k=h.width(),j=h.height(),i=this;if(l.which==3){$(".selection_right_menu").removeAttr("style");g.render_file_all_menu(l,this)}l.stopPropagation();l.preventDefault()});$(".filePage").on("change",".showRow",function(){var h=$(this).val();bt.set_storage("showRow",h);g.reader_file_list()});$(".file_list_content").on("click",".folder_size",function(i){var h=j.file_list[$(this).parents(".file_tr").data("index")],j=this;j.get_file_size({path:h.path},function(k){$(j).text(bt.format_size(k.size))});i.stopPropagation();i.preventDefault()});$(".cut_view_model").on("click",function(){var h=$(this).data("type");$(".file_table_view").addClass(h=="icon"?"icon_view":"list_view").removeClass(h!="icon"?"icon_view":"list_view");$(this).addClass("active").siblings().removeClass("active")})},set_file_forward:function(){var h=this,g=$(".forward_path span");console.log(h.file_operation);if(h.file_operating.length==1){g.addClass("active")}else{if(h.file_pointer==h.file_operating.length-1){g.eq(0).removeClass("active");g.eq(1).addClass("active")}else{if(h.file_pointer==0){g.eq(0).addClass("active");g.eq(1).removeClass("active")}else{g.removeClass("active")}}}},set_file_view:function(){var h=$(".file_list_content"),g=this.area[1]-170;$(".file_bodys").height(this.area[1]-100);if((this.file_list.length*50)>g){h.attr("data-height",h.data("height")||h.height()).height(g);$(".file_shadow_bottom").css("opacity",1)}else{h.height(g);$(".file_shadow_top,.file_shadow_bottom").css("opacity",0)}},clear_table_active:function(){this.file_table_arry=[];$(".file_list_header .file_check").removeClass("active active_2");$(".file_list_content .file_tr").removeClass("active")}};c.reader_view();c.event_bind()},$fixed_table_thead:function(a){$(a).scroll(function(){var b=this.scrollTop;this.querySelector("thead").style.transform="translateY("+b+"px)"})},send:function(g,e,c,b,a,l){var h={},k=null,i=null,f=[],j="";$.each(arguments,function(n,m){f.push([m,typeof m])});function d(n){try{k=f[n][1]=="function"?f[n][0]:null;m=f[(n+1)][1]=="function"?f[(n+1)][0]:null}catch(m){}}j=f[0];switch(j[1]){case"string":$.each(f,function(n,m){var p=m[0],o=m[1];if(n>1&&(o=="boolean"||o=="string"||o=="object")){var q=j[0].split("/");h.url="/"+q[0]+"?action="+q[1];h.load=p;if(o=="object"){h.load=p.load;h.tips=p.tips;h.verify=p.verify}return false}else{h.url=j[0]}});if(f[1][1]==="object"){h.data=f[1][0];d(2)}else{d(1)}break;case"object":h.url=j[0].url;h.data=j[0].data||{};$.each(f,function(n,m){var p=m[0],o=m[1];if(n>1&&(o=="boolean"||o=="string"||o=="object")){h.load=m;if(o=="object"){h.load=p.load;h.tips=p.tips}return true}});if(f[1][1]==="object"){h.data=f[1][0];d(2)}else{d(1)}break}if(h.load){h.load=this.load(h.load)}$.ajax({type:h.type||"POST",url:h.url,data:h.data||{},dataType:h.dataType||"JSON",complete:function(){if(h.load){h.load.close()}},success:function(m){if(h.verify){if(k){k(m)}return false}if(typeof m==="string"){layer.msg(m,{icon:2,time:0,closeBtn:2});return false}if(h.bacth){if(k){k(m)}return false}if(m.status===false){bt_tools.msg(m);return false}if(h.tips){bt_tools.msg(m)}if(k){k(m)}}})},command_line_output:function(b){var c=this,d=bt.get_random(15);function a(e){var i=this;for(var g in c.commandConnectionPool){var h=c.commandConnectionPool[g],f=$(h.config.el);if(e.shell===h.config.shell&&f.length){h.el=f;return h}}if(typeof e==="undefined"){e={}}this.config=$.extend({route:"/sock_shell"},e);this.xterm_config=$.extend(this.xterm_config,this.config.xterm);this.el=$(this.config.el);this.open=e.open;this.close=e.close;this.message=e.message;if(!this.config.hasOwnProperty("el")){c.msg({msg:"请输入选择器element,不可为空",status:false});return false}if(!this.config.hasOwnProperty("shell")){c.msg({msg:"请输入命令,不可为空",status:false});return false}if(this.config.hasOwnProperty("time")){setTimeout(function(){i.close_connect()},this.config.time)}this.init()}a.prototype={socket:null,socketToken:null,timeout:0,monitor_interval:2000,element_detection:null,uuid:d,fragment:[],error:0,init:function(){var e=bt.get_cookie("commandInputViewUUID"),f=this;if(!this.el[0]){if(this.error>10){return false}setTimeout(function(){f.init();this.error++},2000);return false}this.error=0;if(this.el[0].localName!=="pre"){this.el.append('
      ');this.el=this.el.find("pre");this.config.el=this.config.el+" pre"}else{this.el.addClass("command_output_pre")}if(Array.isArray(this.config.area)){this.el.css({width:this.config.area[0],height:this.config.area[1]})}else{this.el.css({width:"100%",height:"100%"})}if(e&&typeof c.commandConnectionPool[e]!="undefined"){c.commandConnectionPool[e].close_connect();delete c.commandConnectionPool[e]}bt.set_cookie("commandInputViewUUID",this.uuid);this.element_detection=setInterval(function(){if(!$(f.config.el).length){clearInterval(f.element_detection);f.close_connect()}},1*60*1000);this.set_full_screen();this.create_websocket_connect(this.config.route,this.config.shell);this.monitor_element()},create_websocket_connect:function(e,f){var g=this;this.socket=new WebSocket((location.protocol==="http:"?"ws://":"wss://")+location.host+e);this.socket.addEventListener("open",function(h){if(!this.socketToken){var i=document.getElementById("request_token_head").getAttribute("token");this.socketToken={"x-http-token":i}}this.send(JSON.stringify(this.socketToken));this.send(f);if(g.open){g.open()}});this.socket.addEventListener("close",function(h){if(h.code!==1000){g.socket=g.create_websocket_connect(g.config.route,g.config.shell)}if(g.close){g.close(h)}});this.socket.addEventListener("message",function(i){var h=i.data;if(!h){return}g.refresh_data(h);if(g.message){g.message(h)}});return this.socket},set_full_screen:function(){},refresh_data:function(e){this.fragment.push(e);if(this.fragment.length>=300){this.fragment.splice(0,150);this.el.html(this.fragment.join(""))}else{this.el.append(e)}this.el.scrollTop(this.el[0].scrollHeight)},monitor_element:function(){var e=this;this.monitor_interval=setInterval(function(){if(!e.el.length){e.close_connect();clearInterval(e.monitor_interval)}},e.config.monitorTime||2000)},close_connect:function(){this.socket.send("");this.socket.close();delete c.commandConnectionPool[this.uuid]}};this.commandConnectionPool[d]=new a(b);return this.commandConnectionPool[d]}};$.fn.serializeObject=function(){var a=Object.prototype.hasOwnProperty;return this.serializeArray().reduce(function(b,c){if(!a.call(b,c.name)){b[c.name]=c.value}return b},{})};