-
Notifications
You must be signed in to change notification settings - Fork 37
/
Copy pathindex.html
51 lines (47 loc) · 1.5 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
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="utf-8" />
<title>Python in a Box</title>
<link
href="https://cdn.jsdelivr.net/npm/bootstrap@5.0.0-beta3/dist/css/bootstrap.min.css"
rel="stylesheet"
integrity="sha384-eOJMYsd53ii+scO/bJGFsiCZc+5NDVN2yr8+0RDqr0Ql0h+rP48ckxlpbzKgwra6"
crossorigin="anonymous"
/>
<link
rel="stylesheet"
href="https://unpkg.com/xterm@4.11.0/css/xterm.css"
crossorigin="anonymous"
/>
<style>
body {
margin: 20px;
}
</style>
</head>
<body>
<p>
<a href="https://github.com/raxod502/python-in-a-box">Python in a Box</a>
</p>
<div id="terminal"></div>
<script src="https://unpkg.com/xterm@4.11.0/lib/xterm.js"></script>
<script src="https://unpkg.com/xterm-addon-attach@0.6.0/lib/xterm-addon-attach.js"></script>
<script src="https://unpkg.com/xterm-addon-fit@0.5.0/lib/xterm-addon-fit.js"></script>
<script>
const term = new Terminal();
const socket = new WebSocket(
`${document.location.protocol === "http:" ? "ws" : "wss"}://${
document.location.host
}/ws`
);
const websocketAddon = new AttachAddon.AttachAddon(socket);
const resizeAddon = new FitAddon.FitAddon();
term.loadAddon(websocketAddon);
term.loadAddon(resizeAddon);
term.open(document.getElementById("terminal"));
resizeAddon.fit();
window.addEventListener("resize", () => resizeAddon.fit());
</script>
</body>
</html>