From 4877c43451d30a0ae0e2d3eaae6b684304683581 Mon Sep 17 00:00:00 2001 From: Bent Bisballe Nyeng Date: Thu, 11 Jun 2020 18:12:45 +0200 Subject: Add intermistic title edit functionality using double-click. --- src/ws/node.js | 20 ++++++++++++++------ 1 file changed, 14 insertions(+), 6 deletions(-) (limited to 'src/ws/node.js') diff --git a/src/ws/node.js b/src/ws/node.js index 6abc8b2..3baeb02 100644 --- a/src/ws/node.js +++ b/src/ws/node.js @@ -11,6 +11,11 @@ function idFromStr(str) return str.substring(str.search('t') + 1, str.length); } +function subscriptionIdFromStr(str) +{ + return str.substring(1, str.search('_')); +} + var nodes = new Array(); function findNode(id, subscribeid) @@ -39,7 +44,9 @@ function Node(id, subscribeid) // Elements: this.element = document.createElement("div"); this.div_id = document.createElement("span"); + this.div_id.setAttribute("class", "id"); this.div_title = document.createElement("span"); + this.div_title.setAttribute("class", "title"); } Node.prototype.dump = function() @@ -116,7 +123,7 @@ Node.prototype.create = function() node.name = "node"; node.setAttribute("class", "node"); - node.setAttribute("ondblclick", "editTitle(this, event)"); + node.setAttribute("ondblclick", "editTitle(event)"); //node.setAttribute("onclick", "showHideChildren(this, event)"); node.setAttribute("ondrop", "drop(event)"); node.setAttribute("ondragenter", "dragenter(event)"); @@ -153,13 +160,9 @@ Node.prototype.create = function() this.element.appendChild(this.div_id); var id_txt = document.createTextNode(this.id); - this.div_id.style.padding = "5px"; - this.div_id.style.opacity = "0.3"; this.div_id.appendChild(id_txt); - this.element.appendChild(this.div_title); - - this.setAttribute("title", "(missing title)"); + this.setAttribute("title", ""); }; Node.prototype.setAttribute = function(name, value) @@ -194,3 +197,8 @@ Node.prototype.setAttribute = function(name, value) } } }; + +Node.prototype.getTitle = function() +{ + return this.attributes["title"]; +}; -- cgit v1.2.3