-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathindex.html
118 lines (111 loc) · 3.87 KB
/
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
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
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
{{define "index"}}
<html>
<head>
<meta charset="utf-8">
<title>Toukei</title>
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<meta name="description" content="">
<meta name="author" content="">
<!-- Le styles -->
<link href="/assets/css/bootstrap.min.css" rel="stylesheet">
<style>
body {
padding-top: 60px; /* 60px to make the container go all the way to the bottom of the topbar */
}
</style>
<link href="/assets/css/bootstrap-responsive.min.css" rel="stylesheet">
<!-- Le HTML5 shim, for IE6-8 support of HTML5 elements -->
<!--[if lt IE 9]>
<script src="http://html5shim.googlecode.com/svn/trunk/html5.js"></script>
<![endif]-->
<!-- Le fav and touch icons -->
<link rel="shortcut icon" href="/assets/ico/favicon.ico">
<link rel="apple-touch-icon-precomposed" sizes="114x114" href="/assets/ico/apple-touch-icon-114-precomposed.png">
<link rel="apple-touch-icon-precomposed" sizes="72x72" href="/assets/ico/apple-touch-icon-72-precomposed.png">
<link rel="apple-touch-icon-precomposed" href="/assets/ico/apple-touch-icon-57-precomposed.png">
<script type="text/javascript">
function init() {
var path;
var ws;
console.log("init");
if (ws != null) {
ws.close();
ws = null;
}
path = "/json";
console.log("path:" + path);
var div = document.getElementById("msg");
ws = new WebSocket("ws://{{.}}" + path);
ws.onopen = function () {
div.innerHTML = "Opened WS connection<br>" + div.innerHTML;
};
ws.onmessage = function (e) {
div.innerHTML = "msg:" + e.data + "<br>" + div.innerHTML;
if (e.data instanceof ArrayBuffer) {
s = "ArrayBuffer: " + e.data.byteLength + "[";
var view = new Uint8Array(e.data);
for (var i = 0; i < view.length; ++i) {
s += " " + view[i];
}
s += "]";
div.innerHTML = s + "<br>" + div.innerHTML;
}
};
ws.onclose = function (e) {
div.innerHTML = "Closed WS connection<br>" + div.innerHTML;
};
console.log("init");
div.innerHTML = "Initialized WS connection<br>" + div.innerHTML;
};
</script>
</head>
<body onLoad="init();">
<a href="https://github.com/seasonlabs/toukei"><img style="position: absolute; top: 0; right: 0; border: 0;" src="https://s3.amazonaws.com/github/ribbons/forkme_right_green_007200.png" alt="Fork me on GitHub"></a>
<div class="container">
<div class="hero-unit">
<h1>Toukei</h1>
<p>Toukei is a highly-concurrent, multi-threaded, realtime, git repository statistics server written in Go (golang)</p>
<a href="https://github.com/seasonlabs/toukei">https://github.com/seasonlabs/toukei</a>
</div>
<div class="well">
<div id="msg"></div>
</div>
<p>Copy this code and modify it to fit your needs.</p>
<pre>
function init() {
var path;
var ws;
console.log("init");
if (ws != null) {
ws.close();
ws = null;
}
path = "/json";
console.log("path:" + path);
var div = document.getElementById("msg");
ws = new WebSocket("ws://{{.}}" + path);
ws.onopen = function () {
div.innerHTML = "Opened WS connection<br>" + div.innerHTML;
};
ws.onmessage = function (e) {
div.innerHTML = "msg:" + e.data + "<br>" + div.innerHTML;
if (e.data instanceof ArrayBuffer) {
s = "ArrayBuffer: " + e.data.byteLength + "[";
var view = new Uint8Array(e.data);
for (var i = 0; i < view.length; ++i) {
s += " " + view[i];
}
s += "]";
div.innerHTML = s + "<br>" + div.innerHTML;
}
};
ws.onclose = function (e) {
div.innerHTML = "Closed WS connection<br>" + div.innerHTML;
};
console.log("init");
div.innerHTML = "Initialized WS connection<br>" + div.innerHTML;
};
</pre>
</body>
</html>
{{end}}