Added preliminary autocompletion support
diff --git a/public/translateTree.js b/public/translateTree.js
index 728877b..0ade20b 100644
--- a/public/translateTree.js
+++ b/public/translateTree.js
@@ -41,6 +41,40 @@
};
return this;
};
+
+ // Recursively parse children
+ this.parseChildren2 = function (children) {
+ for (var i in children) {
+ var c = children[i];
+ if (c.nodeType === 1) {
+ if (c.getAttribute("title")) {
+ var title = this.cleanTitle(c.getAttribute("title"));
+ var childTree = this.addChild({ type : title });
+ if (c.hasChildNodes())
+ childTree.parseChildren2(c.childNodes);
+ }
+ else if (c.hasChildNodes())
+ this.parseChildren2(c.childNodes);
+ }
+ else if (c.nodeType === 3)
+ if (c.nodeValue.match(/[-a-z0-9]/i)) {
+ this.addChild({
+ type : "leaf",
+ word : c.nodeValue
+ });
+ };
+ };
+ return this;
+ };
+
+
+ this.toTable = function () {
+
+ };
+
+ var tree = document.createElement('tree');
+ html.innerHTML = snippet;
+ this.parseChildren2(html.childNodes);
};
// Make tree from snippet