forked from chjj/term.js
-
Notifications
You must be signed in to change notification settings - Fork 0
/
index.html
73 lines (62 loc) · 1.34 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
<!doctype html>
<title>term.js</title>
<!--
term.js
Copyright (c) 2012-2013, Christopher Jeffrey (MIT License)
-->
<style>
html {
background: #555;
}
h1 {
margin-bottom: 20px;
font: 20px/1.5 sans-serif;
}
/*
.terminal {
float: left;
border: #000 solid 5px;
font-family: "DejaVu Sans Mono", "Liberation Mono", monospace;
font-size: 11px;
color: #f0f0f0;
background: #000;
}
.terminal-cursor {
color: #000;
background: #f0f0f0;
}
*/
</style>
<h1>term.js</h1>
<script src="/socket.io/socket.io.js"></script>
<script src="term.js"></script>
<script>
;(function() {
window.onload = function() {
var socket = io.connect();
socket.on('connect', function() {
var term = new Terminal({
cols: 80,
rows: 24,
useStyle: true,
screenKeys: true
});
term.on('data', function(data) {
socket.emit('data', data);
});
term.on('title', function(title) {
document.title = title;
});
term.open(document.body);
term.write('\x1b[31mWelcome to term.js!\x1b[m\r\n');
socket.on('data', function(data) {
term.write(data);
});
socket.emit('browser', "Connection From Browser");
socket.on('disconnect', function() {
term.destroy();
});
});
};
}).call(this);
</script>