mirror of
https://git.proxmox.com/git/mirror_xterm.js
synced 2025-11-06 17:09:01 +00:00
66 lines
1.2 KiB
HTML
66 lines
1.2 KiB
HTML
<!doctype html>
|
|
<title>term.js</title>
|
|
<!--
|
|
term.js
|
|
Copyright (c) 2012-2013, Christopher Jeffrey (MIT License)
|
|
-->
|
|
<style>
|
|
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
|
|
});
|
|
|
|
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.on('disconnect', function() {
|
|
term.destroy();
|
|
});
|
|
});
|
|
};
|
|
}).call(this);
|
|
</script>
|