MCPcopy Index your code
hub / github.com/TruthHun/BookStack / li2jsonData

Function li2jsonData

static/mind-map/mindmap.min.js:19–45  ·  view source on GitHub ↗
(liNode)

Source from the content-addressed store, hash-verified

17
18// 将 li 节点转换为 JSON 数据
19function li2jsonData(liNode) {
20 var liData;
21 var aNode = liNode.children("a:first");
22 if (aNode.length !== 0) {
23 liData = {
24 "data": {
25 "text": aNode.text(),
26 "hyperlink": aNode.attr("href")
27 }
28 };
29 } else {
30 liData = {
31 "data": {
32 "text": liNode[0].childNodes[0].nodeValue.trim()
33 }
34 };
35 }
36
37 liNode.find("> ul > li").each(function () {
38 if (!liData.hasOwnProperty("children")) {
39 liData.children = [];
40 }
41 liData.children.push(li2jsonData($(this)));
42 });
43
44 return liData;
45}
46
47function drawMindMap(div) {
48 //各参数解析开始

Callers 1

drawMindMapFunction · 0.85

Calls 2

textMethod · 0.80
$Function · 0.50

Tested by

no test coverage detected