-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathgraph collaborator index.html
44 lines (36 loc) · 1.5 KB
/
graph collaborator index.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
<head>
<meta charset="UTF-8">
<link rel="icon" href="data:image/svg+xml,<svg xmlns=%22http://www.w3.org/2000/svg%22 viewBox=%220 0 100 100%22><text y=%22.9em%22 font-size=%229 0%22>🔵</text></svg>">
<script src="https://unpkg.com/@hpcc-js/[email protected]/dist/index.min.js"></script>
<script> var hpccWasm = window["@hpcc-js/wasm"]; </script>
<script src="https://cdn.jsdelivr.net/gh/dash14/svg-pan-zoom/dist/svg-pan-zoom.min.js"></script>
</head>
<div id="target" ondrop="drop(event)" ondragover="over(event)" ondragenter="over(event)"></div>
<script type=module>
import {Graph} from 'https://wardcunningham.github.io/graph/graph.js'
import {drop,dropl,dropu} from './drop.js'
import {display} from './display.js'
// const beam = await fetch('./SituatedInstitutions.jsonl')
// .then(req => req.text())
// .then(text => text.trim()
// .split(/\n/)
// .map(line => JSON.parse(line))
// .map(({name,graph}) => ({name,graph:new Graph(graph.nodes, graph.rels)})))
// console.log({beam})
let beam = await fetch('./robert.graph.json')
.then(req => req.json())
.then(json => [{name:'robert',graph:new Graph(json.nodes,json.rels)}])
const target = document.querySelector('#target')
window.over = function (event) {
event.preventDefault()
}
window.drop = async function (event) {
event.preventDefault();
beam.push(
...await dropl(event, '.jsonl'),
...await drop(event, '.graph.json')
)
display(beam,target)
}
display(beam,target)
</script>