/*----------------------------------------------------| | dTree 2.05 | www.destroydrop.com/javascript/tree/ | |---------------------------------------------------| | Copyright (c) 2002-2003 Geir Landro | | | | This script can be used freely as long as all | | copyright messages are intact. | | | | Updated: 17.04.2003 | |---------------------------------------------------| | Modified for Dokuwiki by | | Samuele Tognini | | under GPL 2 license | | (http://www.gnu.org/licenses/gpl.html) | | Updated: 29.08.2009 | |---------------------------------------------------| | Modified for Dokuwiki by | | Rene Hadler | | under GPL 2 license | | (http://www.gnu.org/licenses/gpl.html) | | Updated: 07.08.2012 | |---------------------------------------------------| | tindexmenu | https://bitbucket.org/iteas/tindexmenu/ | |--------------------------------------------------*/ function Node(a,c,b,d,e,f,g){this.dokuid=a;this.id=c;this.pid=b;this.name=d;this.hns=e;this.isdir=f;this.ajax=g;this._io=0;this._ls=this._is=!1;this._hc=g;this._ai=0;this._p=!1;this._lv=0;this._cp=this._ok=!1} function dTree(a,c){var b=indexmenu_findExt(c);this.config={urlbase:DOKU_BASE+"doku.php?id=",plugbase:DOKU_BASE+"lib/plugins/indexmenu",useCookies:!0,scroll:!0,toc:!0,maxjs:1,jsajax:"",sepchar:":",theme:c};var d=this.config.plugbase+"/images/"+c+"/";this.icon={root:d+"base."+b,folder:d+"folder."+b,folderH:d+"folderh."+b,folderOpen:d+"folderopen."+b,folderHOpen:d+"folderhopen."+b,node:d+"page."+b,empty:d+"empty."+b,line:d+"line."+b,join:d+"join."+b,joinBottom:d+"joinbottom."+b,plus:d+"plus."+b,plusBottom:d+ "plusbottom."+b,minus:d+"minus."+b,minusBottom:d+"minusbottom."+b,nlPlus:d+"nolines_plus."+b,nlMinus:d+"nolines_minus."+b};this.obj=a;this.aNodes=[];this.aIndent=[];this.root=new Node(!1,-1);this.selectedNode=null;this.completed=this.selectedFound=!1;this.scrllTmr=0;this.pageid=window.indexmenu_ID||"";this.fajax=!1}dTree.prototype.add=function(a,c,b,d,e,f,g){this.aNodes[this.aNodes.length]=new Node(a,c,b,d,e,f,g)};dTree.prototype.openAll=function(){this.getCookie("co"+this.obj)||this.oAll(!0)}; dTree.prototype.toString=function(){var a="";this.config.scroll&&(a+='
');a+='
',a+='');this.config.useCookies&&(this.selectedNode=this.getSelected());a+=this.addNode(this.root)+"
";this.config.scroll&&(a+='
',a+='',a+="");this.completed=!0;this.divdisplay("nojs_",0);return a}; dTree.prototype.addNode=function(a){var c="",b,d=a._ai,e=a._lv+1;for(d;d'}; dTree.prototype.node=function(a,c){var b=1,d,e;d='onmouseover="'+this.obj+".show_feat('"+c+"');\" onmousedown=\"return indexmenu_checkcontextm('"+c+"',"+this.obj+',event);" oncontextmenu="return indexmenu_stopevt(event)"';a._lv>this.config.maxjs?b=0:a._ok=!0;e='
'+this.indent(a,c);a.icon=this.root.id==a.pid?this.icon.root:a.hns?this.icon.folderH:a._hc?this.icon.folder:this.icon.node;a.iconOpen=a._hc?a.hns?this.icon.folderHOpen:this.icon.folderOpen:this.icon.node;this.root.id== a.pid&&(a.icon=this.icon.root,a.iconOpen=this.icon.root);e+='';!a._hc||a.hns?(e+='"):e=a.pid!=this.root.id?e+('"+a.name+""):e+a.name;e+="
";a._hc&&(e+='
',b&&(e+=this.addNode(a)),e+="
");this.aIndent.pop();return e}; dTree.prototype.indent=function(a,c){var b,d="";if(this.root.id!=a.pid){for(b=0;b';a._ls?this.aIndent.push(0):this.aIndent.push(1);a._hc?(d+=''):d+=''}return d};dTree.prototype.setCS=function(a){var c,b;for(b=0;b=a&&(b=e.split(this.config.sepchar),c=""==this.aNodes[0].dokuid?0:this.aNodes[0].dokuid.split(this.config.sepchar).length,b.splice(a+c,b.length),b=b.join(this.config.sepchar));for(c=0;c=c)this.divdisplay("left_",0),this.stopscroll();else{var b=this;$("dtree_"+b.obj).style.left=a+"px";-15c&&(b.style.display="none",b.style.top=g.offsetTop+"px",b.style.left=parseInt(g.offsetLeft+g.offsetWidth+c-12,0)+"px",b.style.display="block"))}; dTree.prototype.resizescroll=function(a){var c,b,d=jQuery("#left_"+this.obj)[0];d&&d.style.display==a&&(c=$("dtree_"+this.obj),c=parseInt(c.offsetHeight/3,0),b=50*parseInt(c/50,0),50>b&&(b=50),d.style.height=b+"px",d.style.top=c+"px","none"==a&&(d.style.display="block"))}; dTree.prototype.getAjax=function(a){var c,b,d=this;c=d.aNodes[a];var e=new sack(DOKU_BASE+"lib/plugins/indexmenu/ajax.php"),a="req=index&idx="+c.dokuid+decodeURIComponent(this.config.jsajax);b=this.pageid.substring(0,this.pageid.lastIndexOf(this.config.sepchar));e.encodeURIString=!1;e.onCompletion=function(){var a,b,e,i;i=d.aNodes.length-1;eval(this.response);if(!isArray(b)||1>b.length)b=[["",1,0,"",0,1,0]];c.ajax=!1;for(a=0;a'+e.name+"";for(h=0;h'+d+""):(b="span",g.appendChild(document.createElement("ul"))),b=document.createElement(b), b.innerHTML=d,g.lastChild.appendChild(b));g.style.display="inline";return!1};dTree.prototype.divdisplay=function(a,c){var b=jQuery("#"+a+this.obj)[0];if(!b)return!1;c?b.style.display="inline":b.style.display="none"}; dTree.prototype.init=function(a,c,b,d,e){a&&this.loadCss();c||this.openCookies();b&&this.getOpenTo(b.split(" "));d&&this.openCurNS(e);if(window.indexmenu_contextmenu){var f=this;indexmenu_createPicker("r"+this.obj,"indexmenu_rmenu "+this.config.theme);jQuery("#r"+this.obj)[0].oncontextmenu=indexmenu_stopevt;jQuery(document).click(function(){f.divdisplay("r",0)})}};Array.prototype.push||(Array.prototype.push=function(){for(var a=0;a