Terminal Open with Esc
Newer version ...?
by dirkk0
HTML
<script src="http://terminal.jcubic.pl/js/jquery.terminal-0.4.6.min.js"></script>
<link rel="stylesheet" href="http://terminal.jcubic.pl/css/jquery.terminal.css">
<button id="open_term">open dialog 7</button>
<div id="term"> </div>
CSS
#term {
border: 1px outset;
// opacity: 0.5;
// display: none;
// position: absolut;
// top: 20px;
width: 300px;
height: 60px;
}
JavaScript
$('#term').terminal(function(command, term) {
if (command == 'test') {
term.echo("you just typed 'test'");
} else {
term.echo('unknown command');
}
}, {
greetings: 'Welcome to the machine',
prompt: '>',
name: 'test'
});
$('#open_term').click(function() {
// term.dialog('open');
$('#term').animate({
width: ['toggle', 'swing'],
opacity: ['toggle', 'swing']
}, 500, function() {
// Animation complete.
});
});
$(document.documentElement).keydown(function(e) {
// console.log(e.charCode);
// console.log(e.keyCode);
if (e.keyCode == 27) {
$('#term').animate({
width: 'toggle',
opacity: 'toggle'
}, 500);
}
});