(o, po, text, link, childrenData, lastNode)
| 170 | } |
| 171 | |
| 172 | function newNode(o, po, text, link, childrenData, lastNode) |
| 173 | { |
| 174 | var node = new Object(); |
| 175 | node.children = Array(); |
| 176 | node.childrenData = childrenData; |
| 177 | node.depth = po.depth + 1; |
| 178 | node.relpath = po.relpath; |
| 179 | node.isLast = lastNode; |
| 180 | |
| 181 | node.li = document.createElement("li"); |
| 182 | po.getChildrenUL().appendChild(node.li); |
| 183 | node.parentNode = po; |
| 184 | |
| 185 | node.itemDiv = document.createElement("div"); |
| 186 | node.itemDiv.className = "item"; |
| 187 | |
| 188 | node.labelSpan = document.createElement("span"); |
| 189 | node.labelSpan.className = "label"; |
| 190 | |
| 191 | createIndent(o,node.itemDiv,node,0); |
| 192 | node.itemDiv.appendChild(node.labelSpan); |
| 193 | node.li.appendChild(node.itemDiv); |
| 194 | |
| 195 | var a = document.createElement("a"); |
| 196 | node.labelSpan.appendChild(a); |
| 197 | node.label = document.createTextNode(text); |
| 198 | node.expanded = false; |
| 199 | a.appendChild(node.label); |
| 200 | if (link) { |
| 201 | var url; |
| 202 | if (link.substring(0,1)=='^') { |
| 203 | url = link.substring(1); |
| 204 | link = url; |
| 205 | } else { |
| 206 | url = node.relpath+link; |
| 207 | } |
| 208 | a.className = stripPath(link.replace('#',':')); |
| 209 | if (link.indexOf('#')!=-1) { |
| 210 | var aname = '#'+link.split('#')[1]; |
| 211 | var srcPage = stripPath(pathName()); |
| 212 | var targetPage = stripPath(link.split('#')[0]); |
| 213 | a.href = srcPage!=targetPage ? url : "javascript:void(0)"; |
| 214 | a.onclick = function(){ |
| 215 | storeLink(link); |
| 216 | if (!$(a).parent().parent().hasClass('selected')) |
| 217 | { |
| 218 | $('.item').removeClass('selected'); |
| 219 | $('.item').removeAttr('id'); |
| 220 | $(a).parent().parent().addClass('selected'); |
| 221 | $(a).parent().parent().attr('id','selected'); |
| 222 | } |
| 223 | var anchor = $(aname); |
| 224 | gotoAnchor(anchor,aname,true); |
| 225 | }; |
| 226 | } else { |
| 227 | a.href = url; |
| 228 | a.onclick = function() { storeLink(link); } |
| 229 | } |
no test coverage detected