var bt_tools={commandConnectionPool:{},table:function(a){function b(c){this.config=c;this.$load()}b.prototype={style_list:[],event_list:{},checkbox_list:[],batch_active:{},event_rows_model:{},data:[],page:"",column:[],batch_thread:[],random:bt.get_random(5),init:false,checked:false,$load:function(){var d=this,c=$('');if(this.config.init){this.config.init(this)}$(this.config.el).addClass("bt_table").append(c);c.focus(function(){d.checked=true;return false}).blur(function(e){d.checked=false;if(d.checked_blur){d.checked_blur(e)}});if(this.config.minWidth){this.style_list.push({className:this.config.el+" table",css:("min-width:"+this.config.minWidth)})}if(this.config.tootls){this.$reader_tootls(this.config.tootls)}else{console.log(this.config.height);if($(d.config.el+".divtable").length===0){$(d.config.el).append('
')}}this.$reader_content();if(d.config.url!==undefined){this.$refresh_table_list()}else{if(this.config.data!==undefined){this.$reader_content(this.config.data)}else{alert(lan["public"].miss_data_or_url)}}if(this.config.methods){$.extend(this,this.config.methods)}},$refresh_table_list:function(d){var c=this,e;if(d){e=bt.load(lan.database.get_data)}this.$http(function(g,f){if(d){e.close()}c.$reader_content(g,f)})},$active_focus:function(d){var c=this;$("#checked_"+c.random).focus();this.checked_blur=function(e){setTimeout(function(){if(d){d(e)}delete c.checked_blur},200)}},$reader_content:function(u,h){var v=this,r="",c="",q=0,g=this.config.column,f={},n=$(v.config.el+" .checkbox_"+v.random);u=u||[];this.data=u;if(n.length){n.removeClass("active selected");v.checkbox_list=[];v.$set_batch_view()}do{var k=u[q],m=0;if(u.length>0){c+=""}for(var p=0;p"+(s.type=="checkbox"?'':""+s.title+"")+(s.sort?'':"")+"";if(q===0){if(!f[d]&&s.sort){f[d]={event:this.config.sortEvent,eventType:"click",type:"sort"}}if(!f[l]){f[l]={event:s.checked,eventType:"click",type:"checkbox"}}}}if(k!==undefined){var t="",e="event-"+s.fid+"-"+this.random;if(s.template){t=v.$custom_template_render(s,k,p)}else{t=this.$reader_column_type(s,k);f=$.extend(f,t[1]);t=t[0]}c+=""+t+"";if(q===0){if(!f[e]&&s.event){f[e]={event:s.event,eventType:"click",type:"rows"}}}}}if(u.length>0){c+=""}if(u.length==0){c+=''+(this.config["default"]||lan["public"].empty)+""}q++}while(q'+r+""+c+"")}else{$(this.config.el+" .divtable tbody").html(c);if(this.config.page&&h){$(this.config.el+" .page").replaceWith(this.$reader_page(this.config.page,h))}}this.init=true;if(this.config.success){this.config.success(this)}},$custom_template_render:function(g,h,d){var e="event-"+g.fid+"-"+this.random,f=g.template(h,d),c=$(f);if(c.length>0){template=c.addClass(e)[0].outerHTML}else{if(g.type==="text"){template=''+f+""}else{template=''+f+""}}return template},$modify_row_data:function(e){this.event_rows_model.rows=$.extend(this.event_rows_model.rows,e);var d=this.event_rows_model,c=null;if(typeof d.model.template!="undefined"){c=$(this.$custom_template_render(d.model,d.rows,d.index))}else{c=$(this.$reader_column_type(d.model,d.rows)[0])}d.el.replaceWith(c);d.el=c},$batch_success_table:function(c){var d=this;bt.open({type:1,title:c.title,area:c.area||["380px","350px"],shadeClose:false,closeBtn:2,content:c.content||'
'+c.title+" "+lan["public"].success+'
"+c.html+"
'+c.th+''+lan["public"].result+"
",success:function(){d.$fixed_table_thead(".fiexd_thead")}})},$delete_table_row:function(c){this.data.splice(c,1);this.$reader_content(this.data)},$fixed_table_thead:function(c){$(c).scroll(function(){var d=this.scrollTop;this.querySelector("thead").style.transform="translateY("+d+"px)"})},$set_batch_view:function(){var c=$(this.config.el+" .bt_select_value"),d=$(this.config.el+" .bt_table_select_group").next();if(typeof this.config.batch!="undefined"){var d=$(this.config.el+" .set_batch_option");if(typeof this.config.batch.config!="undefined"){if(this.checkbox_list.length>0){d.removeClass("bt-disabled btn-default").addClass("btn-success").text(lan["public"].please_choose+this.batch_active.title+"("+lan["public"].selected+this.checkbox_list.length+")")}else{d.addClass("bt-disabled btn-default").removeClass("btn-success").text(lan["public"].please_choose+this.batch_active.title)}}else{var c=$(this.config.el+" .bt_select_value");if(this.checkbox_list.length>0){d.removeClass("bt-disabled btn-default").addClass("btn-success").prev().removeClass("bt-disabled");c.find("em").html("("+lan["public"].selected+this.checkbox_list.length+")")}else{d.addClass("bt-disabled btn-default").removeClass("btn-success").prev().addClass("bt-disabled");c.children().eq(0).html(lan["public"].please_choose+"");c.next().find("li").removeClass("active");this.batch_active={}}}}},$reader_column_type:function(m,n){var l=n[m.fid],c={},i="",e=[],g=this;switch(m.type){case"text":e=[l,c];break;case"checkbox":e=['',c];break;case"password":var k="",j="",i="ico_"+g.random+"_",h='**********';if(m.eye_open){h+='';if(!c[i+"eye_open"]){c[i+"eye_open"]={type:"eye_open_password"}}}if(m.copy){h+='';if(!c[i+"copy"]){c[i+"copy"]={type:"copy_password"}}}e=[h,c];break;case"link":i="click_"+m.fid+"_"+this.random;if(!c[i]&&m.event){c[i]={event:m.event,type:"rows"}}e=[''+l+"",c];break;case"input":blurName="blur_"+m.fid+"_"+this.random;keyupName="keyup_"+m.fid+"_"+this.random;if(!c[blurName]&&m.blur){c[blurName]={event:m.blur,eventType:"blur",type:"rows"}}if(!c[keyupName]&&m.keyup){c[keyupName]={event:m.keyup,eventType:"keyup",type:"rows"}}e=['',c];break;case"status":var f="";i="click_"+m.fid+"_"+this.random;$.each(m.config.list,function(p,o){if(o[0]===l){f=o}});if(!c[i]&&m.event){c[i]={event:m.event,type:"rows"}}e=['-1?"":f[2])+'" style="'+(f[2].indexOf("#")>-1?("color:"+f[2]+";"):"")+'" href="javascript:;">'+f[1]+""+(m.config.icon?'':"")+"",c];break;case"switch":break;case"group":var d="";$.each(m.group,function(q,o){i=(m.fid?m.fid:"group")+"_"+q+"_"+g.random;if(o.template){var r=o.template(n,g),p=$(r);if(p.length>0){d+=p.addClass(i)[0].outerHTML}else{d+=''+r+""}}else{d+='"+o.title+""}d+=((m.group.length-1!=q)?" | ":"");if(!c[i]&&o.event){c[i]={event:o.event,type:"rows"}}});e=[d,c];break;default:e=[l,c];break}return e},$reader_tootls:function(f){var k=this,c={};function o(w,v){var x=bt.load(w.title+lan.site.executing),i={},u=k.$get_data_batch_list(w.paramId,v);if(!w.beforeRequest){i[w.paramName]=u.join(",")}else{i[w.paramName]=w.beforeRequest(v)}bt_tools.send({url:w.url||k.config.batch.url,data:$.extend(w.param||{},i)},function(z){x.close();if(!z.status){return false}if(typeof w.tips==="undefined"||w.tips){var y="";$.each(z.error,function(A,B){y+=""+A+'
'+B+"
"});$.each(z.success,function(A,B){y+=""+B+'
'+lan["public"].success+"
"});k.$batch_success_table({title:w.title,th:w.theadName,html:y});k.$refresh_table_list(true)}if(w.success){w.success(z,v,k)}})}function l(u,i,v){if(u.callback){u.callback({loadT:0,config:{},check_list:i,bacth_status:true,start_batch:function(w,y){var x=this;if(u.load){this.loadT=layer.msg(lan["public"].executeing+u.title+','+lan["public"].schedule+":0/"+this.check_list.length+","+lan["public"].please_wait+(u.clear?'cancel':""),$.extend({icon:16,skin:"batch_tips",shade:0.3,time:0},u.clear?{area:"420px"}:{}));$("#layui-layer"+x.loadT).on("click",".clear_batch",function(){x.clear_bacth()})}this.config={param:w,url:u.url};this.bacth(y)},bacth:function(w,z){var y=this,x={};if(typeof w==="function"){z=w,w=0}if(w'+lan["public"].executeing+u.title+','+lan["public"].schedule+":"+w+"/"+y.check_list.length+","+lan["public"].please_wait+(u.clear?'cancel':""))}bt_tools.send({url:this.config.url,data:this.config.param,bacth:true},function(A){$.extend(y.check_list[w],{request:{status:typeof A.status==="boolean"?A.status:false,msg:A.msg||lan["public"].request_error}});w++;y.bacth(w,z)})}else{if(v){v()}z(this.check_list);layer.close(this.loadT)}},clear_bacth:function(){this.bacth_status=false;layer.close(this.loadT)}})}else{if(!u.confirm){if(u.confirmVerify){bt.show_confirm(u.title+lan["public"].in_bulk,u.title+lan["public"].in_bulk+","+lan["public"].risk_prompt,o)}else{bt.confirm({title:u.title+lan["public"].in_bulk,msg:u.title+lan["public"].in_bulk+","+lan["public"].risk_prompt},function(){if(o){o(u,i)}})}}else{o(u,i)}}}for(var p=0;p'+i.title+""}else{r+='
';if(t.list){$.each(t.list,function(y,x){v+='
  • "+x[t.key]+"
  • "})}if(i.init){setTimeout(function(){i.init(w)},400)}}if(!c[w]){c[w]={event:i.event,type:"button"}}});break;case"search":this.config.search=t;var s="search_input_"+this.random,n="search_btn_"+this.random;r='';if(!c[s]){c[s]={eventType:"keyup",type:"search_input"}}if(!c[n]){c[n]={type:"search_btn"}}break;case"batch":this.config.batch=t;var h=[],e="",j=t.config;if(typeof t.config!="undefined"){k.batch_active=j;$(k.config.el).on("click",".set_batch_option",function(x){var w=[];for(var v=0;v'+v.title+""});delete i.group}else{h.push(i);e+='
  • '+i.title+"
  • "}});$(k.config.el).on("click",".bt_table_select_group .bt_select_value",function(x){var y=this,w=$(this).parent(),i=w.find(".bt_selects"),v=w.offset(),u=k.$get_win_area();if(w.hasClass("bt-disabled")){layer.tips(k.config.batch.disabledSelectValue,w,{tips:[1,"red"],time:2000});return false}if(w.hasClass("active")){w.removeClass("active")}else{w.addClass("active")}if(i.height()>(u[1]-v.top)){i.addClass("top")}else{i.removeClass("top")}$(document).one("click",function(){$(k.config.el).find(".bt_table_select_group").removeClass("active");return false});return false});$(k.config.el).on("click",".bt_table_select_group .item",function(u){var i=$(this).text(),v=$(this).index();$(this).addClass("active").siblings().removeClass("active");$(k.config.el+" .bt_select_tips").html(i+lan["public"].in_bulk+"("+lan.site.have_been_selected+k.checkbox_list.length+")");k.batch_active=h[v];if(!k.checked){$(".bt_table_select_group").removeClass("active")}});$(k.config.el).on("click",".set_batch_option",function(z){var y=[],x=k.batch_active;if($(this).hasClass("bt-disabled")){layer.tips(k.config.batch.disabledSelectValue,$(this),{tips:[1,"red"],time:2000});return false}for(var w=0;w'+(typeof t.config!="undefined"?'":'
    '+lan["public"].select_opt_type+'
      '+e+'
    ")+"";break;case"page":this.config.page=t;var q=bt.get_cookie(this.config.cookiePrefix+"_"+this.config.page.numberParam);if(this.config.cookiePrefix&&q){this.config.page.number=q}r=this.$reader_page(this.config.page,'
    1 '+lan.public_backup.total+"
    ");break}if(r){var d=$(k.config.el+" .tootls_"+t.positon[1]);if(d.length){var m=d.find(".pull-"+t.positon[0]);m.append(r)}else{var g='
    '+(t.positon[0]=="left"?r:"")+'
    '+(t.positon[0]=="right"?r:"")+"
    ";if(t.positon[1]==="top"){$(k.config.el).append(g);if($(k.config.el+" .divtable").length===0){$(k.config.el).append('
    ')}}else{if($(k.config.el+" .divtable").length===0){$(k.config.el).append('
    ')}$(k.config.el).append(g)}}}}if(!this.init){this.$event_bind(c)}},$get_data_batch_list:function(e,c){var d=[];$.each(c||this.data,function(f,g){d.push(g[e])});return d},$reader_page:function(d,h){var e=this,f=$(h),k="",c={};f.find("a").addClass("page_link_"+this.random);k+=f.html();if(d.numberStatus){var i="page_select_"+this.random;k+='";c[i]={eventType:"change",type:"page_select"}}if(d.jump){var g="page_jump_input-"+this.random;var j="page_jump_btn_"+this.random;k+='
    '+lan["public"].jump_to_page+'
    ";c[g]={eventType:"keyup",type:"page_jump_input"};c[j]={type:"page_jump_btn"}}c["page_link_"+this.random]={type:"cut_page_number"};e.config.page.total=parseInt(f.find(".Pcount").html().match(/([0-9]*)/g)[1]);e.$event_bind(c);return'
    '+k+"
    "},$dynamic_merge_style:function(d,c){var e="";$.each(d,function(f,g){switch(f){case"align":e+="text-align:"+g+";";break;case"width":e+="width:"+(typeof g=="string"?g:g+"px")+";";break;case"style":e+=g;break;case"minWidth":e+="min-width:"+(typeof g=="string"?g:g+"px")+";";break;case"maxWidth":e+="max-width:"+(typeof g=="string"?g:g+"px")+";";break}});return{index:c,css:e}},$event_bind:function(d){var c=this;$.each(d,function(e,f){if(c.event_list[e]&&c.event_list[e].eventType===f.eventType){return true}c.event_list[e]=f;$(c.config.el).on(f.eventType||"click","."+e,function(q){var o=$(this).parents("tr").index(),k=$(this).data(),n=[];switch(f.type){case"rows":c.event_rows_model={el:$(this),model:c.config.column[$(this).parents("td").index()],rows:c.data[o],index:o};n=[c.event_rows_model.rows,c.event_rows_model.index,q,e,c];break;case"sort":var m=c.config.column[k.index];if($(this).hasClass("sort-active")){$(".sort_"+c.random+" .sort-active").data({sort:"desc"})}$(".sort_"+c.random).removeClass("sort-active").find(".glyphicon").removeClass("glyphicon-triangle-top").addClass("glyphicon-triangle-bottom");$(this).addClass("sort-active");if(k.sort=="asc"){$(this).data({sort:"desc"});$(this).find(".glyphicon").removeClass("glyphicon-triangle-top").addClass("glyphicon-triangle-bottom")}else{$(this).data({sort:"asc"});$(this).find(".glyphicon").removeClass("glyphicon-triangle-bottom").addClass("glyphicon-triangle-top")}c.config.sort=c.config.sortParam({name:m.fid,sort:k.sort});c.$refresh_table_list(true);break;case"checkbox":var t=$(c.config.el+' [data-checkbox="all"]'),i=$(c.config.el+" tbody .checkbox_"+c.random);if(k.checkbox==undefined){if(!$(this).hasClass("active")){$(this).addClass("active");c.checkbox_list.push(o);if(c.data.length===c.checkbox_list.length){t.addClass("active").removeClass("selected")}else{if(c.checkbox_list.length>0){t.addClass("selected")}}}else{$(this).removeClass("active");c.checkbox_list.splice(c.checkbox_list.indexOf(o),1);if(c.checkbox_list.length>0){t.addClass("selected").removeClass("active")}else{t.removeClass("selected active")}}}else{if(c.checkbox_list.length===c.data.length){c.checkbox_list=[];i.removeClass("active selected").next().prop("checked","checked");t.removeClass("active")}else{i.each(function(u,v){if(!$(this).hasClass("active")){$(this).addClass("active").next().prop("checked","checked");c.checkbox_list.push(u)}});t.removeClass("selected").addClass("active")}}c.$set_batch_view();break;case"button":n.push(q,c);break;case"search_focus":var s=$(c.config.el+" .bt_search_tips");if($(c.config.el+" .bt_search_tips").length>0){s.remove()}break;case"search_input":if(q.keyCode==13){$(c.config.el+" .search_btn_"+c.random).click();return false}break;case"search_btn":var l=$(c.config.el+" .search_input"),h=$(c.config.el+" .search_input").val();c.config.search.value=h;l.append('
    '+h+'
    ');c.$refresh_table_list(true);break;case"page_select":var j=parseInt($(this).val());c.config.page.number=j;c.config.page.page=1;c.$refresh_table_list(true);return false;break;case"page_jump_input":if(q.keyCode==13){$(c.config.el+" .page_jump_btn_"+c.random).click();$(this).focus()}return false;break;case"page_jump_btn":var r=parseInt($(c.config.el+" .page_jump_input-"+c.random).val()),g=Math.ceil(c.config.page.total/c.config.page.number);if(r>g){r=c.config.page.page}c.config.page.page=r;c.$refresh_table_list(true);break;case"cut_page_number":var p=parseInt($(this).attr("href").match(/([0-9]*)$/)[0]);c.config.page.page=p;c.$refresh_table_list(true);return false;break;case"eye_open_password":if($(this).hasClass("glyphicon-eye-open")){$(this).addClass("glyphicon-eye-close").removeClass("glyphicon-eye-open");$(this).prev().text(c.data[o].password)}else{$(this).addClass("glyphicon-eye-open").removeClass("glyphicon-eye-close");$(this).prev().html("**********")}return false;break;case"copy_password":bt.pub.copy_pass(c.data[o].password);return false;break}if(f.event){f.event.apply(this,n)}})})},$style_bind:function(e,c){var f="",d=this;$.each(e,function(g,h){if(h.css!=""){if(!h.className){f+=d.config.el+" thead th:nth-child("+(h.index+1)+"),"+d.config.el+" tbody tr td:nth-child"+(h.span?" span":"")+"("+(h.index+1)+"){"+h.css+"}"}else{f+=h.className+"{"+h.css+"}"}}});if($("#bt_table_"+d.random).length==0){$(d.config.el).append('")}},$get_win_area:function(){return[window.innerWidth,window.innerHeight]},$http:function(h){var g={},d=this.config,e=d.page,f=d.search,c=d.sort||{};if(e){g[e.numberParam]=e.number,g[e.pageParam]=e.page;if(this.config.cookiePrefix){bt.set_cookie(this.config.cookiePrefix+"_"+e.numberParam,e.number)}}if(f){g[f.searchParam]=f.value}if(this.config.beforeRequest){d.param=this.config.beforeRequest(d.param)}bt_tools.send({url:d.url,data:$.extend(d.param,g,c)},function(i){if(d.dataFilter){var j=d.dataFilter(i);if(h){h(j.data,j.page)}}else{if(h){h(i.data,i.page)}}})}};return new b(a)},select_file:function(c,d){if(typeof c==="string"){c={path:c,type:2,title:lan["public"].select_fileordir,ext:[],limit:""}}if(typeof c==="function"){type=d,d=c,c={path:bt.get_cookie("Path")}}if(typeof type!=="number"){type=0}var b=this,a={type:type,type_tips:type==0?lan["public"].dir:(type==1?lan.site.file:lan["public"].fileordir),select_list:[],select_path:bt.get_cookie("Path")||(bt.os=="Windows"?setup_path:"/www/wwwroot"),select_config:{},scroll_width:0,reader_view:function(){var e=this;this.scroll_width=a.getScrollbarWidth();layer.open({type:1,title:c.title||(lan["public"].select+e.type_tips),shadeClose:false,closeBtn:1,area:["650px","550px"],content:'
    '+lan["public"].name+''+lan["public"].modify_time+''+lan.site.redirect_type+'
    文件修改时间类型
    '+e.type_tips+'名:
    ',success:function(){e.evnet_bind();e.render_file_list(function(){e.set_path_width()});$(".select_list_thaed").css("right",e.scroll_width+"px")}})},evnet_bind:function(){var e=this;$("#select_dir_list").on("click","tr",function(){var f=$(this).data("index");$(this).addClass("active").siblings().removeClass("active");$('[name="select_name"]').val(e.select_list[f].filename)});$(".select_list_body").on("scroll",function(h){var g=$(this).scrollTop(),f=$(this).scrollLeft();if(g>0){$(".select_list_shadow").show()}else{$(".select_list_shadow").hide()}if(f>=0){$(".select_list_thaed").css("left",(4-f)+"px")}h.stopPropagation();h.preventDefault()});$(".file_path_refresh").on("click",function(){e.render_file_list()});$(".select_dir_list thead th .icon-drag").on("mousedown",function(k){var m=k.clientX,f=$(this).parent(),h=f.index(),n=f[0].clientWidth,g=parseInt($(this).parent().attr("data-min")),l=null;if(k.which===1){var j=function(r){var p=r.clientX,q=p-m,o=n+q;l=setTimeout(function(){e.set_select_width(h,"width:"+o+"px")},0)},i=function(){$(this).unbind(j);$(this).unbind(i)};$(document).on("mousemove",j).one("mouseup",function(){$(this).unbind(j);$(this).unbind(this)})}k.stopPropagation()});$(".select_dir_list thead th>span").on("click",function(h){var g=$(this).parent(),f=g.data("type"),i=g.hasClass("active"),j=g.hasClass("sort");if(i){g.addClass("sort").removeClass("active")}else{if(j){g.addClass("active").removeClass("sort")}else{g.addClass("active")}}g.siblings().removeClass("active sort");e.render_file_list({sort:f,reverse:i?1:0});h.stopPropagation()});$(".search_path_views input").on("keyup",function(){var f=$(this).val()})},set_path_width:function(j){var e=0,h=$(".file_dir_view")[0].offsetWidth,g=$(".file_dir_view .file_dir_item"),k=[],e=0;$(".file_dir_view .file_dir_item").each(function(){k.push($(this)[0].offsetWidth)});var l=k.reverse();for(var f=0;f-1?("本地磁盘("+r.path.match(/[A-Z]+/)[0])+":)":r.path);f+='
    '+p+"
    "});$.each(l,function(q,s){var p=bt.format_data(s.mtime),r=(s.type=="dir"?"文件夹":"文件");g+=' '+s.filename+" "+p+" "+(s.type=="dir"?"文件夹":"文件")+" "});$("#select_mount_list").html(f);$("#select_dir_list").html(g);if(j){j(n)}})},render_path_list:function(j,m){var h='
    ',f="",l=j.split("/").splice(1),k=j.split("/")[0];if(bt.os==="Windows"){if(l.length==0){l=[]}l.unshift('本地磁盘('+k+")")}else{if(j=="/"){l=[]}l.unshift("根目录")}for(var g=0;g '+l[g]+' '}$(".path_input").val("").attr("data-path",j);var e=$("#select_file_directory .file_path_input .file_dir_view");e.html(h);if(m){m(j)}},set_select_width:function(h,g){var i=this,f=".select_dir_list tbody td:nth-child("+(h+1)+")>span,.select_dir_list thead th:nth-child("+(h+1)+")>span",e=$("#th-index-"+h);if(e.length>0){e.html(f+"{"+g+"}")}else{$("#select_file_style").append('")}},cut_style_object:function(f){var e={},g=f.split(";");return e},getScrollbarWidth:function(){var h=document.createElement("div"),g={width:"100px",height:"100px",overflowY:"scroll"},e,f;for(e in g){h.style[e]=g[e]}document.body.appendChild(h);f=h.offsetWidth-h.clientWidth;h.remove();return f}};a.reader_view()},form:function(a){var b=this;function c(d){this.config=d;this.data=d.data||{};this.$load()}c.prototype={element:null,style_list:[],event_list:{},event_type:["click","event","focus","keyup","blur","change"],hide_list:[],form_element:{},form_config:{},random:bt.get_random(5),$load:function(){var d=this;if(d.el){this.$reader_content(function(){d.$event_bind()})}},$reader_content:function(h){var g=this,f="",e="",d={};$.each(g.config.form,function(i,j){f+=g.$reader_content_row(i,j)});g.element=$('
    '+f+"
    ");e=$('
    ');e.append(g.element);if(h){h()}return e[0].outerHTML},$reader_content_row:function(f,h){var g=this,e=h.help,d=this.config.formLabelWidth||h.formLabelWidth;return'
    "+(h.label?'"+h.label+"":"")+'
    "+g.$reader_form_element(h.group,f)+(e?('
    "+e.list.join("
    ")+"
    "):"")+"
    "},$reader_form_element:function(g,d){var f=this,e="";if(!Array.isArray(g)){g=[g]}$.each(g,function(h,i){i.find_index=d;e+=f.$reader_form_find(i);f.form_config[i.name]=i});return e},$reader_form_element:function(i,f){var h=this,e=[],g="",d={};if(!Array.isArray(i)){i=[i]}$.each(i,function(q,r){var j=h.$reader_style(r.style)+b.$verify(r.width,"width","style"),k=h.$verify_group(r,["name","value","placeholder","disabled","readonly","autofocus","autocomplete","min","max"]),s=h.$create_event_config(r),o="";g+=r.label?''+r.label+"":"";if(typeof r.name!=="undefined"){d[r.name]=s}switch(r.type){case"text":case"checkbox":case"password":case"radio":case"number":var m="event_"+r.name+"_"+h.random,n=r.type==="checkbox"?true:false;if(r.type==="radio"){$.each(r.label_tips,function(u,t){if(r.block){g+='
    '}g+='';g+='";if(r.block){g+="
    "}})}else{if(r.block){g+='
    '}g+='";if(r.type=="checkbox"){g+='"}if(r.block){g+="
    "}h.event_list[m]={click:{event:r.event}}}if(r.icon){g+='";d[r.name+"_icon"]={click:{type:"select_path",config:r}}}break;case"textarea":g+='";$.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+='
      "+l+"
    ";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/YakPanel/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: YakPanel默认设置的SWAP交换分区文件";break}if(l[0].indexOf("Recycle_bin")!=-1){o="PS: 回收站目录,勿动!"}if(l[0].indexOf(".upload.tmp")!=-1){o="PS: YakPanel文件上传临时文件,重新上传从断点续传,可删除"}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},{})};