Commit 90a4ecf3 authored by Bady's avatar Bady
Browse files

Update leaves on load

parent 3102c52a
......@@ -474,11 +474,19 @@
var socket = io();
//following should be there when the leaf text is added/changed
socket.on('leaves data', (leavesdata) => {
//set up the tree with the data of all leaves
let i = 0;
for(leaf in leavesdata) {
leafdata = leavesdata[leaf];
growLeaves(i, leafdata);
i++;
}
function growLeaves(i, leafdata) {
setTimeout(function() {
growLeaf(leafdata);
}, 300 * i);
}
});
function addKnowledgeItem() {
......@@ -488,6 +496,10 @@
}
socket.on('leaf data', (leafdata) => {
growLeaf(leafdata);
});
function growLeaf(leafdata) {
leafID = leafdata.leafid;
activeLeaf = document.getElementById(leafID);
activeLeaf.classList.add("leaf-active");
......@@ -505,7 +517,7 @@
knowledgeItem.innerHTML = leafdata.leaftext;
document.getElementById("knowledge").appendChild(knowledgeItem);
}
});
}
function popupLeaf() {
let knowledgeId = this.id.replace("path", "knowledge");
......
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment