-
Notifications
You must be signed in to change notification settings - Fork 0
/
show_mindmap.html
79 lines (74 loc) · 2.48 KB
/
show_mindmap.html
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
<!doctype html>
<html>
<head>
<meta charset="utf-8">
<meta http-equiv="Content-Type" content="text/html; charset=utf-8">
<title>jsMind</title>
<link type="text/css" rel="stylesheet" href="jsmind.css" />
<style type="text/css">
#jsmind_container {
width: 100%;
height: 500px;
border: solid 1px #ccc;
background: #f4f4f4;
}
</style>
</head>
<body style='overflow:hidden'>
<div id="jsmind_container"></div>
<script type='text/javascript' src='https://code.jquery.com/jquery-3.5.0.slim.min.js'></script>
<script type="text/javascript" src="jsmind.js"></script>
<script type="text/javascript" src="jsmind.draggable.js"></script>
<script type="text/javascript">
$(()=>{
$("#jsmind_container").height(window.innerHeight-10);
})
function getQuerys() {
var url = window.location.search.substring(1),
querystring = url.split('&')
querys={}
for (i = 0; i < querystring.length; i++) {
params = querystring[i].split('=');
querys[params[0]] = params[1]
}
return querys
};
function loadJSON(file,callback) {
var xobj = new XMLHttpRequest();
xobj.overrideMimeType("application/json");
xobj.open('GET', file, true);
xobj.onreadystatechange = function() {
if (xobj.readyState === 4 && xobj.status === 200) {
callback(xobj.responseText);
}
};
xobj.send(null);
}
function load_jsmind() {
querys = getQuerys()
if (querys['json']!=undefined){
file = querys['json']
}
else{
file = './mindmap/test.json'
}
window.document.title = 'mindmap - '+file.replace('mindmap/','').replace('.json','')
loadJSON(file,(json)=>{
json=eval(json)
var mind = {
"meta": {},
"format": "node_array",
"data": json
};
var options = {
container: 'jsmind_container',
editable: false,
theme: 'primary'
}
var jm = jsMind.show(options, mind);
});
}
load_jsmind();
</script>
</body>
</html>