terminal-recorder
Version:
Record your terminal session into HTML. Terminal Recorder allows you to record your bash session, and export it to html so then you can share it with your friends.
67 lines (58 loc) • 1.27 kB
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,
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.on('disconnect', function() {
term.destroy();
});
});
};
}).call(this);
</script>