forked from silvernberry/mini-journal
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathdotview.html
35 lines (31 loc) · 935 Bytes
/
dotview.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
<!DOCTYPE html>
<!--
This script can be used to render a .dot file from a URL.
Put it on a webserver and call like:
http://my.web/dotview.html?http://somewhere.net/dir/cool.dot
-->
<html>
<head>
<meta charset="utf-8">
</head>
<body>
<script src="./assets/js/viz-lite.js"></script>
<script>
var url = window.location.href;
var i = url.indexOf("?");
if (i == -1) {
var b = document.body;
b.innerHTML += "<p>This is online Graphviz .dot file viewer.</p>";
b.innerHTML += "<p>Based on <a href='https://github.com/mdaines/viz.js'>https://github.com/mdaines/viz.js</a></p>";
} else {
url = url.substring(i + 1);
var request = new XMLHttpRequest();
request.addEventListener("load", function() {
document.body.innerHTML += Viz(this.responseText);
});
request.open("GET", url);
request.send();
}
</script>
</body>
</html>