/* WP-dTree 3.2 (ulfben 2007-10-08) Added duration parameter to the GET array. Removed title on root-node. */ /*--------------------------------------------------| | WP-dTree 2.2 | www.silpstream.com/blog/ | |---------------------------------------------------| | Copyright (c) 2006 Christopher Hwang | | Release Date: July 2006 | | Modifications: | | v2.2 Added support for generating page trees | | Added support for excluding specific posts | | from tree | | Updated option menu | | Rewrite of base code | | Fixed support for tooltips on non-linked | | folders | | Added option for not displaying posts in | | archive tree | | v2.1 Patch to work with Regulus theme | | Ability to change open/close all link | | Set folders as links option | | Highlight current position in blog | | v2.0 Support for scriptaculous effects added | | Category based menu added | | Support for dTree options was built in | | Option menu added to admin panel | | v1.0 Work arounds added for wordpress beautified | | permalinks. | |--------------------------------------------------*/ /*--------------------------------------------------| | dTree 2.05 | www.destroydrop.com/javascript/tree/ | |---------------------------------------------------| | Copyright (c) 2002-2003 Geir Landrö | | | | This script can be used freely as long as all | | copyright messages are intact. | | | | Updated: 17.04.2003 | |--------------------------------------------------*/ // Node object function Node(id, pid, name, url, title, target, icon, iconOpen, open) { this.id = id; this.pid = pid; this.name = name; this.url = url; this.title = title; this.target = target; this.icon = icon; this.iconOpen = iconOpen; this._io = open || false; this._is = false; this._ls = false; this._hc = false; this._ai = 0; this._p; }; // Tree object function dTree(objName) { this.config = { target : null, folderLinks : false, useSelection : false, useCookies : true, useLines : true, useIcons : true, useStatusText : false, closeSameLevel : false, inOrder : false } this.icon = { root : 'http://ings.ca/jim/wp-content/plugins/wp-dtree-30/dtree-img/base.gif', folder : 'http://ings.ca/jim/wp-content/plugins/wp-dtree-30/dtree-img/folder.gif', folderOpen : 'http://ings.ca/jim/wp-content/plugins/wp-dtree-30/dtree-img/folderopen.gif', node : 'http://ings.ca/jim/wp-content/plugins/wp-dtree-30/dtree-img/page.gif', empty : 'http://ings.ca/jim/wp-content/plugins/wp-dtree-30/dtree-img/empty.gif', line : 'http://ings.ca/jim/wp-content/plugins/wp-dtree-30/dtree-img/line.gif', join : 'http://ings.ca/jim/wp-content/plugins/wp-dtree-30/dtree-img/join.gif', joinBottom : 'http://ings.ca/jim/wp-content/plugins/wp-dtree-30/dtree-img/joinbottom.gif', plus : 'http://ings.ca/jim/wp-content/plugins/wp-dtree-30/dtree-img/plus.gif', plusBottom : 'http://ings.ca/jim/wp-content/plugins/wp-dtree-30/dtree-img/plusbottom.gif', minus : 'http://ings.ca/jim/wp-content/plugins/wp-dtree-30/dtree-img/minus.gif', minusBottom : 'http://ings.ca/jim/wp-content/plugins/wp-dtree-30/dtree-img/minusbottom.gif', nlPlus : 'http://ings.ca/jim/wp-content/plugins/wp-dtree-30/dtree-img/nolines_plus.gif', nlMinus : 'http://ings.ca/jim/wp-content/plugins/wp-dtree-30/dtree-img/nolines_minus.gif' }; this.obj = objName; this.aNodes = []; this.aIndent = []; this.root = new Node(-1); this.selectedNode = null; this.selectedFound = false; this.completed = false; }; // Adds a new node to the node array dTree.prototype.add = function(id, pid, name, url, title, target, icon, iconOpen, open) { this.aNodes[this.aNodes.length] = new Node(id, pid, name, url, title, target, icon, iconOpen, open); }; // Open/close all nodes dTree.prototype.openAll = function() { this.oAll(true); }; dTree.prototype.closeAll = function() { this.oAll(false); }; // Outputs the tree to the page dTree.prototype.toString = function() { var str = '
\n'; if (document.getElementById) { if (this.config.useCookies) this.selectedNode = this.getSelected(); str += this.addNode(this.root); } else str += 'Browser not supported.'; str += '
'; if (!this.selectedFound) this.selectedNode = null; this.completed = true; return str; }; // Creates the tree structure dTree.prototype.addNode = function(pNode) { var str = ''; var n=0; if (this.config.inOrder) n = pNode._ai; for (n; n < this.aNodes.length; n++) { if (this.aNodes[n].pid == pNode.id) { var cn = this.aNodes[n]; cn._p = pNode; cn._ai = n; this.setCS(cn); if (!cn.target && this.config.target) cn.target = this.config.target; if (cn._hc && !cn._io && this.config.useCookies) cn._io = this.isOpen(cn.id); if (!this.config.folderLinks && cn._hc) cn.url = null; if (this.config.useSelection && cn.id == this.selectedNode && !this.selectedFound) { cn._is = true; this.selectedNode = n; this.selectedFound = true; } str += this.node(cn, n); if (cn._ls) break; } } return str; }; // Creates the node icon, url and text dTree.prototype.node = function(node, nodeId) { var str = '
' + this.indent(node, nodeId); if (this.config.useIcons) { if (!node.icon) node.icon = (this.root.id == node.pid) ? this.icon.root : ((node._hc) ? this.icon.folder : this.icon.node); if (!node.iconOpen) node.iconOpen = (node._hc) ? this.icon.folderOpen : this.icon.node; if (this.root.id == node.pid) { node.icon = this.icon.root; node.iconOpen = this.icon.root; } str += ''; } if (node.url) { str += ''; str += this.addNode(node); str += '
'; } this.aIndent.pop(); return str; }; // Adds the empty and line icons dTree.prototype.indent = function(node, nodeId) { var str = ''; if (this.root.id != node.pid) { for (var n=0; n'; (node._ls) ? this.aIndent.push(0) : this.aIndent.push(1); if (node._hc) { str += ''; } else str += ''; } return str; }; // Checks if a node has any children and if it is the last sibling dTree.prototype.setCS = function(node) { var lastId; for (var n=0; n