From 8ab40a969f71120ce1ff0960c69ffc7194f97e0b Mon Sep 17 00:00:00 2001 From: Alon Levy Date: Mon, 29 Sep 2014 20:45:17 +0300 Subject: rhizicore: replace 'text' attribute with 'name' for node --- scripts/rhizicore.js | 34 ++++++++++++++++++---------------- 1 file changed, 18 insertions(+), 16 deletions(-) (limited to 'scripts') diff --git a/scripts/rhizicore.js b/scripts/rhizicore.js index d3c5e54b..b4e98da9 100644 --- a/scripts/rhizicore.js +++ b/scripts/rhizicore.js @@ -31,7 +31,7 @@ function myGraph(el) { function makeNewNode(spec) { return { 'id': spec.id, - 'text': spec.text, + 'name': spec.name, 'type': spec.type, 'state': spec.state, 'start': spec.start, @@ -46,13 +46,13 @@ function myGraph(el) { var start = 0, end = 0; var status = "unknown"; - var text = id; + var name = id; id = id.toLowerCase(); var node = findNode(id, null); if (node === undefined) { var new_node = makeNewNode({ "id": id, - "text": text, + "name": name, "type": type, "state": state, "start": start, @@ -68,7 +68,7 @@ function myGraph(el) { this.addNodeComplete = function(id, type, state, start, end, status) { // No history recorded - this is a helper for loading from files / constant graphs - var text = id; + var name = id; id = id.toLowerCase(); var node = findNode(id, null); if (node !== undefined) { @@ -76,7 +76,7 @@ function myGraph(el) { } else { nodes.push(makeNewNode({ "id": id, - "text": text, + "name": name, "type": type, "state": state, "start": start, @@ -224,7 +224,7 @@ function myGraph(el) { } this.editName = function(id, type, newname) { - var new_text = newname; + var new_name = newname; id = id && id.toLowerCase(); var new_id = newname.toLowerCase(); var index2 = undefined; @@ -251,7 +251,7 @@ function myGraph(el) { } }else{ index.id = new_id; - index.text = new_text; + index.name = new_name; } } } @@ -426,17 +426,19 @@ function myGraph(el) { function load_from_json(json) { var data = JSON.parse(json); + var i, node, link; + if (data == null) { console.log('load callback: no data to load'); return; } - for(var i=0; i