This repository has been archived by the owner on Aug 6, 2020. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 1
/
desktop-mindmap.html
72 lines (68 loc) · 1.77 KB
/
desktop-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
<!DOCTYPE html>
<html>
<head>
<meta charset="UTF-8">
<title>MindMap</title>
<script type="text/javascript" src="inc/desktop-min.js"></script>
<style type="text/css">
#arch-context, #node-context, #label-context {
position: absolute;
top: 0;
left: 0;
}
#footer {
display: block;
position: absolute;
bottom: 0;
left: 0;
text-align: center;
}
</style>
</head>
<body>
<canvas id="arch-context">Your browser doesn't support HTML5 canvas. Please get a more recent browser.</canvas>
<canvas id="node-context"></canvas>
<canvas id="label-context"></canvas>
<noscript>Your browser has JavaScript turned off. Please switch it on from settings.</noscript>
<script type="text/javascript">
var tree = new Tree(),
xhr = ajaxRequest(),
data = null;
xhr.onreadystatechange = function() {
if(xhr.readyState == 4 && xhr.status == 200) {
data = JSON.parse(xhr.responseText);
}
};
xhr.open("GET", "src/"+ parseURL("f") +".json", false);
xhr.setRequestHeader("Content-type", "application/json");
xhr.overrideMimeType("application/json");
xhr.send();
tree.build(data);
var radialtree = new RadialTree(tree, parseInt(parseURL("z")));
radialtree.draw();
function ajaxRequest() {
var activexmodes=["Msxml2.XMLHTTP", "Microsoft.XMLHTTP"];
if(window.ActiveXObject) {
for(var i = 0; i < activexmodes.length; i++) {
try { return new ActiveXObject(activexmodes[i]) }
catch(e) { /* suppress error */ }
}
}
else if (window.XMLHttpRequest) {
return new XMLHttpRequest()
}
return null;
}
function parseURL(label) {
var result = null;
location.search.substr(1).split("&").forEach(function(item) {
var param = item.split("=");
if (param[0] === label) {
result = decodeURIComponent(param[1]);
}
});
return result;
}
</script>
</body>
</html>