diff options
Diffstat (limited to 'src/ws/node.js')
-rw-r--r-- | src/ws/node.js | 12 |
1 files changed, 11 insertions, 1 deletions
diff --git a/src/ws/node.js b/src/ws/node.js index 3baeb02..a8208fd 100644 --- a/src/ws/node.js +++ b/src/ws/node.js @@ -94,7 +94,8 @@ Node.prototype.addChild = function(node, insertBeforeId) if(this.children[i].id == insertBeforeId) { this.children.splice(i - 1, 0, node); - this.element.insertBefore(node.element, this.element.childNodes[i + 2]); + // Insert after id, title and add button (ie. + 3) + this.element.insertBefore(node.element, this.element.childNodes[i + 3]); inserted = true; break; } @@ -138,6 +139,15 @@ Node.prototype.create = function() // oberveid from the node id alone. node.id = createId(this.subscribeid, this.id); + var add_child_button = document.createElement("div"); + add_child_button.name = "add_button"; + add_child_button.setAttribute("onclick", "addChild(event)"); + add_child_button.setAttribute("nodeid", this.id); + add_child_button.setAttribute("class", "add_button"); + var txt_plus = document.createTextNode("+"); + add_child_button.appendChild(txt_plus); + node.appendChild(add_child_button); + /* var subscribe_button = document.createElement("div"); subscribe_button.name = "subscribe_button"; |