diff options
Diffstat (limited to 'src/ws')
-rw-r--r-- | src/ws/munia.css | 5 | ||||
-rw-r--r-- | src/ws/node.js | 32 | ||||
-rw-r--r-- | src/ws/view.js | 12 |
3 files changed, 26 insertions, 23 deletions
diff --git a/src/ws/munia.css b/src/ws/munia.css index 75321ec..04fd75a 100644 --- a/src/ws/munia.css +++ b/src/ws/munia.css @@ -76,6 +76,11 @@ body opacity: 0.6; } +.children_indicator:not(.collapsed) +{ + display: none; +} + .node .title { clear: both; diff --git a/src/ws/node.js b/src/ws/node.js index 424aa99..fd4a9d7 100644 --- a/src/ws/node.js +++ b/src/ws/node.js @@ -218,19 +218,8 @@ Node.prototype.create = function() // oberveid from the node id alone. node.id = createId(this.subscribeid, this.id); - { - var collapsed = localStorage.getItem(node.id+"_collapsed") == "true"; - if(collapsed) - { - this.element.classList.add('collapsed'); - this.collapse_button.innerHTML = "▼"; - } - else - { - this.element.classList.remove('collapsed'); - this.collapse_button.innerHTML = "▲"; - } - } + var collapsed = localStorage.getItem(node.id+"_collapsed") == "true"; + this.setCollapsed(collapsed); }; Node.prototype.updateAnnotations = function() @@ -250,6 +239,23 @@ Node.prototype.updateAnnotations = function() this.children_indicator_element.innerHTML = ann; }; +Node.prototype.setCollapsed = function(collapsed) +{ + if(collapsed) + { + this.children_indicator_element.classList.add('collapsed'); + this.element.classList.add('collapsed'); + this.collapse_button.innerHTML = "▼"; + } + else + { + this.children_indicator_element.classList.remove('collapsed'); + this.element.classList.remove('collapsed'); + this.collapse_button.innerHTML = "▲"; + } +}; + + //! Recursively set draggable property from node until root node. Node.prototype.setDraggable = function(value) { diff --git a/src/ws/view.js b/src/ws/view.js index bdc5149..5b69a24 100644 --- a/src/ws/view.js +++ b/src/ws/view.js @@ -396,16 +396,8 @@ function collapse(e) localStorage.setItem(id+"_collapsed", collapsed?"true":"false"); e.stopPropagation(); - if(collapsed) - { - node.element.classList.add('collapsed'); - node.collapse_button.innerHTML = "▼"; - } - else - { - node.element.classList.remove('collapsed'); - node.collapse_button.innerHTML = "▲"; - } + + node.setCollapsed(collapsed); } function changeState(e) |