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
80
81
82
|
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8" />
<title>Page Link Graph</title>
<script type="text/javascript" src="https://unpkg.com/vis-network/standalone/umd/vis-network.min.js"></script>
<style>
body {
margin: 0;
background: #111;
color: #eee;
font-family: sans-serif;
}
#graph {
width: 100vw;
height: 100vh;
border: 1px solid #444;
}
</style>
<script defer src="https://umami.guhub.cn/script.js" data-website-id="3bec51b2-739f-4a79-b030-ad2511d6f5a7"></script>
</head>
<body>
<div id="graph"></div>
<script>
fetch("link-graph.json")
.then(res => res.json())
.then(data => {
const container = document.getElementById("graph");
const nodes = new vis.DataSet(
data.nodes.map(node => ({
id: node.id,
label: node.label,
url: node.url,
font: { color: "#eee" }
}))
);
const edges = new vis.DataSet(data.edges);
const network = new vis.Network(container, { nodes, edges }, {
nodes: {
shape: "dot",
size: 10,
color: {
background: "#29c",
border: "#fff"
},
font: {
size: 14,
color: "#eee"
}
},
edges: {
arrows: "to",
color: {
color: "#888"
}
},
physics: {
stabilization: false
},
interaction: {
navigationButtons: true,
zoomView: true,
dragView: true
}
});
network.on("click", function (params) {
if (params.nodes.length > 0) {
const node = nodes.get(params.nodes[0]);
if (node.url) {
window.open(node.url, "_blank");
umami.track('Visit page through Graph')
}
}
});
});
</script>
</body>
</html>
|