tocmd 0.0.5
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +7 -0
- data/bin/tocmd +70 -0
- data/lib/mdpreview/markdown_render.rb +45 -0
- data/lib/mdpreview/translator.rb +237 -0
- data/lib/mdpreview/version.rb +3 -0
- data/lib/mdpreview.rb +18 -0
- data/test/mdptest.rb +100 -0
- data/vendor/cur.file +6 -0
- data/vendor/meta.js +1 -0
- data/vendor/template.html +0 -0
- data/vendor/toc/css/demo.css +33 -0
- data/vendor/toc/css/zTreeStyle/img/diy/1_close.png +0 -0
- data/vendor/toc/css/zTreeStyle/img/diy/1_open.png +0 -0
- data/vendor/toc/css/zTreeStyle/img/diy/2.png +0 -0
- data/vendor/toc/css/zTreeStyle/img/diy/3.png +0 -0
- data/vendor/toc/css/zTreeStyle/img/diy/4.png +0 -0
- data/vendor/toc/css/zTreeStyle/img/diy/5.png +0 -0
- data/vendor/toc/css/zTreeStyle/img/diy/6.png +0 -0
- data/vendor/toc/css/zTreeStyle/img/diy/7.png +0 -0
- data/vendor/toc/css/zTreeStyle/img/diy/8.png +0 -0
- data/vendor/toc/css/zTreeStyle/img/diy/9.png +0 -0
- data/vendor/toc/css/zTreeStyle/img/line_conn.gif +0 -0
- data/vendor/toc/css/zTreeStyle/img/loading.gif +0 -0
- data/vendor/toc/css/zTreeStyle/img/zTreeStandard.gif +0 -0
- data/vendor/toc/css/zTreeStyle/img/zTreeStandard.png +0 -0
- data/vendor/toc/css/zTreeStyle/zTreeStyle.css +97 -0
- data/vendor/toc/js/jquery-1.4.4.min.js +167 -0
- data/vendor/toc/js/jquery.ztree.all-3.5.js +3447 -0
- data/vendor/toc/js/jquery.ztree.all-3.5.min.js +157 -0
- data/vendor/toc/js/jquery.ztree.core-3.5.js +1644 -0
- data/vendor/toc/js/jquery.ztree.core-3.5.min.js +68 -0
- data/vendor/toc/js/jquery.ztree.excheck-3.5.js +624 -0
- data/vendor/toc/js/jquery.ztree.excheck-3.5.min.js +33 -0
- data/vendor/toc/js/jquery.ztree.exedit-3.5.js +1178 -0
- data/vendor/toc/js/jquery.ztree.exedit-3.5.min.js +52 -0
- data/vendor/toc/js/jquery.ztree.exhide-3.5.js +362 -0
- data/vendor/toc/js/jquery.ztree.exhide-3.5.min.js +22 -0
- data/vendor/toc/js/jquery.ztree_toc.js +224 -0
- data/vendor/toc/js/jquery.ztree_toc.min.js +4 -0
- data/vendor/toc/style/Clearness Dark.css +146 -0
- data/vendor/toc/style/Clearness.css +147 -0
- data/vendor/toc/style/GitHub.css +90 -0
- data/vendor/toc/style/GitHub2.css +297 -0
- data/vendor/toc/style/github-bf51422f4bb36427d391e4b75a1daa083c2d840e.css +1 -0
- data/vendor/toc/style/github2-d731afd4f624c99a4b19ad69f3083cd6d02b81d5.css +1 -0
- data/vendor/toc/style/makedownpad.css +285 -0
- metadata +90 -0
@@ -0,0 +1,52 @@
|
|
1
|
+
/*
|
2
|
+
* JQuery zTree exedit 3.5.02
|
3
|
+
* http://zTree.me/
|
4
|
+
*
|
5
|
+
* Copyright (c) 2010 Hunter.z
|
6
|
+
*
|
7
|
+
* Licensed same as jquery - MIT License
|
8
|
+
* http://www.opensource.org/licenses/mit-license.php
|
9
|
+
*
|
10
|
+
* email: hunter.z@263.net
|
11
|
+
* Date: 2013-01-28
|
12
|
+
*/
|
13
|
+
(function(k){var F={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"}},D={onHoverOverNode:function(b,a){var c=p.getSetting(b.data.treeId),d=p.getRoot(c);if(d.curHoverNode!=a)D.onHoverOutNode(b);d.curHoverNode=a;e.addHoverDom(c,a)},onHoverOutNode:function(b){var b=
|
14
|
+
p.getSetting(b.data.treeId),a=p.getRoot(b);if(a.curHoverNode&&!p.isSelectedNode(b,a.curHoverNode))e.removeTreeDom(b,a.curHoverNode),a.curHoverNode=null},onMousedownNode:function(b,a){function c(b){if(z.dragFlag==0&&Math.abs(K-b.clientX)<g.edit.drag.minMoveSize&&Math.abs(L-b.clientY)<g.edit.drag.minMoveSize)return!0;var a,c,f,j,l;l=g.data.key.children;k("body").css("cursor","pointer");if(z.dragFlag==0){if(h.apply(g.callback.beforeDrag,[g.treeId,m],!0)==!1)return q(b),!0;for(a=0,c=m.length;a<c;a++){if(a==
|
15
|
+
0)z.dragNodeShowBefore=[];f=m[a];f.isParent&&f.open?(e.expandCollapseNode(g,f,!f.open),z.dragNodeShowBefore[f.tId]=!0):z.dragNodeShowBefore[f.tId]=!1}z.dragFlag=1;z.showHoverDom=!1;h.showIfameMask(g,!0);f=!0;j=-1;if(m.length>1){var s=m[0].parentTId?m[0].getParentNode()[l]:p.getNodes(g);l=[];for(a=0,c=s.length;a<c;a++)if(z.dragNodeShowBefore[s[a].tId]!==void 0&&(f&&j>-1&&j+1!==a&&(f=!1),l.push(s[a]),j=a),m.length===l.length){m=l;break}}f&&(D=m[0].getPreNode(),E=m[m.length-1].getNextNode());y=k("<ul class='zTreeDragUL'></ul>");
|
16
|
+
for(a=0,c=m.length;a<c;a++)if(f=m[a],f.editNameFlag=!1,e.selectNode(g,f,a>0),e.removeTreeDom(g,f),j=k("<li id='"+f.tId+"_tmp'></li>"),j.append(k("#"+f.tId+d.id.A).clone()),j.css("padding","0"),j.children("#"+f.tId+d.id.A).removeClass(d.node.CURSELECTED),y.append(j),a==g.edit.drag.maxShowNodeNum-1){j=k("<li id='"+f.tId+"_moretmp'><a> ... </a></li>");y.append(j);break}y.attr("id",m[0].tId+d.id.UL+"_tmp");y.addClass(g.treeObj.attr("class"));y.appendTo("body");t=k("<span class='tmpzTreeMove_arrow'></span>");
|
17
|
+
t.attr("id","zTreeMove_arrow_tmp");t.appendTo("body");g.treeObj.trigger(d.event.DRAG,[b,g.treeId,m])}if(z.dragFlag==1){r&&t.attr("id")==b.target.id&&u&&b.clientX+x.scrollLeft()+2>k("#"+u+d.id.A,r).offset().left?(f=k("#"+u+d.id.A,r),b.target=f.length>0?f.get(0):b.target):r&&(r.removeClass(d.node.TMPTARGET_TREE),u&&k("#"+u+d.id.A,r).removeClass(d.node.TMPTARGET_NODE+"_"+d.move.TYPE_PREV).removeClass(d.node.TMPTARGET_NODE+"_"+F.move.TYPE_NEXT).removeClass(d.node.TMPTARGET_NODE+"_"+F.move.TYPE_INNER));
|
18
|
+
u=r=null;G=!1;i=g;f=p.getSettings();for(var B in f)if(f[B].treeId&&f[B].edit.enable&&f[B].treeId!=g.treeId&&(b.target.id==f[B].treeId||k(b.target).parents("#"+f[B].treeId).length>0))G=!0,i=f[B];B=x.scrollTop();j=x.scrollLeft();l=i.treeObj.offset();a=i.treeObj.get(0).scrollHeight;f=i.treeObj.get(0).scrollWidth;c=b.clientY+B-l.top;var o=i.treeObj.height()+l.top-b.clientY-B,n=b.clientX+j-l.left,H=i.treeObj.width()+l.left-b.clientX-j;l=c<g.edit.drag.borderMax&&c>g.edit.drag.borderMin;var s=o<g.edit.drag.borderMax&&
|
19
|
+
o>g.edit.drag.borderMin,I=n<g.edit.drag.borderMax&&n>g.edit.drag.borderMin,C=H<g.edit.drag.borderMax&&H>g.edit.drag.borderMin,o=c>g.edit.drag.borderMin&&o>g.edit.drag.borderMin&&n>g.edit.drag.borderMin&&H>g.edit.drag.borderMin,n=l&&i.treeObj.scrollTop()<=0,H=s&&i.treeObj.scrollTop()+i.treeObj.height()+10>=a,M=I&&i.treeObj.scrollLeft()<=0,N=C&&i.treeObj.scrollLeft()+i.treeObj.width()+10>=f;if(b.target.id&&i.treeObj.find("#"+b.target.id).length>0){for(var A=b.target;A&&A.tagName&&!h.eqs(A.tagName,"li")&&
|
20
|
+
A.id!=i.treeId;)A=A.parentNode;var O=!0;for(a=0,c=m.length;a<c;a++)if(f=m[a],A.id===f.tId){O=!1;break}else if(k("#"+f.tId).find("#"+A.id).length>0){O=!1;break}if(O&&b.target.id&&(b.target.id==A.id+d.id.A||k(b.target).parents("#"+A.id+d.id.A).length>0))r=k(A),u=A.id}f=m[0];if(o&&(b.target.id==i.treeId||k(b.target).parents("#"+i.treeId).length>0)){if(!r&&(b.target.id==i.treeId||n||H||M||N)&&(G||!G&&f.parentTId))r=i.treeObj;l?i.treeObj.scrollTop(i.treeObj.scrollTop()-10):s&&i.treeObj.scrollTop(i.treeObj.scrollTop()+
|
21
|
+
10);I?i.treeObj.scrollLeft(i.treeObj.scrollLeft()-10):C&&i.treeObj.scrollLeft(i.treeObj.scrollLeft()+10);r&&r!=i.treeObj&&r.offset().left<i.treeObj.offset().left&&i.treeObj.scrollLeft(i.treeObj.scrollLeft()+r.offset().left-i.treeObj.offset().left)}y.css({top:b.clientY+B+3+"px",left:b.clientX+j+3+"px"});l=a=0;if(r&&r.attr("id")!=i.treeId){var w=u==null?null:p.getNodeCache(i,u);c=b.ctrlKey&&g.edit.drag.isMove&&g.edit.drag.isCopy||!g.edit.drag.isMove&&g.edit.drag.isCopy;a=!!(D&&u===D.tId);l=!!(E&&u===
|
22
|
+
E.tId);j=f.parentTId&&f.parentTId==u;f=(c||!l)&&h.apply(i.edit.drag.prev,[i.treeId,m,w],!!i.edit.drag.prev);a=(c||!a)&&h.apply(i.edit.drag.next,[i.treeId,m,w],!!i.edit.drag.next);C=(c||!j)&&!(i.data.keep.leaf&&!w.isParent)&&h.apply(i.edit.drag.inner,[i.treeId,m,w],!!i.edit.drag.inner);if(!f&&!a&&!C){if(r=null,u="",v=d.move.TYPE_INNER,t.css({display:"none"}),window.zTreeMoveTimer)clearTimeout(window.zTreeMoveTimer),window.zTreeMoveTargetNodeTId=null}else{c=k("#"+u+d.id.A,r);l=w.isLastNode?null:k("#"+
|
23
|
+
w.getNextNode().tId+d.id.A,r.next());s=c.offset().top;j=c.offset().left;I=f?C?0.25:a?0.5:1:-1;C=a?C?0.75:f?0.5:0:-1;b=(b.clientY+B-s)/c.height();(I==1||b<=I&&b>=-0.2)&&f?(a=1-t.width(),l=s-t.height()/2,v=d.move.TYPE_PREV):(C==0||b>=C&&b<=1.2)&&a?(a=1-t.width(),l=l==null||w.isParent&&w.open?s+c.height()-t.height()/2:l.offset().top-t.height()/2,v=d.move.TYPE_NEXT):(a=5-t.width(),l=s,v=d.move.TYPE_INNER);t.css({display:"block",top:l+"px",left:j+a+"px"});c.addClass(d.node.TMPTARGET_NODE+"_"+v);if(P!=
|
24
|
+
u||Q!=v)J=(new Date).getTime();if(w&&w.isParent&&v==d.move.TYPE_INNER&&(b=!0,window.zTreeMoveTimer&&window.zTreeMoveTargetNodeTId!==w.tId?(clearTimeout(window.zTreeMoveTimer),window.zTreeMoveTargetNodeTId=null):window.zTreeMoveTimer&&window.zTreeMoveTargetNodeTId===w.tId&&(b=!1),b))window.zTreeMoveTimer=setTimeout(function(){v==d.move.TYPE_INNER&&w&&w.isParent&&!w.open&&(new Date).getTime()-J>i.edit.drag.autoOpenTime&&h.apply(i.callback.beforeDragOpen,[i.treeId,w],!0)&&(e.switchNode(i,w),i.edit.drag.autoExpandTrigger&&
|
25
|
+
i.treeObj.trigger(d.event.EXPAND,[i.treeId,w]))},i.edit.drag.autoOpenTime+50),window.zTreeMoveTargetNodeTId=w.tId}}else if(v=d.move.TYPE_INNER,r&&h.apply(i.edit.drag.inner,[i.treeId,m,null],!!i.edit.drag.inner)?r.addClass(d.node.TMPTARGET_TREE):r=null,t.css({display:"none"}),window.zTreeMoveTimer)clearTimeout(window.zTreeMoveTimer),window.zTreeMoveTargetNodeTId=null;P=u;Q=v}return!1}function q(b){if(window.zTreeMoveTimer)clearTimeout(window.zTreeMoveTimer),window.zTreeMoveTargetNodeTId=null;Q=P=null;
|
26
|
+
x.unbind("mousemove",c);x.unbind("mouseup",q);x.unbind("selectstart",f);k("body").css("cursor","auto");r&&(r.removeClass(d.node.TMPTARGET_TREE),u&&k("#"+u+d.id.A,r).removeClass(d.node.TMPTARGET_NODE+"_"+d.move.TYPE_PREV).removeClass(d.node.TMPTARGET_NODE+"_"+F.move.TYPE_NEXT).removeClass(d.node.TMPTARGET_NODE+"_"+F.move.TYPE_INNER));h.showIfameMask(g,!1);z.showHoverDom=!0;if(z.dragFlag!=0){z.dragFlag=0;var a,l,j;for(a=0,l=m.length;a<l;a++)j=m[a],j.isParent&&z.dragNodeShowBefore[j.tId]&&!j.open&&(e.expandCollapseNode(g,
|
27
|
+
j,!j.open),delete z.dragNodeShowBefore[j.tId]);y&&y.remove();t&&t.remove();var o=b.ctrlKey&&g.edit.drag.isMove&&g.edit.drag.isCopy||!g.edit.drag.isMove&&g.edit.drag.isCopy;!o&&r&&u&&m[0].parentTId&&u==m[0].parentTId&&v==d.move.TYPE_INNER&&(r=null);if(r){var n=u==null?null:p.getNodeCache(i,u);if(h.apply(g.callback.beforeDrop,[i.treeId,m,n,v,o],!0)!=!1){var s=o?h.clone(m):m;a=function(){if(G){if(!o)for(var a=0,c=m.length;a<c;a++)e.removeNode(g,m[a]);if(v==d.move.TYPE_INNER)e.addNodes(i,n,s);else if(e.addNodes(i,
|
28
|
+
n.getParentNode(),s),v==d.move.TYPE_PREV)for(a=0,c=s.length;a<c;a++)e.moveNode(i,n,s[a],v,!1);else for(a=-1,c=s.length-1;a<c;c--)e.moveNode(i,n,s[c],v,!1)}else if(o&&v==d.move.TYPE_INNER)e.addNodes(i,n,s);else if(o&&e.addNodes(i,n.getParentNode(),s),v!=d.move.TYPE_NEXT)for(a=0,c=s.length;a<c;a++)e.moveNode(i,n,s[a],v,!1);else for(a=-1,c=s.length-1;a<c;c--)e.moveNode(i,n,s[c],v,!1);for(a=0,c=s.length;a<c;a++)e.selectNode(i,s[a],a>0);k("#"+s[0].tId).focus().blur();g.treeObj.trigger(d.event.DROP,[b,
|
29
|
+
i.treeId,s,n,v,o])};v==d.move.TYPE_INNER&&h.canAsync(i,n)?e.asyncNode(i,n,!1,a):a()}}else{for(a=0,l=m.length;a<l;a++)e.selectNode(i,m[a],a>0);g.treeObj.trigger(d.event.DROP,[b,g.treeId,m,null,null,null])}}}function f(){return!1}var l,j,g=p.getSetting(b.data.treeId),z=p.getRoot(g);if(b.button==2||!g.edit.enable||!g.edit.drag.isCopy&&!g.edit.drag.isMove)return!0;var o=b.target,n=p.getRoot(g).curSelectedList,m=[];if(p.isSelectedNode(g,a))for(l=0,j=n.length;l<j;l++){if(n[l].editNameFlag&&h.eqs(o.tagName,
|
30
|
+
"input")&&o.getAttribute("treeNode"+d.id.INPUT)!==null)return!0;m.push(n[l]);if(m[0].parentTId!==n[l].parentTId){m=[a];break}}else m=[a];e.editNodeBlur=!0;e.cancelCurEditNode(g,null,!0);var x=k(document),y,t,r,G=!1,i=g,D,E,P=null,Q=null,u=null,v=d.move.TYPE_INNER,K=b.clientX,L=b.clientY,J=(new Date).getTime();h.uCanDo(g)&&x.bind("mousemove",c);x.bind("mouseup",q);x.bind("selectstart",f);b.preventDefault&&b.preventDefault();return!0}};k.extend(!0,k.fn.zTree.consts,F);k.extend(!0,k.fn.zTree._z,{tools:{getAbs:function(b){b=
|
31
|
+
b.getBoundingClientRect();return[b.left,b.top]},inputFocus:function(b){b.get(0)&&(b.focus(),h.setCursorPosition(b.get(0),b.val().length))},inputSelect:function(b){b.get(0)&&(b.focus(),b.select())},setCursorPosition:function(b,a){if(b.setSelectionRange)b.focus(),b.setSelectionRange(a,a);else if(b.createTextRange){var c=b.createTextRange();c.collapse(!0);c.moveEnd("character",a);c.moveStart("character",a);c.select()}},showIfameMask:function(b,a){for(var c=p.getRoot(b);c.dragMaskList.length>0;)c.dragMaskList[0].remove(),
|
32
|
+
c.dragMaskList.shift();if(a)for(var d=k("iframe"),f=0,e=d.length;f<e;f++){var j=d.get(f),g=h.getAbs(j),j=k("<div id='zTreeMask_"+f+"' class='zTreeMask' style='top:"+g[1]+"px; left:"+g[0]+"px; width:"+j.offsetWidth+"px; height:"+j.offsetHeight+"px;'></div>");j.appendTo("body");c.dragMaskList.push(j)}}},view:{addEditBtn:function(b,a){if(!(a.editNameFlag||k("#"+a.tId+d.id.EDIT).length>0)&&h.apply(b.edit.showRenameBtn,[b.treeId,a],b.edit.showRenameBtn)){var c=k("#"+a.tId+d.id.A),q="<span class='button edit' id='"+
|
33
|
+
a.tId+d.id.EDIT+"' title='"+h.apply(b.edit.renameTitle,[b.treeId,a],b.edit.renameTitle)+"' treeNode"+d.id.EDIT+" style='display:none;'></span>";c.append(q);k("#"+a.tId+d.id.EDIT).bind("click",function(){if(!h.uCanDo(b)||h.apply(b.callback.beforeEditName,[b.treeId,a],!0)==!1)return!1;e.editNode(b,a);return!1}).show()}},addRemoveBtn:function(b,a){if(!(a.editNameFlag||k("#"+a.tId+d.id.REMOVE).length>0)&&h.apply(b.edit.showRemoveBtn,[b.treeId,a],b.edit.showRemoveBtn)){var c=k("#"+a.tId+d.id.A),q="<span class='button remove' id='"+
|
34
|
+
a.tId+d.id.REMOVE+"' title='"+h.apply(b.edit.removeTitle,[b.treeId,a],b.edit.removeTitle)+"' treeNode"+d.id.REMOVE+" style='display:none;'></span>";c.append(q);k("#"+a.tId+d.id.REMOVE).bind("click",function(){if(!h.uCanDo(b)||h.apply(b.callback.beforeRemove,[b.treeId,a],!0)==!1)return!1;e.removeNode(b,a);b.treeObj.trigger(d.event.REMOVE,[b.treeId,a]);return!1}).bind("mousedown",function(){return!0}).show()}},addHoverDom:function(b,a){if(p.getRoot(b).showHoverDom)a.isHover=!0,b.edit.enable&&(e.addEditBtn(b,
|
35
|
+
a),e.addRemoveBtn(b,a)),h.apply(b.view.addHoverDom,[b.treeId,a])},cancelCurEditNode:function(b,a){var c=p.getRoot(b),q=b.data.key.name,f=c.curEditNode;if(f){var l=c.curEditInput,j=a?a:l.val();if(!a&&h.apply(b.callback.beforeRename,[b.treeId,f,j],!0)===!1)return!1;else f[q]=j?j:l.val(),a||b.treeObj.trigger(d.event.RENAME,[b.treeId,f]);k("#"+f.tId+d.id.A).removeClass(d.node.CURSELECTED_EDIT);l.unbind();e.setNodeName(b,f);f.editNameFlag=!1;c.curEditNode=null;c.curEditInput=null;e.selectNode(b,f,!1)}return c.noSelection=
|
36
|
+
!0},editNode:function(b,a){var c=p.getRoot(b);e.editNodeBlur=!1;if(p.isSelectedNode(b,a)&&c.curEditNode==a&&a.editNameFlag)setTimeout(function(){h.inputFocus(c.curEditInput)},0);else{var q=b.data.key.name;a.editNameFlag=!0;e.removeTreeDom(b,a);e.cancelCurEditNode(b);e.selectNode(b,a,!1);k("#"+a.tId+d.id.SPAN).html("<input type=text class='rename' id='"+a.tId+d.id.INPUT+"' treeNode"+d.id.INPUT+" >");var f=k("#"+a.tId+d.id.INPUT);f.attr("value",a[q]);b.edit.editNameSelectAll?h.inputSelect(f):h.inputFocus(f);
|
37
|
+
f.bind("blur",function(){e.editNodeBlur||e.cancelCurEditNode(b)}).bind("keydown",function(c){c.keyCode=="13"?(e.editNodeBlur=!0,e.cancelCurEditNode(b,null,!0)):c.keyCode=="27"&&e.cancelCurEditNode(b,a[q])}).bind("click",function(){return!1}).bind("dblclick",function(){return!1});k("#"+a.tId+d.id.A).addClass(d.node.CURSELECTED_EDIT);c.curEditInput=f;c.noSelection=!1;c.curEditNode=a}},moveNode:function(b,a,c,q,f,l){var j=p.getRoot(b),g=b.data.key.children;if(a!=c&&(!b.data.keep.leaf||!a||a.isParent||
|
38
|
+
q!=d.move.TYPE_INNER)){var h=c.parentTId?c.getParentNode():j,o=a===null||a==j;o&&a===null&&(a=j);if(o)q=d.move.TYPE_INNER;j=a.parentTId?a.getParentNode():j;if(q!=d.move.TYPE_PREV&&q!=d.move.TYPE_NEXT)q=d.move.TYPE_INNER;if(q==d.move.TYPE_INNER)if(o)c.parentTId=null;else{if(!a.isParent)a.isParent=!0,a.open=!!a.open,e.setNodeLineIcos(b,a);c.parentTId=a.tId}var n;o?n=o=b.treeObj:(!l&&q==d.move.TYPE_INNER?e.expandCollapseNode(b,a,!0,!1):l||e.expandCollapseNode(b,a.getParentNode(),!0,!1),o=k("#"+a.tId),
|
39
|
+
n=k("#"+a.tId+d.id.UL),o.get(0)&&!n.get(0)&&(n=[],e.makeUlHtml(b,a,n,""),o.append(n.join(""))),n=k("#"+a.tId+d.id.UL));var m=k("#"+c.tId);m.get(0)?o.get(0)||m.remove():m=e.appendNodes(b,c.level,[c],null,!1,!0).join("");n.get(0)&&q==d.move.TYPE_INNER?n.append(m):o.get(0)&&q==d.move.TYPE_PREV?o.before(m):o.get(0)&&q==d.move.TYPE_NEXT&&o.after(m);var x=-1,y=0,t=null,o=null,r=c.level;if(c.isFirstNode){if(x=0,h[g].length>1)t=h[g][1],t.isFirstNode=!0}else if(c.isLastNode)x=h[g].length-1,t=h[g][x-1],t.isLastNode=
|
40
|
+
!0;else for(n=0,m=h[g].length;n<m;n++)if(h[g][n].tId==c.tId){x=n;break}x>=0&&h[g].splice(x,1);if(q!=d.move.TYPE_INNER)for(n=0,m=j[g].length;n<m;n++)j[g][n].tId==a.tId&&(y=n);if(q==d.move.TYPE_INNER){a[g]||(a[g]=[]);if(a[g].length>0)o=a[g][a[g].length-1],o.isLastNode=!1;a[g].splice(a[g].length,0,c);c.isLastNode=!0;c.isFirstNode=a[g].length==1}else a.isFirstNode&&q==d.move.TYPE_PREV?(j[g].splice(y,0,c),o=a,o.isFirstNode=!1,c.parentTId=a.parentTId,c.isFirstNode=!0,c.isLastNode=!1):a.isLastNode&&q==d.move.TYPE_NEXT?
|
41
|
+
(j[g].splice(y+1,0,c),o=a,o.isLastNode=!1,c.parentTId=a.parentTId,c.isFirstNode=!1,c.isLastNode=!0):(q==d.move.TYPE_PREV?j[g].splice(y,0,c):j[g].splice(y+1,0,c),c.parentTId=a.parentTId,c.isFirstNode=!1,c.isLastNode=!1);p.fixPIdKeyValue(b,c);p.setSonNodeLevel(b,c.getParentNode(),c);e.setNodeLineIcos(b,c);e.repairNodeLevelClass(b,c,r);!b.data.keep.parent&&h[g].length<1?(h.isParent=!1,h.open=!1,a=k("#"+h.tId+d.id.UL),q=k("#"+h.tId+d.id.SWITCH),g=k("#"+h.tId+d.id.ICON),e.replaceSwitchClass(h,q,d.folder.DOCU),
|
42
|
+
e.replaceIcoClass(h,g,d.folder.DOCU),a.css("display","none")):t&&e.setNodeLineIcos(b,t);o&&e.setNodeLineIcos(b,o);b.check&&b.check.enable&&e.repairChkClass&&(e.repairChkClass(b,h),e.repairParentChkClassWithSelf(b,h),h!=c.parent&&e.repairParentChkClassWithSelf(b,c));l||e.expandCollapseParentNode(b,c.getParentNode(),!0,f)}},removeEditBtn:function(b){k("#"+b.tId+d.id.EDIT).unbind().remove()},removeRemoveBtn:function(b){k("#"+b.tId+d.id.REMOVE).unbind().remove()},removeTreeDom:function(b,a){a.isHover=
|
43
|
+
!1;e.removeEditBtn(a);e.removeRemoveBtn(a);h.apply(b.view.removeHoverDom,[b.treeId,a])},repairNodeLevelClass:function(b,a,c){if(c!==a.level){var b=k("#"+a.tId),e=k("#"+a.tId+d.id.A),f=k("#"+a.tId+d.id.UL),c="level"+c,a="level"+a.level;b.removeClass(c);b.addClass(a);e.removeClass(c);e.addClass(a);f.removeClass(c);f.addClass(a)}}},event:{},data:{setSonNodeLevel:function(b,a,c){if(c){var d=b.data.key.children;c.level=a?a.level+1:0;if(c[d])for(var a=0,f=c[d].length;a<f;a++)c[d][a]&&p.setSonNodeLevel(b,
|
44
|
+
c,c[d][a])}}}});var E=k.fn.zTree,h=E._z.tools,d=E.consts,e=E._z.view,p=E._z.data;p.exSetting({edit:{enable:!1,editNameSelectAll:!1,showRemoveBtn:!0,showRenameBtn:!0,removeTitle:"remove",renameTitle:"rename",drag:{autoExpandTrigger:!1,isCopy:!0,isMove:!0,prev:!0,next:!0,inner:!0,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,
|
45
|
+
onDrop:null,onRename:null}});p.addInitBind(function(b){var a=b.treeObj,c=d.event;a.bind(c.RENAME,function(a,c,d){h.apply(b.callback.onRename,[a,c,d])});a.bind(c.REMOVE,function(a,c,d){h.apply(b.callback.onRemove,[a,c,d])});a.bind(c.DRAG,function(a,c,d,e){h.apply(b.callback.onDrag,[c,d,e])});a.bind(c.DROP,function(a,c,d,e,g,k,o){h.apply(b.callback.onDrop,[c,d,e,g,k,o])})});p.addInitUnBind(function(b){var b=b.treeObj,a=d.event;b.unbind(a.RENAME);b.unbind(a.REMOVE);b.unbind(a.DRAG);b.unbind(a.DROP)});
|
46
|
+
p.addInitCache(function(){});p.addInitNode(function(b,a,c){if(c)c.isHover=!1,c.editNameFlag=!1});p.addInitProxy(function(b){var a=b.target,c=p.getSetting(b.data.treeId),e=b.relatedTarget,f="",l=null,j="",g=null,k=null;if(h.eqs(b.type,"mouseover")){if(k=h.getMDom(c,a,[{tagName:"a",attrName:"treeNode"+d.id.A}]))f=k.parentNode.id,j="hoverOverNode"}else if(h.eqs(b.type,"mouseout"))k=h.getMDom(c,e,[{tagName:"a",attrName:"treeNode"+d.id.A}]),k||(f="remove",j="hoverOutNode");else if(h.eqs(b.type,"mousedown")&&
|
47
|
+
(k=h.getMDom(c,a,[{tagName:"a",attrName:"treeNode"+d.id.A}])))f=k.parentNode.id,j="mousedownNode";if(f.length>0)switch(l=p.getNodeCache(c,f),j){case "mousedownNode":g=D.onMousedownNode;break;case "hoverOverNode":g=D.onHoverOverNode;break;case "hoverOutNode":g=D.onHoverOutNode}return{stop:!1,node:l,nodeEventType:j,nodeEventCallback:g,treeEventType:"",treeEventCallback:null}});p.addInitRoot(function(b){b=p.getRoot(b);b.curEditNode=null;b.curEditInput=null;b.curHoverNode=null;b.dragFlag=0;b.dragNodeShowBefore=
|
48
|
+
[];b.dragMaskList=[];b.showHoverDom=!0});p.addZTreeTools(function(b,a){a.cancelEditName=function(a){var d=p.getRoot(b),f=b.data.key.name,h=d.curEditNode;d.curEditNode&&e.cancelCurEditNode(b,a?a:h[f])};a.copyNode=function(a,k,f,l){if(!k)return null;if(a&&!a.isParent&&b.data.keep.leaf&&f===d.move.TYPE_INNER)return null;var j=h.clone(k);if(!a)a=null,f=d.move.TYPE_INNER;f==d.move.TYPE_INNER?(k=function(){e.addNodes(b,a,[j],l)},h.canAsync(b,a)?e.asyncNode(b,a,l,k):k()):(e.addNodes(b,a.parentNode,[j],l),
|
49
|
+
e.moveNode(b,a,j,f,!1,l));return j};a.editName=function(a){a&&a.tId&&a===p.getNodeCache(b,a.tId)&&(a.parentTId&&e.expandCollapseParentNode(b,a.getParentNode(),!0),e.editNode(b,a))};a.moveNode=function(a,q,f,l){function j(){e.moveNode(b,a,q,f,!1,l)}if(!q)return q;if(a&&!a.isParent&&b.data.keep.leaf&&f===d.move.TYPE_INNER)return null;else if(a&&(q.parentTId==a.tId&&f==d.move.TYPE_INNER||k("#"+q.tId).find("#"+a.tId).length>0))return null;else a||(a=null);h.canAsync(b,a)?e.asyncNode(b,a,l,j):j();return q};
|
50
|
+
a.setEditable=function(a){b.edit.enable=a;return this.refresh()}});var K=e.cancelPreSelectedNode;e.cancelPreSelectedNode=function(b,a){for(var c=p.getRoot(b).curSelectedList,d=0,f=c.length;d<f;d++)if(!a||a===c[d])if(e.removeTreeDom(b,c[d]),a)break;K&&K.apply(e,arguments)};var L=e.createNodes;e.createNodes=function(b,a,c,d){L&&L.apply(e,arguments);c&&e.repairParentChkClassWithSelf&&e.repairParentChkClassWithSelf(b,d)};var R=e.makeNodeUrl;e.makeNodeUrl=function(b,a){return b.edit.enable?null:R.apply(e,
|
51
|
+
arguments)};var J=e.removeNode;e.removeNode=function(b,a){var c=p.getRoot(b);if(c.curEditNode===a)c.curEditNode=null;J&&J.apply(e,arguments)};var M=e.selectNode;e.selectNode=function(b,a,c){var d=p.getRoot(b);if(p.isSelectedNode(b,a)&&d.curEditNode==a&&a.editNameFlag)return!1;M&&M.apply(e,arguments);e.addHoverDom(b,a);return!0};var N=h.uCanDo;h.uCanDo=function(b,a){var c=p.getRoot(b);return a&&(h.eqs(a.type,"mouseover")||h.eqs(a.type,"mouseout")||h.eqs(a.type,"mousedown")||h.eqs(a.type,"mouseup"))?
|
52
|
+
!0:!c.curEditNode&&(N?N.apply(e,arguments):!0)}})(jQuery);
|
@@ -0,0 +1,362 @@
|
|
1
|
+
/*
|
2
|
+
* JQuery zTree exHideNodes 3.5.02
|
3
|
+
* http://zTree.me/
|
4
|
+
*
|
5
|
+
* Copyright (c) 2010 Hunter.z
|
6
|
+
*
|
7
|
+
* Licensed same as jquery - MIT License
|
8
|
+
* http://www.opensource.org/licenses/mit-license.php
|
9
|
+
*
|
10
|
+
* email: hunter.z@263.net
|
11
|
+
* Date: 2013-01-28
|
12
|
+
*/
|
13
|
+
(function($){
|
14
|
+
//default init node of exLib
|
15
|
+
var _initNode = function(setting, level, n, parentNode, isFirstNode, isLastNode, openFlag) {
|
16
|
+
if (typeof n.isHidden == "string") n.isHidden = tools.eqs(n.isHidden, "true");
|
17
|
+
n.isHidden = !!n.isHidden;
|
18
|
+
data.initHideForExCheck(setting, n);
|
19
|
+
},
|
20
|
+
//add dom for check
|
21
|
+
_beforeA = function(setting, node, html) {},
|
22
|
+
//update zTreeObj, add method of exLib
|
23
|
+
_zTreeTools = function(setting, zTreeTools) {
|
24
|
+
zTreeTools.showNodes = function(nodes, options) {
|
25
|
+
view.showNodes(setting, nodes, options);
|
26
|
+
}
|
27
|
+
zTreeTools.showNode = function(node, options) {
|
28
|
+
if (!node) {
|
29
|
+
return;
|
30
|
+
}
|
31
|
+
view.showNodes(setting, [node], options);
|
32
|
+
}
|
33
|
+
zTreeTools.hideNodes = function(nodes, options) {
|
34
|
+
view.hideNodes(setting, nodes, options);
|
35
|
+
}
|
36
|
+
zTreeTools.hideNode = function(node, options) {
|
37
|
+
if (!node) {
|
38
|
+
return;
|
39
|
+
}
|
40
|
+
view.hideNodes(setting, [node], options);
|
41
|
+
}
|
42
|
+
|
43
|
+
var _checkNode = zTreeTools.checkNode;
|
44
|
+
if (_checkNode) {
|
45
|
+
zTreeTools.checkNode = function(node, checked, checkTypeFlag, callbackFlag) {
|
46
|
+
if (!!node && !!node.isHidden) {
|
47
|
+
return;
|
48
|
+
}
|
49
|
+
_checkNode.apply(zTreeTools, arguments);
|
50
|
+
}
|
51
|
+
}
|
52
|
+
},
|
53
|
+
//method of operate data
|
54
|
+
_data = {
|
55
|
+
initHideForExCheck: function(setting, n) {
|
56
|
+
if (n.isHidden && setting.check && setting.check.enable) {
|
57
|
+
n._nocheck = !!n.nocheck
|
58
|
+
n.nocheck = true;
|
59
|
+
n.check_Child_State = -1;
|
60
|
+
if (view.repairParentChkClassWithSelf) {
|
61
|
+
view.repairParentChkClassWithSelf(setting, n);
|
62
|
+
}
|
63
|
+
}
|
64
|
+
},
|
65
|
+
initShowForExCheck: function(setting, n) {
|
66
|
+
if (!n.isHidden && setting.check && setting.check.enable) {
|
67
|
+
n.nocheck = n._nocheck;
|
68
|
+
delete n._nocheck;
|
69
|
+
if (view.setChkClass) {
|
70
|
+
var checkObj = $("#" + n.tId + consts.id.CHECK);
|
71
|
+
view.setChkClass(setting, checkObj, n);
|
72
|
+
}
|
73
|
+
if (view.repairParentChkClassWithSelf) {
|
74
|
+
view.repairParentChkClassWithSelf(setting, n);
|
75
|
+
}
|
76
|
+
}
|
77
|
+
}
|
78
|
+
},
|
79
|
+
//method of operate ztree dom
|
80
|
+
_view = {
|
81
|
+
clearOldFirstNode: function(setting, node) {
|
82
|
+
var n = node.getNextNode();
|
83
|
+
while(!!n){
|
84
|
+
if (n.isFirstNode) {
|
85
|
+
n.isFirstNode = false;
|
86
|
+
view.setNodeLineIcos(setting, n);
|
87
|
+
break;
|
88
|
+
}
|
89
|
+
if (n.isLastNode) {
|
90
|
+
break;
|
91
|
+
}
|
92
|
+
n = n.getNextNode();
|
93
|
+
}
|
94
|
+
},
|
95
|
+
clearOldLastNode: function(setting, node) {
|
96
|
+
var n = node.getPreNode();
|
97
|
+
while(!!n){
|
98
|
+
if (n.isLastNode) {
|
99
|
+
n.isLastNode = false;
|
100
|
+
view.setNodeLineIcos(setting, n);
|
101
|
+
break;
|
102
|
+
}
|
103
|
+
if (n.isFirstNode) {
|
104
|
+
break;
|
105
|
+
}
|
106
|
+
n = n.getPreNode();
|
107
|
+
}
|
108
|
+
},
|
109
|
+
makeDOMNodeMainBefore: function(html, setting, node) {
|
110
|
+
html.push("<li ", (node.isHidden ? "style='display:none;' " : ""), "id='", node.tId, "' class='level", node.level,"' tabindex='0' hidefocus='true' treenode>");
|
111
|
+
},
|
112
|
+
showNode: function(setting, node, options) {
|
113
|
+
node.isHidden = false;
|
114
|
+
data.initShowForExCheck(setting, node);
|
115
|
+
$("#" + node.tId).show();
|
116
|
+
},
|
117
|
+
showNodes: function(setting, nodes, options) {
|
118
|
+
if (!nodes || nodes.length == 0) {
|
119
|
+
return;
|
120
|
+
}
|
121
|
+
var pList = {}, i, j;
|
122
|
+
for (i=0, j=nodes.length; i<j; i++) {
|
123
|
+
var n = nodes[i];
|
124
|
+
if (!pList[n.parentTId]) {
|
125
|
+
var pn = n.getParentNode();
|
126
|
+
pList[n.parentTId] = (pn === null) ? data.getRoot(setting) : n.getParentNode();
|
127
|
+
}
|
128
|
+
view.showNode(setting, n, options);
|
129
|
+
}
|
130
|
+
for (var tId in pList) {
|
131
|
+
var children = pList[tId][setting.data.key.children];
|
132
|
+
view.setFirstNodeForShow(setting, children);
|
133
|
+
view.setLastNodeForShow(setting, children);
|
134
|
+
}
|
135
|
+
},
|
136
|
+
hideNode: function(setting, node, options) {
|
137
|
+
node.isHidden = true;
|
138
|
+
node.isFirstNode = false;
|
139
|
+
node.isLastNode = false;
|
140
|
+
data.initHideForExCheck(setting, node);
|
141
|
+
view.cancelPreSelectedNode(setting, node);
|
142
|
+
$("#" + node.tId).hide();
|
143
|
+
},
|
144
|
+
hideNodes: function(setting, nodes, options) {
|
145
|
+
if (!nodes || nodes.length == 0) {
|
146
|
+
return;
|
147
|
+
}
|
148
|
+
var pList = {}, i, j;
|
149
|
+
for (i=0, j=nodes.length; i<j; i++) {
|
150
|
+
var n = nodes[i];
|
151
|
+
if ((n.isFirstNode || n.isLastNode) && !pList[n.parentTId]) {
|
152
|
+
var pn = n.getParentNode();
|
153
|
+
pList[n.parentTId] = (pn === null) ? data.getRoot(setting) : n.getParentNode();
|
154
|
+
}
|
155
|
+
view.hideNode(setting, n, options);
|
156
|
+
}
|
157
|
+
for (var tId in pList) {
|
158
|
+
var children = pList[tId][setting.data.key.children];
|
159
|
+
view.setFirstNodeForHide(setting, children);
|
160
|
+
view.setLastNodeForHide(setting, children);
|
161
|
+
}
|
162
|
+
},
|
163
|
+
setFirstNode: function(setting, parentNode) {
|
164
|
+
var childKey = setting.data.key.children, childLength = parentNode[childKey].length;
|
165
|
+
if (childLength > 0 && !parentNode[childKey][0].isHidden) {
|
166
|
+
parentNode[childKey][0].isFirstNode = true;
|
167
|
+
} else if (childLength > 0) {
|
168
|
+
view.setFirstNodeForHide(setting, parentNode[childKey]);
|
169
|
+
}
|
170
|
+
},
|
171
|
+
setLastNode: function(setting, parentNode) {
|
172
|
+
var childKey = setting.data.key.children, childLength = parentNode[childKey].length;
|
173
|
+
if (childLength > 0 && !parentNode[childKey][0].isHidden) {
|
174
|
+
parentNode[childKey][childLength - 1].isLastNode = true;
|
175
|
+
} else if (childLength > 0) {
|
176
|
+
view.setLastNodeForHide(setting, parentNode[childKey]);
|
177
|
+
}
|
178
|
+
},
|
179
|
+
setFirstNodeForHide: function(setting, nodes) {
|
180
|
+
var n,i,j;
|
181
|
+
for (i=0, j=nodes.length; i<j; i++) {
|
182
|
+
n = nodes[i];
|
183
|
+
if (n.isFirstNode) {
|
184
|
+
break;
|
185
|
+
}
|
186
|
+
if (!n.isHidden && !n.isFirstNode) {
|
187
|
+
n.isFirstNode = true;
|
188
|
+
view.setNodeLineIcos(setting, n);
|
189
|
+
break;
|
190
|
+
} else {
|
191
|
+
n = null;
|
192
|
+
}
|
193
|
+
}
|
194
|
+
return n;
|
195
|
+
},
|
196
|
+
setFirstNodeForShow: function(setting, nodes) {
|
197
|
+
var n,i,j, first, old;
|
198
|
+
for(i=0, j=nodes.length; i<j; i++) {
|
199
|
+
n = nodes[i];
|
200
|
+
if (!first && !n.isHidden && n.isFirstNode) {
|
201
|
+
first = n;
|
202
|
+
break;
|
203
|
+
} else if (!first && !n.isHidden && !n.isFirstNode) {
|
204
|
+
n.isFirstNode = true;
|
205
|
+
first = n;
|
206
|
+
view.setNodeLineIcos(setting, n);
|
207
|
+
} else if (first && n.isFirstNode) {
|
208
|
+
n.isFirstNode = false;
|
209
|
+
old = n;
|
210
|
+
view.setNodeLineIcos(setting, n);
|
211
|
+
break;
|
212
|
+
} else {
|
213
|
+
n = null;
|
214
|
+
}
|
215
|
+
}
|
216
|
+
return {"new":first, "old":old};
|
217
|
+
},
|
218
|
+
setLastNodeForHide: function(setting, nodes) {
|
219
|
+
var n,i;
|
220
|
+
for (i=nodes.length-1; i>=0; i--) {
|
221
|
+
n = nodes[i];
|
222
|
+
if (n.isLastNode) {
|
223
|
+
break;
|
224
|
+
}
|
225
|
+
if (!n.isHidden && !n.isLastNode) {
|
226
|
+
n.isLastNode = true;
|
227
|
+
view.setNodeLineIcos(setting, n);
|
228
|
+
break;
|
229
|
+
} else {
|
230
|
+
n = null;
|
231
|
+
}
|
232
|
+
}
|
233
|
+
return n;
|
234
|
+
},
|
235
|
+
setLastNodeForShow: function(setting, nodes) {
|
236
|
+
var n,i,j, last, old;
|
237
|
+
for (i=nodes.length-1; i>=0; i--) {
|
238
|
+
n = nodes[i];
|
239
|
+
if (!last && !n.isHidden && n.isLastNode) {
|
240
|
+
last = n;
|
241
|
+
break;
|
242
|
+
} else if (!last && !n.isHidden && !n.isLastNode) {
|
243
|
+
n.isLastNode = true;
|
244
|
+
last = n;
|
245
|
+
view.setNodeLineIcos(setting, n);
|
246
|
+
} else if (last && n.isLastNode) {
|
247
|
+
n.isLastNode = false;
|
248
|
+
old = n;
|
249
|
+
view.setNodeLineIcos(setting, n);
|
250
|
+
break;
|
251
|
+
} else {
|
252
|
+
n = null;
|
253
|
+
}
|
254
|
+
}
|
255
|
+
return {"new":last, "old":old};
|
256
|
+
}
|
257
|
+
},
|
258
|
+
|
259
|
+
_z = {
|
260
|
+
view: _view,
|
261
|
+
data: _data
|
262
|
+
};
|
263
|
+
$.extend(true, $.fn.zTree._z, _z);
|
264
|
+
|
265
|
+
var zt = $.fn.zTree,
|
266
|
+
tools = zt._z.tools,
|
267
|
+
consts = zt.consts,
|
268
|
+
view = zt._z.view,
|
269
|
+
data = zt._z.data,
|
270
|
+
event = zt._z.event;
|
271
|
+
|
272
|
+
data.addInitNode(_initNode);
|
273
|
+
data.addBeforeA(_beforeA);
|
274
|
+
data.addZTreeTools(_zTreeTools);
|
275
|
+
|
276
|
+
// Override method in core
|
277
|
+
var _dInitNode = data.initNode;
|
278
|
+
data.tmpHideParent = -1;
|
279
|
+
data.initNode = function(setting, level, node, parentNode, isFirstNode, isLastNode, openFlag) {
|
280
|
+
if (data.tmpHideParent !== parentNode) {
|
281
|
+
data.tmpHideParent = parentNode;
|
282
|
+
var tmpPNode = (parentNode) ? parentNode: data.getRoot(setting),
|
283
|
+
children = tmpPNode[setting.data.key.children];
|
284
|
+
data.tmpHideFirstNode = view.setFirstNodeForHide(setting, children);
|
285
|
+
data.tmpHideLastNode = view.setLastNodeForHide(setting, children);
|
286
|
+
view.setNodeLineIcos(setting, data.tmpHideFirstNode);
|
287
|
+
view.setNodeLineIcos(setting, data.tmpHideLastNode);
|
288
|
+
}
|
289
|
+
isFirstNode = (data.tmpHideFirstNode === node);
|
290
|
+
isLastNode = (data.tmpHideLastNode === node);
|
291
|
+
if (_dInitNode) _dInitNode.apply(data, arguments);
|
292
|
+
if (isLastNode) {
|
293
|
+
view.clearOldLastNode(setting, node);
|
294
|
+
}
|
295
|
+
}
|
296
|
+
|
297
|
+
var _makeChkFlag = data.makeChkFlag;
|
298
|
+
if (!!_makeChkFlag) {
|
299
|
+
data.makeChkFlag = function(setting, node) {
|
300
|
+
if (!!node && !!node.isHidden) {
|
301
|
+
return;
|
302
|
+
}
|
303
|
+
_makeChkFlag.apply(data, arguments);
|
304
|
+
}
|
305
|
+
}
|
306
|
+
|
307
|
+
var _getTreeCheckedNodes = data.getTreeCheckedNodes;
|
308
|
+
if (!!_getTreeCheckedNodes) {
|
309
|
+
data.getTreeCheckedNodes = function(setting, nodes, checked, results) {
|
310
|
+
if (!!nodes && nodes.length > 0) {
|
311
|
+
var p = nodes[0].getParentNode();
|
312
|
+
if (!!p && !!p.isHidden) {
|
313
|
+
return [];
|
314
|
+
}
|
315
|
+
}
|
316
|
+
return _getTreeCheckedNodes.apply(data, arguments);
|
317
|
+
}
|
318
|
+
}
|
319
|
+
|
320
|
+
var _getTreeChangeCheckedNodes = data.getTreeChangeCheckedNodes;
|
321
|
+
if (!!_getTreeChangeCheckedNodes) {
|
322
|
+
data.getTreeChangeCheckedNodes = function(setting, nodes, results) {
|
323
|
+
if (!!nodes && nodes.length > 0) {
|
324
|
+
var p = nodes[0].getParentNode();
|
325
|
+
if (!!p && !!p.isHidden) {
|
326
|
+
return [];
|
327
|
+
}
|
328
|
+
}
|
329
|
+
return _getTreeChangeCheckedNodes.apply(data, arguments);
|
330
|
+
}
|
331
|
+
}
|
332
|
+
|
333
|
+
var _expandCollapseSonNode = view.expandCollapseSonNode;
|
334
|
+
if (!!_expandCollapseSonNode) {
|
335
|
+
view.expandCollapseSonNode = function(setting, node, expandFlag, animateFlag, callback) {
|
336
|
+
if (!!node && !!node.isHidden) {
|
337
|
+
return;
|
338
|
+
}
|
339
|
+
_expandCollapseSonNode.apply(view, arguments);
|
340
|
+
}
|
341
|
+
}
|
342
|
+
|
343
|
+
var _setSonNodeCheckBox = view.setSonNodeCheckBox;
|
344
|
+
if (!!_setSonNodeCheckBox) {
|
345
|
+
view.setSonNodeCheckBox = function(setting, node, value, srcNode) {
|
346
|
+
if (!!node && !!node.isHidden) {
|
347
|
+
return;
|
348
|
+
}
|
349
|
+
_setSonNodeCheckBox.apply(view, arguments);
|
350
|
+
}
|
351
|
+
}
|
352
|
+
|
353
|
+
var _repairParentChkClassWithSelf = view.repairParentChkClassWithSelf;
|
354
|
+
if (!!_repairParentChkClassWithSelf) {
|
355
|
+
view.repairParentChkClassWithSelf = function(setting, node) {
|
356
|
+
if (!!node && !!node.isHidden) {
|
357
|
+
return;
|
358
|
+
}
|
359
|
+
_repairParentChkClassWithSelf.apply(view, arguments);
|
360
|
+
}
|
361
|
+
}
|
362
|
+
})(jQuery);
|
@@ -0,0 +1,22 @@
|
|
1
|
+
/*
|
2
|
+
* JQuery zTree exHideNodes 3.5.02
|
3
|
+
* http://zTree.me/
|
4
|
+
*
|
5
|
+
* Copyright (c) 2010 Hunter.z
|
6
|
+
*
|
7
|
+
* Licensed same as jquery - MIT License
|
8
|
+
* http://www.opensource.org/licenses/mit-license.php
|
9
|
+
*
|
10
|
+
* email: hunter.z@263.net
|
11
|
+
* Date: 2013-01-28
|
12
|
+
*/
|
13
|
+
(function(i){i.extend(!0,i.fn.zTree._z,{view:{clearOldFirstNode:function(c,b){for(var a=b.getNextNode();a;){if(a.isFirstNode){a.isFirstNode=!1;f.setNodeLineIcos(c,a);break}if(a.isLastNode)break;a=a.getNextNode()}},clearOldLastNode:function(c,b){for(var a=b.getPreNode();a;){if(a.isLastNode){a.isLastNode=!1;f.setNodeLineIcos(c,a);break}if(a.isFirstNode)break;a=a.getPreNode()}},makeDOMNodeMainBefore:function(c,b,a){c.push("<li ",a.isHidden?"style='display:none;' ":"","id='",a.tId,"' class='level",a.level,
|
14
|
+
"' tabindex='0' hidefocus='true' treenode>")},showNode:function(c,b){b.isHidden=!1;e.initShowForExCheck(c,b);i("#"+b.tId).show()},showNodes:function(c,b,a){if(b&&b.length!=0){var d={},h,j;for(h=0,j=b.length;h<j;h++){var g=b[h];if(!d[g.parentTId]){var i=g.getParentNode();d[g.parentTId]=i===null?e.getRoot(c):g.getParentNode()}f.showNode(c,g,a)}for(var k in d)b=d[k][c.data.key.children],f.setFirstNodeForShow(c,b),f.setLastNodeForShow(c,b)}},hideNode:function(c,b){b.isHidden=!0;b.isFirstNode=!1;b.isLastNode=
|
15
|
+
!1;e.initHideForExCheck(c,b);f.cancelPreSelectedNode(c,b);i("#"+b.tId).hide()},hideNodes:function(c,b,a){if(b&&b.length!=0){var d={},h,j;for(h=0,j=b.length;h<j;h++){var g=b[h];if((g.isFirstNode||g.isLastNode)&&!d[g.parentTId]){var i=g.getParentNode();d[g.parentTId]=i===null?e.getRoot(c):g.getParentNode()}f.hideNode(c,g,a)}for(var k in d)b=d[k][c.data.key.children],f.setFirstNodeForHide(c,b),f.setLastNodeForHide(c,b)}},setFirstNode:function(c,b){var a=c.data.key.children,d=b[a].length;d>0&&!b[a][0].isHidden?
|
16
|
+
b[a][0].isFirstNode=!0:d>0&&f.setFirstNodeForHide(c,b[a])},setLastNode:function(c,b){var a=c.data.key.children,d=b[a].length;d>0&&!b[a][0].isHidden?b[a][d-1].isLastNode=!0:d>0&&f.setLastNodeForHide(c,b[a])},setFirstNodeForHide:function(c,b){var a,d,h;for(d=0,h=b.length;d<h;d++){a=b[d];if(a.isFirstNode)break;if(!a.isHidden&&!a.isFirstNode){a.isFirstNode=!0;f.setNodeLineIcos(c,a);break}else a=null}return a},setFirstNodeForShow:function(c,b){var a,d,h,e,g;for(d=0,h=b.length;d<h;d++)if(a=b[d],!e&&!a.isHidden&&
|
17
|
+
a.isFirstNode){e=a;break}else if(!e&&!a.isHidden&&!a.isFirstNode)a.isFirstNode=!0,e=a,f.setNodeLineIcos(c,a);else if(e&&a.isFirstNode){a.isFirstNode=!1;g=a;f.setNodeLineIcos(c,a);break}return{"new":e,old:g}},setLastNodeForHide:function(c,b){var a,d;for(d=b.length-1;d>=0;d--){a=b[d];if(a.isLastNode)break;if(!a.isHidden&&!a.isLastNode){a.isLastNode=!0;f.setNodeLineIcos(c,a);break}else a=null}return a},setLastNodeForShow:function(c,b){var a,d,e,j;for(d=b.length-1;d>=0;d--)if(a=b[d],!e&&!a.isHidden&&
|
18
|
+
a.isLastNode){e=a;break}else if(!e&&!a.isHidden&&!a.isLastNode)a.isLastNode=!0,e=a,f.setNodeLineIcos(c,a);else if(e&&a.isLastNode){a.isLastNode=!1;j=a;f.setNodeLineIcos(c,a);break}return{"new":e,old:j}}},data:{initHideForExCheck:function(c,b){if(b.isHidden&&c.check&&c.check.enable)b._nocheck=!!b.nocheck,b.nocheck=!0,b.check_Child_State=-1,f.repairParentChkClassWithSelf&&f.repairParentChkClassWithSelf(c,b)},initShowForExCheck:function(c,b){if(!b.isHidden&&c.check&&c.check.enable){b.nocheck=b._nocheck;
|
19
|
+
delete b._nocheck;if(f.setChkClass){var a=i("#"+b.tId+s.id.CHECK);f.setChkClass(c,a,b)}f.repairParentChkClassWithSelf&&f.repairParentChkClassWithSelf(c,b)}}}});var k=i.fn.zTree,t=k._z.tools,s=k.consts,f=k._z.view,e=k._z.data;e.addInitNode(function(c,b,a){if(typeof a.isHidden=="string")a.isHidden=t.eqs(a.isHidden,"true");a.isHidden=!!a.isHidden;e.initHideForExCheck(c,a)});e.addBeforeA(function(){});e.addZTreeTools(function(c,b){b.showNodes=function(a,b){f.showNodes(c,a,b)};b.showNode=function(a,b){a&&
|
20
|
+
f.showNodes(c,[a],b)};b.hideNodes=function(a,b){f.hideNodes(c,a,b)};b.hideNode=function(a,b){a&&f.hideNodes(c,[a],b)};var a=b.checkNode;if(a)b.checkNode=function(c,e,f,g){(!c||!c.isHidden)&&a.apply(b,arguments)}});var l=e.initNode;e.tmpHideParent=-1;e.initNode=function(c,b,a,d,h,j,g){if(e.tmpHideParent!==d){e.tmpHideParent=d;var i=(d?d:e.getRoot(c))[c.data.key.children];e.tmpHideFirstNode=f.setFirstNodeForHide(c,i);e.tmpHideLastNode=f.setLastNodeForHide(c,i);f.setNodeLineIcos(c,e.tmpHideFirstNode);
|
21
|
+
f.setNodeLineIcos(c,e.tmpHideLastNode)}h=e.tmpHideFirstNode===a;j=e.tmpHideLastNode===a;l&&l.apply(e,arguments);j&&f.clearOldLastNode(c,a)};var m=e.makeChkFlag;if(m)e.makeChkFlag=function(c,b){(!b||!b.isHidden)&&m.apply(e,arguments)};var n=e.getTreeCheckedNodes;if(n)e.getTreeCheckedNodes=function(c,b,a,d){if(b&&b.length>0){var f=b[0].getParentNode();if(f&&f.isHidden)return[]}return n.apply(e,arguments)};var o=e.getTreeChangeCheckedNodes;if(o)e.getTreeChangeCheckedNodes=function(c,b,a){if(b&&b.length>
|
22
|
+
0){var d=b[0].getParentNode();if(d&&d.isHidden)return[]}return o.apply(e,arguments)};var p=f.expandCollapseSonNode;if(p)f.expandCollapseSonNode=function(c,b,a,d,e){(!b||!b.isHidden)&&p.apply(f,arguments)};var q=f.setSonNodeCheckBox;if(q)f.setSonNodeCheckBox=function(c,b,a,d){(!b||!b.isHidden)&&q.apply(f,arguments)};var r=f.repairParentChkClassWithSelf;if(r)f.repairParentChkClassWithSelf=function(c,b){(!b||!b.isHidden)&&r.apply(f,arguments)}})(jQuery);
|