Compare commits
No commits in common. "84274f5c08a17d74752dafd04c376f757d2af97e" and "2f4e5f58a0547c3f5b5e480a6c1e2ce8485b9d1b" have entirely different histories.
84274f5c08
...
2f4e5f58a0
|
@ -50,9 +50,3 @@
|
||||||
|
|
||||||
[note]
|
[note]
|
||||||
other = "note"
|
other = "note"
|
||||||
|
|
||||||
[from]
|
|
||||||
other = "From"
|
|
||||||
|
|
||||||
[searchRequiresJS]
|
|
||||||
other = "Search (requires JavaScript)"
|
|
||||||
|
|
|
@ -1,16 +0,0 @@
|
||||||
{{ define "main" }}
|
|
||||||
<h2>{{ .Title }} </h2>
|
|
||||||
<script src="//unpkg.com/vis-network@9.1.0/dist/vis-network.min.js"></script>
|
|
||||||
<script type="module" src="{{ .Site.BaseURL }}/graph/graph.js"></script>
|
|
||||||
<style>
|
|
||||||
#graph-container {
|
|
||||||
width: 100%;
|
|
||||||
height: 50vh;
|
|
||||||
border-radius: 0.2rem;
|
|
||||||
border: .075rem solid #bfbfbf
|
|
||||||
}
|
|
||||||
</style>
|
|
||||||
{{ .Content }}
|
|
||||||
<div id="graph-container">
|
|
||||||
</div>
|
|
||||||
{{ end }}
|
|
|
@ -1,3 +1,3 @@
|
||||||
<div class="highlight-group">
|
<div class="highlight-group">
|
||||||
<div class="highlight-label">{{ i18n "from" }} <a href="{{ .url }}">{{ path.Base .path }}</a>{{ .comment }}</div>{{ .content }}
|
<div class="highlight-label">From <a href="{{ .url }}">{{ path.Base .path }}</a>{{ .comment }}</div>{{ .content }}
|
||||||
</div>
|
</div>
|
||||||
|
|
|
@ -7,7 +7,7 @@
|
||||||
|
|
||||||
<div class="stork-wrapper">
|
<div class="stork-wrapper">
|
||||||
<div class="stork-input-wrapper">
|
<div class="stork-input-wrapper">
|
||||||
<input class="stork-input" data-stork="blog" placeholder="{{ i18n "searchRequiresJS" }}"/>
|
<input class="stork-input" data-stork="blog" placeholder="Search (requires JavaScript)"/>
|
||||||
</div>
|
</div>
|
||||||
<div class="stork-output" data-stork="blog-output"></div>
|
<div class="stork-output" data-stork="blog-output"></div>
|
||||||
</div>
|
</div>
|
||||||
|
|
|
@ -1,53 +0,0 @@
|
||||||
import { nodes, edges } from "./graph.gen.js";
|
|
||||||
|
|
||||||
var container = document.getElementById("graph-container");
|
|
||||||
var options = {
|
|
||||||
interaction: {
|
|
||||||
hover: true
|
|
||||||
},
|
|
||||||
nodes: {
|
|
||||||
shape: "dot",
|
|
||||||
size: 16,
|
|
||||||
},
|
|
||||||
physics: {
|
|
||||||
forceAtlas2Based: {
|
|
||||||
gravitationalConstant: -10,
|
|
||||||
centralGravity: 0.005,
|
|
||||||
springLength: 230,
|
|
||||||
springConstant: 0.18,
|
|
||||||
},
|
|
||||||
maxVelocity: 146,
|
|
||||||
solver: "forceAtlas2Based",
|
|
||||||
timestep: 0.35,
|
|
||||||
stabilization: { iterations: 150 },
|
|
||||||
},
|
|
||||||
};
|
|
||||||
|
|
||||||
var nodesDs = new vis.DataSet();
|
|
||||||
nodesDs.add(nodes);
|
|
||||||
var edgesDs = new vis.DataSet();
|
|
||||||
edgesDs.add(edges);
|
|
||||||
var network = new vis.Network(container, { nodes: nodesDs, edges: edgesDs }, options);
|
|
||||||
|
|
||||||
network.on("doubleClick", function (params) {
|
|
||||||
params.event = "[original event]";
|
|
||||||
if (params.nodes.length !== 1) return;
|
|
||||||
window.open(nodesDs.get(params.nodes[0]).url, "_blank")
|
|
||||||
});
|
|
||||||
network.on("hoverNode", function (params) {
|
|
||||||
nodesDs.update({ id: params.node, label: nodesDs.get(params.node).name });
|
|
||||||
});
|
|
||||||
network.on("blurNode", function (params) {
|
|
||||||
nodesDs.update({ id: params.node, label: undefined });
|
|
||||||
});
|
|
||||||
// network.on("selectNode", function (params) {
|
|
||||||
// for (const node of params.nodes) {
|
|
||||||
// nodesDs.update({ id: node, label: nodesDs.get(node).name });
|
|
||||||
// }
|
|
||||||
// });
|
|
||||||
// network.on("deselectNode", function (params) {
|
|
||||||
// for (const node of params.previousSelection.nodes) {
|
|
||||||
// if (params.nodes.some(n => n === node)) continue;
|
|
||||||
// nodesDs.update({ id: node, label: undefined });
|
|
||||||
// }
|
|
||||||
// });
|
|
Loading…
Reference in New Issue
Block a user