js/mktree/mktree.js
function processList(ul) {
	if ( ul.getAttribute( "data-xdh-mktree" ) == "handled" )
		return;
	
	if (!ul.childNodes || ul.childNodes.length==0) { return; }
	// Iterate LIs
	var childNodesLength = ul.childNodes.length;
	for (var itemi=0;itemi<childNodesLength;itemi++) {
		var item = ul.childNodes[itemi];
		if (item.nodeName == "LI") {
			// Iterate things in this LI
			var subLists = false;
			var itemChildNodesLength = item.childNodes.length;
			for (var sitemi=0;sitemi<itemChildNodesLength;sitemi++) {
				var sitem = item.childNodes[sitemi];
				if (sitem.nodeName=="UL") {
					subLists = true;
					processList(sitem);
				}
			}
			var s= document.createElement("SPAN");
			var t= '\u00A0'; // &nbsp;
			s.className = nodeLinkClass;
			if (subLists) {
				// This LI has UL's in it, so it's a +/- node
				if (item.className==null || item.className=="") {
					item.className = nodeClosedClass;
				}
				// If it's just text, make the text work as the link also
				if (item.firstChild.nodeName=="#text") {
					t = t+item.firstChild.nodeValue;
					item.removeChild(item.firstChild);
				}
				s.onclick = treeNodeOnclick;
			}
			else {
				// No sublists, so it's just a bullet node
				item.className = nodeBulletClass;
				s.onclick = retFalse;
			}
			s.appendChild(document.createTextNode(t));
			item.insertBefore(s,item.firstChild);
		}
	}
}
function processList(ul) {
	if ( ul.getAttribute( "data-xdh-mktree" ) == "handled" )
		return;
	
	if (!ul.childNodes || ul.childNodes.length==0) { return; }
	// Iterate LIs
	var childNodesLength = ul.childNodes.length;
	for (var itemi=0;itemi<childNodesLength;itemi++) {
		var item = ul.childNodes[itemi];
		if (item.nodeName == "LI") {
			// Iterate things in this LI
			var subLists = false;
			var itemChildNodesLength = item.childNodes.length;
			for (var sitemi=0;sitemi<itemChildNodesLength;sitemi++) {
				var sitem = item.childNodes[sitemi];
				if (sitem.nodeName=="UL") {
					subLists = true;
					processList(sitem);
				}
			}
			var s= document.createElement("SPAN");
			var t= '\u00A0'; // &nbsp;
			s.className = nodeLinkClass;
			if (subLists) {
				// This LI has UL's in it, so it's a +/- node
				if (item.className==null || item.className=="") {
					item.className = nodeClosedClass;
				}
				// If it's just text, make the text work as the link also
				if (item.firstChild.nodeName=="#text") {
					t = t+item.firstChild.nodeValue;
					item.removeChild(item.firstChild);
				}
				s.onclick = treeNodeOnclick;
			}
			else {
				// No sublists, so it's just a bullet node
				item.className = nodeBulletClass;
				s.onclick = retFalse;
			}
			s.appendChild(document.createTextNode(t));
			item.insertBefore(s,item.firstChild);
		}
	}
}
function processList ( ul ) { if ( ul . getAttribute ( "data-xdh-mktree" ) == "handled" ) return ; if ( ! ul . childNodes || ul . childNodes . length == 0 ) { return ; } // Iterate LIs var childNodesLength = ul . childNodes . length ; for ( var itemi = 0 ; itemi < childNodesLength ; itemi ++ ) { var item = ul . childNodes [ itemi ] ; if ( item . nodeName == "LI" ) { // Iterate things in this LI var subLists = false ; var itemChildNodesLength = item . childNodes . length ; for ( var sitemi = 0 ; sitemi < itemChildNodesLength ; sitemi ++ ) { var sitem = item . childNodes [ sitemi ] ; if ( sitem . nodeName == "UL" ) { subLists = true ; processList ( sitem ) ; } } var s = document . createElement ( "SPAN" ) ; var t = '\u00A0' ; // &nbsp; s . className = nodeLinkClass ; if ( subLists ) { // This LI has UL's in it, so it's a +/- node if ( item . className == null || item . className == "" ) { item . className = nodeClosedClass ; } // If it's just text, make the text work as the link also if ( item . firstChild . nodeName == "#text" ) { t = t + item . firstChild . nodeValue ; item . removeChild ( item . firstChild ) ; } s . onclick = treeNodeOnclick ; } else { // No sublists, so it's just a bullet node item . className = nodeBulletClass ; s . onclick = retFalse ; } s . appendChild ( document . createTextNode ( t ) ) ; item . insertBefore ( s , item . firstChild ) ; } } }
Process a UL tag and all its children, to convert to a tree
Process a UL tag and all its children to convert to a tree