Changeset 24925
- Timestamp:
- 2012-01-09T11:20:24+13:00 (12 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
gs3-extensions/html-to-expeditee/trunk/src/src/js/html-to-expeditee.js
r24917 r24925 89 89 depth = (depth) ? depth : 0; 90 90 91 var expSyntax = ""; 91 //var expSyntax = ""; 92 var jsonNode = {}; 92 93 93 94 if (node.nodeType == 3) { /* text node */ … … 95 96 96 97 if (text.match(/\S/)) { 97 for (var i=0; i<depth; i++) { expSyntax += " "; } 98 expSyntax += "Text item: " + node.nodeValue + "\n"; 98 //for (var i=0; i<depth; i++) { expSyntax += " "; } 99 //expSyntax += "Text item: " + node.nodeValue + "\n"; 100 101 jsonNode.type = "text"; 102 jsonNode.text = node.nodeValue; 99 103 } 100 104 } … … 114 118 var yb = nodePos.yb; 115 119 120 /* 116 121 var rectSyntax = ""; 122 117 123 for (var i=0; i<depth; i++) { rectSyntax += " "; } 124 118 125 rectSyntax += "Rect item " + node.nodeName + ": "; 119 126 rectSyntax += xl + " " + yt + " " + xr + " " + yb + "\n"; 120 127 121 128 expSyntax += rectSyntax; 129 */ 130 131 var rect = { "xl":xl, "yt":yt, "xr":xr, "yb":yb }; 132 133 jsonNode.type = "rect"; 134 jsonNode.elem = node.nodeName; 135 jsonNode.rect = rect; 136 137 var jsonChildNodes = []; 122 138 123 139 var cnode = node.firstChild; 124 140 while (cnode != null) { 125 expSyntax += htmlToExpeditee(cnode,depth+1); 141 //expSyntax += htmlToExpeditee(cnode,depth+1); 142 143 var jsonChildNode = htmlToExpeditee(cnode,depth+1); 144 jsonChildNodes.push(jsonChildNode); 126 145 127 cnode = cnode.nextSibling 146 cnode = cnode.nextSibling; 128 147 } 129 148 149 jsonNode.childNodes = jsonChildNodes; 130 150 } 131 151 … … 133 153 /* currently do nothing for the other node types */ 134 154 135 return expSyntax; 155 return jsonNode; 156 //return expSyntax; 136 157 } 137 158
Note:
See TracChangeset
for help on using the changeset viewer.