forked from lechien73/p3-deployment-template
-
Notifications
You must be signed in to change notification settings - Fork 36
/
Copy pathindex.html
37 lines (30 loc) · 1020 Bytes
/
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
<!DOCTYPE html>
<html>
<head>
<meta charset="utf-8" />
<script src="https://cdnjs.cloudflare.com/ajax/libs/xterm/3.14.5/xterm.min.js"></script>
<script src="https://cdnjs.cloudflare.com/ajax/libs/xterm/3.14.5/addons/attach/attach.js"></script>
<title>Python Terminal by Code Institute</title>
</head>
<body>
<button onclick="window.location.reload()">Run Program</button>
<div id="terminal"></div>
<script>
var term = new Terminal({
cols: 80,
rows: 24
});
term.open(document.getElementById('terminal'));
term.writeln('Running your file: run.py');
term.writeln('');
var ws = new WebSocket(location.protocol.replace('http', 'ws') + '//' + location.hostname + (location.port ? (
':' + location.port) : '') + '/');
ws.onopen = function () {
new attach.attach(term, ws);
};
ws.onerror = function (e) {
console.log(e);
};
</script>
</body>
</html>