You cannot select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

1 line
21 KiB
Plaintext

(function(f){var B={event:{DRAG:"ztree_drag",DROP:"ztree_drop",REMOVE:"ztree_remove",RENAME:"ztree_rename"},id:{EDIT:"_edit",INPUT:"_input",REMOVE:"_remove"},move:{TYPE_INNER:"inner",TYPE_PREV:"prev",TYPE_NEXT:"next"},node:{CURSELECTED_EDIT:"curSelectedNode_Edit",TMPTARGET_TREE:"tmpTargetzTree",TMPTARGET_NODE:"tmpTargetNode"}},l={edit:{enable:false,editNameSelectAll:false,showRemoveBtn:true,showRenameBtn:true,removeTitle:"remove",renameTitle:"rename",drag:{autoExpandTrigger:false,isCopy:true,isMove:true,prev:true,next:true,inner:true,minMoveSize:5,borderMax:10,borderMin:-5,maxShowNodeNum:5,autoOpenTime:500}},view:{addHoverDom:null,removeHoverDom:null},callback:{beforeDrag:null,beforeDragOpen:null,beforeDrop:null,beforeEditName:null,beforeRename:null,onDrag:null,onDrop:null,onRename:null}},w=function(C){var D=z.getRoot(C);D.curEditNode=null;D.curEditInput=null;D.curHoverNode=null;D.dragFlag=0;D.dragNodeShowBefore=[];D.dragMaskList=new Array();D.showHoverDom=true},c=function(C){},m=function(C){var D=C.treeObj;var E=p.event;D.bind(E.RENAME,function(F,H,G){u.apply(C.callback.onRename,[F,H,G])});D.bind(E.REMOVE,function(F,H,G){u.apply(C.callback.onRemove,[F,H,G])});D.bind(E.DRAG,function(G,F,I,H){u.apply(C.callback.onDrag,[F,I,H])});D.bind(E.DROP,function(I,H,K,J,L,G,F){u.apply(C.callback.onDrop,[H,K,J,L,G,F])})},y=function(C){var D=C.treeObj;var E=p.event;D.unbind(E.RENAME);D.unbind(E.REMOVE);D.unbind(E.DRAG);D.unbind(E.DROP)},n=function(J){var K=J.target,N=z.getSetting(J.data.treeId),L=J.relatedTarget,H="",D=null,E="",I="",C=null,G=null,F=null;if(u.eqs(J.type,"mouseover")){F=u.getMDom(N,K,[{tagName:"a",attrName:"treeNode"+p.id.A}]);if(F){H=F.parentNode.id;E="hoverOverNode"}}else{if(u.eqs(J.type,"mouseout")){F=u.getMDom(N,L,[{tagName:"a",attrName:"treeNode"+p.id.A}]);if(!F){H="remove";E="hoverOutNode"}}else{if(u.eqs(J.type,"mousedown")){F=u.getMDom(N,K,[{tagName:"a",attrName:"treeNode"+p.id.A}]);if(F){H=F.parentNode.id;E="mousedownNode"}}}}if(H.length>0){D=z.getNodeCache(N,H);switch(E){case"mousedownNode":C=k.onMousedownNode;break;case"hoverOverNode":C=k.onHoverOverNode;break;case"hoverOutNode":C=k.onHoverOutNode;break}}var M={stop:false,node:D,nodeEventType:E,nodeEventCallback:C,treeEventType:I,treeEventCallback:G};return M},v=function(E,I,H,C,G,D,F){if(!H){return}H.isHover=false;H.editNameFlag=false},j=function(D,C){C.cancelEditName=function(F){var E=z.getRoot(D),G=D.data.key.name,H=E.curEditNode;if(!E.curEditNode){return}i.cancelCurEditNode(D,F?F:H[G])};C.copyNode=function(I,H,G,J){if(!H){return null}if(I&&!I.isParent&&D.data.keep.leaf&&G===p.move.TYPE_INNER){return null}var E=u.clone(H);if(!I){I=null;G=p.move.TYPE_INNER}if(G==p.move.TYPE_INNER){function F(){i.addNodes(D,I,[E],J)}if(u.canAsync(D,I)){i.asyncNode(D,I,J,F)}else{F()}}else{i.addNodes(D,I.parentNode,[E],J);i.moveNode(D,I,E,G,false,J)}return E};C.editName=function(E){if(!E||!E.tId||E!==z.getNodeCache(D,E.tId)){return}if(E.parentTId){i.expandCollapseParentNode(D,E.getParentNode(),true)}i.editNode(D,E)};C.moveNode=function(G,F,E,I){if(!F){return F}if(G&&!G.isParent&&D.data.keep.leaf&&E===p.move.TYPE_INNER){return null}else{if(G&&((F.parentTId==G.tId&&E==p.move.TYPE_INNER)||f("#"+F.tId).find("#"+G.tId).length>0)){return null}else{if(!G){G=null}}}function H(){i.moveNode(D,G,F,E,false,I)}if(u.canAsync(D,G)&&E===p.move.TYPE_INNER){i.asyncNode(D,G,I,H)}else{H()}return F};C.setEditable=function(E){D.edit.enable=E;return this.refresh()}},o={setSonNodeLevel:function(F,C,H){if(!H){return}var G=F.data.key.children;H.level=(C)?C.level+1:0;if(!H[G]){return}for(var E=0,D=H[G].length;E<D;E++){if(H[G][E]){z.setSonNodeLevel(F,H,H[G][E])}}}},g={},k={onHoverOverNode:function(F,E){var D=z.getSetting(F.data.treeId),C=z.getRoot(D);if(C.curHoverNode!=E){k.onHoverOutNode(F)}C.curHoverNode=E;i.addHoverDom(D,E)},onHoverOutNode:function(F,E){var D=z.getSetting(F.data.treeId),C=z.getRoot(D);if(C.curHoverNode&&!z.isSelectedNode(D,C.curHoverNode)){i.removeTreeDom(D,C.curHoverNode);C.curHoverNode=null}},onMousedownNode:function(O,I){var W,T,N=z.getSetting(O.data.treeId),S=z.getRoot(N);if(O.button==2||!N.edit.enable||(!N.edit.drag.isCopy&&!N.edit.drag.isMove)){return true}var Z=O.target,H=z.getRoot(N).curSelectedList,P=[];if(!z.isSelectedNode(N,I)){P=[I]}else{for(W=0,T=H.length;W<T;W++){if(H[W].editNameFlag&&u.eqs(Z.tagName,"input")&&Z.getAttribute("treeNode"+p.id.INPUT)!==null){return true}P.push(H[W]);if(P[0].parentTId!==H[W].parentTId){P=[I];break}}}i.editNodeBlur=true;i.cancelCurEditNode(N,null,true);var ac=f(document),V,J,X,Y=false,aa=N,C,G,Q=null,F=null,M=null,D=p.move.TYPE_INNER,U=O.clientX,R=O.clientY,K=(new Date()).getTime();if(u.uCanDo(N)){ac.bind("mousemove",L)}function L(a1){if(S.dragFlag==0&&Math.abs(U-a1.clientX)<N.edit.drag.minMoveSize&&Math.abs(R-a1.clientY)<N.edit.drag.minMoveSize){return true}var aW,aS,au,aN,aF,aM=N.data.key.children;f("body").css("cursor","pointer");if(S.dragFlag==0){if(u.apply(N.callback.beforeDrag,[N.treeId,P],true)==false){ab(a1);return true}for(aW=0,aS=P.length;aW<aS;aW++){if(aW==0){S.dragNodeShowBefore=[]}au=P[aW];if(au.isParent&&au.open){i.expandCollapseNode(N,au,!au.open);S.dragNodeShowBefore[au.tId]=true}else{S.dragNodeShowBefore[au.tId]=false}}S.dragFlag=1;S.showHoverDom=false;u.showIfameMask(N,true);var ae=true,ah=-1;if(P.length>1){var ar=P[0].parentTId?P[0].getParentNode()[aM]:z.getNodes(N);aF=[];for(aW=0,aS=ar.length;aW<aS;aW++){if(S.dragNodeShowBefore[ar[aW].tId]!==undefined){if(ae&&ah>-1&&(ah+1)!==aW){ae=false}aF.push(ar[aW]);ah=aW}if(P.length===aF.length){P=aF;break}}}if(ae){C=P[0].getPreNode();G=P[P.length-1].getNextNode()}V=f("<ul class='zTreeDragUL'></ul>");for(aW=0,aS=P.length;aW<aS;aW++){au=P[aW];au.editNameFlag=false;i.selectNode(N,au,aW>0);i.removeTreeDom(N,au);aN=f("<li id='"+au.tId+"_tmp'></li>");aN.append(f("#"+au.tId+p.id.A).clone());aN.css("padding","0");aN.children("#"+au.tId+p.id.A).removeClass(p.node.CURSELECTED);V.append(aN);if(aW==N.edit.drag.maxShowNodeNum-1){aN=f("<li id='"+au.tId+"_moretmp'><a> ... </a></li>");V.append(aN);break}}V.attr("id",P[0].tId+p.id.UL+"_tmp");V.addClass(N.treeObj.attr("class"));V.appendTo("body");J=f("<span class='tmpzTreeMove_arrow'></span>");J.attr("id","zTreeMove_arrow_tmp");J.appendTo("body");N.treeObj.trigger(p.event.DRAG,[a1,N.treeId,P])}if(S.dragFlag==1){if(X&&J.attr("id")==a1.target.id&&M&&(a1.clientX+ac.scrollLeft()+2)>(f("#"+M+p.id.A,X).offset().left)){var a0=f("#"+M+p.id.A,X);a1.target=(a0.length>0)?a0.get(0):a1.target}else{if(X){X.removeClass(p.node.TMPTARGET_TREE);if(M){f("#"+M+p.id.A,X).removeClass(p.node.TMPTARGET_NODE+"_"+p.move.TYPE_PREV).removeClass(p.node.TMPTARGET_NODE+"_"+B.move.TYPE_NEXT).removeClass(p.node.TMPTARGET_NODE+"_"+B.move.TYPE_INNER)}}}X=null;M=null;Y=false;aa=N;var aX=z.getSettings();for(var aO in aX){if(aX[aO].treeId&&aX[aO].edit.enable&&aX[aO].treeId!=N.treeId&&(a1.target.id==aX[aO].treeId||f(a1.target).parents("#"+aX[aO].treeId).length>0)){Y=true;aa=aX[aO]}}var aq=ac.scrollTop(),aZ=ac.scrollLeft(),af=aa.treeObj.offset(),az=aa.treeObj.get(0).scrollHeight,aP=aa.treeObj.get(0).scrollWidth,aY=(a1.clientY+aq-af.top),aL=(aa.treeObj.height()+af.top-a1.clientY-aq),aG=(a1.clientX+aZ-af.left),ap=(aa.treeObj.width()+af.left-a1.clientX-aZ),at=(aY<N.edit.drag.borderMax&&aY>N.edit.drag.borderMin),a2=(aL<N.edit.drag.borderMax&&aL>N.edit.drag.borderMin),aJ=(aG<N.edit.drag.borderMax&&aG>N.edit.drag.borderMin),an=(ap<N.edit.drag.borderMax&&ap>N.edit.drag.borderMin),ag=aY>N.edit.drag.borderMin&&aL>N.edit.drag.borderMin&&aG>N.edit.drag.borderMin&&ap>N.edit.drag.borderMin,aD=(at&&aa.treeObj.scrollTop()<=0),aC=(a2&&(aa.treeObj.scrollTop()+aa.treeObj.height()+10)>=az),aj=(aJ&&aa.treeObj.scrollLeft()<=0),ax=(an&&(aa.treeObj.scrollLeft()+aa.treeObj.width()+10)>=aP);if(a1.target.id&&aa.treeObj.find("#"+a1.target.id).length>0){var ao=a1.target;while(ao&&ao.tagName&&!u.eqs(ao.tagName,"li")&&ao.id!=aa.treeId){ao=ao.parentNode}var aw=true;for(aW=0,aS=P.length;aW<aS;aW++){au=P[aW];if(ao.id===au.tId){aw=false;break}else{if(f("#"+au.tId).find("#"+ao.id).length>0){aw=false;break}}}if(aw){if(a1.target.id&&(a1.target.id==(ao.id+p.id.A)||f(a1.target).parents("#"+ao.id+p.id.A).length>0)){X=f(ao);M=ao.id}}}au=P[0];if(ag&&(a1.target.id==aa.treeId||f(a1.target).parents("#"+aa.treeId).length>0)){if(!X&&(a1.target.id==aa.treeId||aD||aC||aj||ax)&&(Y||(!Y&&au.parentTId))){X=aa.treeObj}if(at){aa.treeObj.scrollTop(aa.treeObj.scrollTop()-10)}else{if(a2){aa.treeObj.scrollTop(aa.treeObj.scrollTop()+10)}}if(aJ){aa.treeObj.scrollLeft(aa.treeObj.scrollLeft()-10)}else{if(an){aa.treeObj.scrollLeft(aa.treeObj.scrollLeft()+10)}}if(X&&X!=aa.treeObj&&X.offset().left<aa.treeObj.offset().left){aa.treeObj.scrollLeft(aa.treeObj.scrollLeft()+X.offset().left-aa.treeObj.offset().left)}}V.css({top:(a1.clientY+aq+3)+"px",left:(a1.clientX+aZ+3)+"px"});var aB=0;var aA=0;if(X&&X.attr("id")!=aa.treeId){var aK=M==null?null:z.getNodeCache(aa,M),aE=(a1.ctrlKey&&N.edit.drag.isMove&&N.edit.drag.isCopy)||(!N.edit.drag.isMove&&N.edit.drag.isCopy),al=!!(C&&M===C.tId),aI=!!(G&&M===G.tId),aU=(au.parentTId&&au.parentTId==M),aH=(aE||!aI)&&u.apply(aa.edit.drag.prev,[aa.treeId,P,aK],!!aa.edit.drag.prev),ak=(aE||!al)&&u.apply(aa.edit.drag.next,[aa.treeId,P,aK],!!aa.edit.drag.next),ad=(aE||!aU)&&!(aa.data.keep.leaf&&!aK.isParent)&&u.apply(aa.edit.drag.inner,[aa.treeId,P,aK],!!aa.edit.drag.inner);if(!aH&&!ak&&!ad){X=null;M="";D=p.move.TYPE_INNER;J.css({display:"none"});if(window.zTreeMoveTimer){clearTimeout(window.zTreeMoveTimer);window.zTreeMoveTargetNodeTId=null}}else{var ay=f("#"+M+p.id.A,X),aR=aK.isLastNode?null:f("#"+aK.getNextNode().tId+p.id.A,X.next()),aT=ay.offset().top,aV=ay.offset().left,aQ=aH?(ad?0.25:(ak?0.5:1)):-1,am=ak?(ad?0.75:(aH?0.5:0)):-1,ai=(a1.clientY+aq-aT)/ay.height();if((aQ==1||ai<=aQ&&ai>=-0.2)&&aH){aB=1-J.width();aA=aT-J.height()/2;D=p.move.TYPE_PREV}else{if((am==0||ai>=am&&ai<=1.2)&&ak){aB=1-J.width();aA=(aR==null||(aK.isParent&&aK.open))?(aT+ay.height()-J.height()/2):(aR.offset().top-J.height()/2);D=p.move.TYPE_NEXT}else{aB=5-J.width();aA=aT;D=p.move.TYPE_INNER}}J.css({display:"block",top:aA+"px",left:(aV+aB)+"px"});ay.addClass(p.node.TMPTARGET_NODE+"_"+D);if(Q!=M||F!=D){K=(new Date()).getTime()}if(aK&&aK.isParent&&D==p.move.TYPE_INNER){var av=true;if(window.zTreeMoveTimer&&window.zTreeMoveTargetNodeTId!==aK.tId){clearTimeout(window.zTreeMoveTimer);window.zTreeMoveTargetNodeTId=null}else{if(window.zTreeMoveTimer&&window.zTreeMoveTargetNodeTId===aK.tId){av=false}}if(av){window.zTreeMoveTimer=setTimeout(function(){if(D!=p.move.TYPE_INNER){return}if(aK&&aK.isParent&&!aK.open&&(new Date()).getTime()-K>aa.edit.drag.autoOpenTime&&u.apply(aa.callback.beforeDragOpen,[aa.treeId,aK],true)){i.switchNode(aa,aK);if(aa.edit.drag.autoExpandTrigger){aa.treeObj.trigger(p.event.EXPAND,[aa.treeId,aK])}}},aa.edit.drag.autoOpenTime+50);window.zTreeMoveTargetNodeTId=aK.tId}}}}else{D=p.move.TYPE_INNER;if(X&&u.apply(aa.edit.drag.inner,[aa.treeId,P,null],!!aa.edit.drag.inner)){X.addClass(p.node.TMPTARGET_TREE)}else{X=null}J.css({display:"none"});if(window.zTreeMoveTimer){clearTimeout(window.zTreeMoveTimer);window.zTreeMoveTargetNodeTId=null}}Q=M;F=D}return false}ac.bind("mouseup",ab);function ab(ak){if(window.zTreeMoveTimer){clearTimeout(window.zTreeMoveTimer);window.zTreeMoveTargetNodeTId=null}Q=null;F=null;ac.unbind("mousemove",L);ac.unbind("mouseup",ab);ac.unbind("selectstart",E);f("body").css("cursor","auto");if(X){X.removeClass(p.node.TMPTARGET_TREE);if(M){f("#"+M+p.id.A,X).removeClass(p.node.TMPTARGET_NODE+"_"+p.move.TYPE_PREV).removeClass(p.node.TMPTARGET_NODE+"_"+B.move.TYPE_NEXT).removeClass(p.node.TMPTARGET_NODE+"_"+B.move.TYPE_INNER)}}u.showIfameMask(N,false);S.showHoverDom=true;if(S.dragFlag==0){return}S.dragFlag=0;var ai,ae,aj;for(ai=0,ae=P.length;ai<ae;ai++){aj=P[ai];if(aj.isParent&&S.dragNodeShowBefore[aj.tId]&&!aj.open){i.expandCollapseNode(N,aj,!aj.open);delete S.dragNodeShowBefore[aj.tId]}}if(V){V.remove()}if(J){J.remove()}var ad=(ak.ctrlKey&&N.edit.drag.isMove&&N.edit.drag.isCopy)||(!N.edit.drag.isMove&&N.edit.drag.isCopy);if(!ad&&X&&M&&P[0].parentTId&&M==P[0].parentTId&&D==p.move.TYPE_INNER){X=null}if(X){var af=M==null?null:z.getNodeCache(aa,M);if(u.apply(N.callback.beforeDrop,[aa.treeId,P,af,D,ad],true)==false){return}var ag=ad?u.clone(P):P;function ah(){if(Y){if(!ad){for(var am=0,al=P.length;am<al;am++){i.removeNode(N,P[am])}}if(D==p.move.TYPE_INNER){i.addNodes(aa,af,ag)}else{i.addNodes(aa,af.getParentNode(),ag);if(D==p.move.TYPE_PREV){for(am=0,al=ag.length;am<al;am++){i.moveNode(aa,af,ag[am],D,false)}}else{for(am=-1,al=ag.length-1;am<al;al--){i.moveNode(aa,af,ag[al],D,false)}}}}else{if(ad&&D==p.move.TYPE_INNER){i.addNodes(aa,af,ag)}else{if(ad){i.addNodes(aa,af.getParentNode(),ag)}if(D!=p.move.TYPE_NEXT){for(am=0,al=ag.length;am<al;am++){i.moveNode(aa,af,ag[am],D,false)}}else{for(am=-1,al=ag.length-1;am<al;al--){i.moveNode(aa,af,ag[al],D,false)}}}}for(am=0,al=ag.length;am<al;am++){i.selectNode(aa,ag[am],am>0)}f("#"+ag[0].tId).focus().blur();N.treeObj.trigger(p.event.DROP,[ak,aa.treeId,ag,af,D,ad])}if(D==p.move.TYPE_INNER&&u.canAsync(aa,af)){i.asyncNode(aa,af,false,ah)}else{ah()}}else{for(ai=0,ae=P.length;ai<ae;ai++){i.selectNode(aa,P[ai],ai>0)}N.treeObj.trigger(p.event.DROP,[ak,N.treeId,P,null,null,null])}}ac.bind("selectstart",E);function E(){return false}if(O.preventDefault){O.preventDefault()}return true}},h={getAbs:function(C){var D=C.getBoundingClientRect();return[D.left,D.top]},inputFocus:function(C){if(C.get(0)){C.focus();u.setCursorPosition(C.get(0),C.val().length)}},inputSelect:function(C){if(C.get(0)){C.focus();C.select()}},setCursorPosition:function(D,E){if(D.setSelectionRange){D.focus();D.setSelectionRange(E,E)}else{if(D.createTextRange){var C=D.createTextRange();C.collapse(true);C.moveEnd("character",E);C.moveStart("character",E);C.select()}}},showIfameMask:function(J,H){var G=z.getRoot(J);while(G.dragMaskList.length>0){G.dragMaskList[0].remove();G.dragMaskList.shift()}if(H){var K=f("iframe");for(var F=0,D=K.length;F<D;F++){var E=K.get(F),C=u.getAbs(E),I=f("<div id='zTreeMask_"+F+"' class='zTreeMask' style='top:"+C[1]+"px; left:"+C[0]+"px; width:"+E.offsetWidth+"px; height:"+E.offsetHeight+"px;'></div>");I.appendTo("body");G.dragMaskList.push(I)}}}},d={addEditBtn:function(D,E){if(E.editNameFlag||f("#"+E.tId+p.id.EDIT).length>0){return}if(!u.apply(D.edit.showRenameBtn,[D.treeId,E],D.edit.showRenameBtn)){return}var F=f("#"+E.tId+p.id.A),C="<span class='"+p.className.BUTTON+" edit' id='"+E.tId+p.id.EDIT+"' title='"+u.apply(D.edit.renameTitle,[D.treeId,E],D.edit.renameTitle)+"' treeNode"+p.id.EDIT+" style='display:none;'></span>";F.append(C);f("#"+E.tId+p.id.EDIT).bind("click",function(){if(!u.uCanDo(D)||u.apply(D.callback.beforeEditName,[D.treeId,E],true)==false){return false}i.editNode(D,E);return false}).show()},addRemoveBtn:function(C,D){if(D.editNameFlag||f("#"+D.tId+p.id.REMOVE).length>0){return}if(!u.apply(C.edit.showRemoveBtn,[C.treeId,D],C.edit.showRemoveBtn)){return}var F=f("#"+D.tId+p.id.A),E="<span class='"+p.className.BUTTON+" remove' id='"+D.tId+p.id.REMOVE+"' title='"+u.apply(C.edit.removeTitle,[C.treeId,D],C.edit.removeTitle)+"' treeNode"+p.id.REMOVE+" style='display:none;'></span>";F.append(E);f("#"+D.tId+p.id.REMOVE).bind("click",function(){if(!u.uCanDo(C)||u.apply(C.callback.beforeRemove,[C.treeId,D],true)==false){return false}i.removeNode(C,D);C.treeObj.trigger(p.event.REMOVE,[C.treeId,D]);return false}).bind("mousedown",function(G){return true}).show()},addHoverDom:function(C,D){if(z.getRoot(C).showHoverDom){D.isHover=true;if(C.edit.enable){i.addEditBtn(C,D);i.addRemoveBtn(C,D)}u.apply(C.view.addHoverDom,[C.treeId,D])}},cancelCurEditNode:function(H,F){var D=z.getRoot(H),G=H.data.key.name,I=D.curEditNode;if(I){var E=D.curEditInput;var C=F?F:E.val();if(!F&&u.apply(H.callback.beforeRename,[H.treeId,I,C],true)===false){return false}else{I[G]=C?C:E.val();if(!F){H.treeObj.trigger(p.event.RENAME,[H.treeId,I])}}var J=f("#"+I.tId+p.id.A);J.removeClass(p.node.CURSELECTED_EDIT);E.unbind();i.setNodeName(H,I);I.editNameFlag=false;D.curEditNode=null;D.curEditInput=null;i.selectNode(H,I,false)}D.noSelection=true;return true},editNode:function(F,G){var C=z.getRoot(F);i.editNodeBlur=false;if(z.isSelectedNode(F,G)&&C.curEditNode==G&&G.editNameFlag){setTimeout(function(){u.inputFocus(C.curEditInput)},0);return}var E=F.data.key.name;G.editNameFlag=true;i.removeTreeDom(F,G);i.cancelCurEditNode(F);i.selectNode(F,G,false);f("#"+G.tId+p.id.SPAN).html("<input type=text class='rename' id='"+G.tId+p.id.INPUT+"' treeNode"+p.id.INPUT+" >");var D=f("#"+G.tId+p.id.INPUT);D.attr("value",G[E]);if(F.edit.editNameSelectAll){u.inputSelect(D)}else{u.inputFocus(D)}D.bind("blur",function(H){if(!i.editNodeBlur){i.cancelCurEditNode(F)}}).bind("keydown",function(H){if(H.keyCode=="13"){i.editNodeBlur=true;i.cancelCurEditNode(F,null,true)}else{if(H.keyCode=="27"){i.cancelCurEditNode(F,G[E])}}}).bind("click",function(H){return false}).bind("dblclick",function(H){return false});f("#"+G.tId+p.id.A).addClass(p.node.CURSELECTED_EDIT);C.curEditInput=D;C.noSelection=false;C.curEditNode=G},moveNode:function(M,F,P,E,aa,G){var R=z.getRoot(M),K=M.data.key.children;if(F==P){return}if(M.data.keep.leaf&&F&&!F.isParent&&E==p.move.TYPE_INNER){return}var U=(P.parentTId?P.getParentNode():R),O=(F===null||F==R);if(O&&F===null){F=R}if(O){E=p.move.TYPE_INNER}var C=(F.parentTId?F.getParentNode():R);if(E!=p.move.TYPE_PREV&&E!=p.move.TYPE_NEXT){E=p.move.TYPE_INNER}if(E==p.move.TYPE_INNER){if(O){P.parentTId=null}else{if(!F.isParent){F.isParent=true;F.open=!!F.open;i.setNodeLineIcos(M,F)}P.parentTId=F.tId}}var H,J;if(O){H=M.treeObj;J=H}else{if(!G&&E==p.move.TYPE_INNER){i.expandCollapseNode(M,F,true,false)}else{if(!G){i.expandCollapseNode(M,F.getParentNode(),true,false)}}H=f("#"+F.tId);J=f("#"+F.tId+p.id.UL);if(!!H.get(0)&&!J.get(0)){var Y=[];i.makeUlHtml(M,F,Y,"");H.append(Y.join(""))}J=f("#"+F.tId+p.id.UL)}var W=f("#"+P.tId);if(!W.get(0)){W=i.appendNodes(M,P.level,[P],null,false,true).join("")}else{if(!H.get(0)){W.remove()}}if(J.get(0)&&E==p.move.TYPE_INNER){J.append(W)}else{if(H.get(0)&&E==p.move.TYPE_PREV){H.before(W)}else{if(H.get(0)&&E==p.move.TYPE_NEXT){H.after(W)}}}var T,S,I=-1,V=0,Z=null,D=null,X=P.level;if(P.isFirstNode){I=0;if(U[K].length>1){Z=U[K][1];Z.isFirstNode=true}}else{if(P.isLastNode){I=U[K].length-1;Z=U[K][I-1];Z.isLastNode=true}else{for(T=0,S=U[K].length;T<S;T++){if(U[K][T].tId==P.tId){I=T;break}}}}if(I>=0){U[K].splice(I,1)}if(E!=p.move.TYPE_INNER){for(T=0,S=C[K].length;T<S;T++){if(C[K][T].tId==F.tId){V=T}}}if(E==p.move.TYPE_INNER){if(!F[K]){F[K]=new Array()}if(F[K].length>0){D=F[K][F[K].length-1];D.isLastNode=false}F[K].splice(F[K].length,0,P);P.isLastNode=true;P.isFirstNode=(F[K].length==1)}else{if(F.isFirstNode&&E==p.move.TYPE_PREV){C[K].splice(V,0,P);D=F;D.isFirstNode=false;P.parentTId=F.parentTId;P.isFirstNode=true;P.isLastNode=false}else{if(F.isLastNode&&E==p.move.TYPE_NEXT){C[K].splice(V+1,0,P);D=F;D.isLastNode=false;P.parentTId=F.parentTId;P.isFirstNode=false;P.isLastNode=true}else{if(E==p.move.TYPE_PREV){C[K].splice(V,0,P)}else{C[K].splice(V+1,0,P)}P.parentTId=F.parentTId;P.isFirstNode=false;P.isLastNode=false}}}z.fixPIdKeyValue(M,P);z.setSonNodeLevel(M,P.getParentNode(),P);i.setNodeLineIcos(M,P);i.repairNodeLevelClass(M,P,X);if(!M.data.keep.parent&&U[K].length<1){U.isParent=false;U.open=false;var N=f("#"+U.tId+p.id.UL),Q=f("#"+U.tId+p.id.SWITCH),L=f("#"+U.tId+p.id.ICON);i.replaceSwitchClass(U,Q,p.folder.DOCU);i.replaceIcoClass(U,L,p.folder.DOCU);N.css("display","none")}else{if(Z){i.setNodeLineIcos(M,Z)}}if(D){i.setNodeLineIcos(M,D)}if(!!M.check&&M.check.enable&&i.repairChkClass){i.repairChkClass(M,U);i.repairParentChkClassWithSelf(M,U);if(U!=P.parent){i.repairParentChkClassWithSelf(M,P)}}if(!G){i.expandCollapseParentNode(M,P.getParentNode(),true,aa)}},removeEditBtn:function(C){f("#"+C.tId+p.id.EDIT).unbind().remove()},removeRemoveBtn:function(C){f("#"+C.tId+p.id.REMOVE).unbind().remove()},removeTreeDom:function(C,D){D.isHover=false;i.removeEditBtn(D);i.removeRemoveBtn(D);u.apply(C.view.removeHoverDom,[C.treeId,D])},repairNodeLevelClass:function(D,F,E){if(E===F.level){return}var G=f("#"+F.tId),J=f("#"+F.tId+p.id.A),I=f("#"+F.tId+p.id.UL),C=p.className.LEVEL+E,H=p.className.LEVEL+F.level;G.removeClass(C);G.addClass(H);J.removeClass(C);J.addClass(H);I.removeClass(C);I.addClass(H)}},s={tools:h,view:d,event:g,data:o};f.extend(true,f.fn.zTree.consts,B);f.extend(true,f.fn.zTree._z,s);var b=f.fn.zTree,u=b._z.tools,p=b.consts,i=b._z.view,z=b._z.data,r=b._z.event;z.exSetting(l);z.addInitBind(m);z.addInitUnBind(y);z.addInitCache(c);z.addInitNode(v);z.addInitProxy(n);z.addInitRoot(w);z.addZTreeTools(j);var t=i.cancelPreSelectedNode;i.cancelPreSelectedNode=function(E,F){var G=z.getRoot(E).curSelectedList;for(var D=0,C=G.length;D<C;D++){if(!F||F===G[D]){i.removeTreeDom(E,G[D]);if(F){break}}}if(t){t.apply(i,arguments)}};var x=i.createNodes;i.createNodes=function(E,F,D,C){if(x){x.apply(i,arguments)}if(!D){return}if(i.repairParentChkClassWithSelf){i.repairParentChkClassWithSelf(E,C)}};var q=i.makeNodeUrl;i.makeNodeUrl=function(C,D){return C.edit.enable?null:(q.apply(i,arguments))};var a=i.removeNode;i.removeNode=function(D,E){var C=z.getRoot(D);if(C.curEditNode===E){C.curEditNode=null}if(a){a.apply(i,arguments)}};var A=i.selectNode;i.selectNode=function(E,F,D){var C=z.getRoot(E);if(z.isSelectedNode(E,F)&&C.curEditNode==F&&F.editNameFlag){return false}if(A){A.apply(i,arguments)}i.addHoverDom(E,F);return true};var e=u.uCanDo;u.uCanDo=function(D,E){var C=z.getRoot(D);if(E&&(u.eqs(E.type,"mouseover")||u.eqs(E.type,"mouseout")||u.eqs(E.type,"mousedown")||u.eqs(E.type,"mouseup"))){return true}return(!C.curEditNode)&&(e?e.apply(i,arguments):true)}})(jQuery);