diff options
Diffstat (limited to 'src/ws/node.js')
-rw-r--r-- | src/ws/node.js | 25 |
1 files changed, 23 insertions, 2 deletions
diff --git a/src/ws/node.js b/src/ws/node.js index a8208fd..d79137d 100644 --- a/src/ws/node.js +++ b/src/ws/node.js @@ -94,8 +94,8 @@ Node.prototype.addChild = function(node, insertBeforeId) if(this.children[i].id == insertBeforeId) { this.children.splice(i - 1, 0, node); - // Insert after id, title and add button (ie. + 3) - this.element.insertBefore(node.element, this.element.childNodes[i + 3]); + // Insert after id, title, add button and collapse button (ie. + 4) + this.element.insertBefore(node.element, this.element.childNodes[i + 4]); inserted = true; break; } @@ -148,6 +148,15 @@ Node.prototype.create = function() add_child_button.appendChild(txt_plus); node.appendChild(add_child_button); + var collapse_button = document.createElement("div"); + collapse_button.name = "add_button"; + collapse_button.setAttribute("onclick", "collapse(event)"); + collapse_button.setAttribute("nodeid", this.id); + collapse_button.setAttribute("class", "collapse_button"); + var txt_plus = document.createTextNode("v"); + collapse_button.appendChild(txt_plus); + node.appendChild(collapse_button); + /* var subscribe_button = document.createElement("div"); subscribe_button.name = "subscribe_button"; @@ -173,6 +182,18 @@ Node.prototype.create = function() this.div_id.appendChild(id_txt); this.element.appendChild(this.div_title); this.setAttribute("title", ""); + + { + var collapsed = getCookie(node.id+"_collapsed") == "true"; + if(collapsed) + { + this.element.style.maxHeight = "32px"; + } + else + { + this.element.style.maxHeight = "inherit"; + } + } }; Node.prototype.setAttribute = function(name, value) |