Skip to content

Instantly share code, notes, and snippets.

@AndrewBarfield
Created December 31, 2014 16:49
Show Gist options
  • Star 6 You must be signed in to star a gist
  • Fork 2 You must be signed in to fork a gist
  • Save AndrewBarfield/3ee59402501422cdec47 to your computer and use it in GitHub Desktop.
Save AndrewBarfield/3ee59402501422cdec47 to your computer and use it in GitHub Desktop.
HTML5 Web Terminal

HTML5 Web Terminal

A console for the Web written in completely in JavaScript. The console supports Web versions of some Linux commands. This work is based, in part, on earlier work by Eric Bidelman.

A Pen by Andrew Mitchell Barfield on CodePen.

License.

<html>
<head>
<meta charset="utf-8" />
<meta http-equiv="X-UA-Compatible" content="chrome=1" />
<title>HTML5 Web Terminal</title>
<link href="http://fonts.googleapis.com/css?family=Inconsolata"
rel="stylesheet" type="text/css" />
</head>
<body>
<div id="container">
<output></output>
<div id="input-line" class="input-line">
<div class="prompt"></div><div><input class="cmdline" autofocus /></div>
</div>
</div>
<script src="http://www.codehelper.io/api/ips/?js"></script>
<script src="http://code.jquery.com/jquery-2.1.1.min.js"></script>
<script src="http://s.codepen.io/AndrewBarfield/pen/LEbPJx.js"></script>
</body>
</html>
$(function() {
$('.prompt').html('[' + codehelper_ip["IP"] + '@HTML5] # ');
var term = new Terminal('#input-line .cmdline', '#container output');
term.initFS();
});
::selection {
background: #FF5E99;
}
html, body {
width: 100%;
height: 100%;
margin: 0;
}
body {
font-size: 11pt;
font-family: Inconsolata, monospace;
color: white;
background-color: black;
}
#container {
padding: .1em 1.5em 1em 1em;
}
#container output {
clear: both;
width: 100%;
}
#container output h3 {
margin: 0;
}
#container output pre {
margin: 0;
}
.input-line {
display: -webkit-box;
-webkit-box-orient: horizontal;
-webkit-box-align: stretch;
display: -moz-box;
-moz-box-orient: horizontal;
-moz-box-align: stretch;
display: box;
box-orient: horizontal;
box-align: stretch;
clear: both;
}
.input-line > div:nth-child(2) {
-webkit-box-flex: 1;
-moz-box-flex: 1;
box-flex: 1;
}
.prompt {
white-space: nowrap;
color: #96b38a;
margin-right: 7px;
display: -webkit-box;
-webkit-box-pack: center;
-webkit-box-orient: vertical;
display: -moz-box;
-moz-box-pack: center;
-moz-box-orient: vertical;
display: box;
box-pack: center;
box-orient: vertical;
-webkit-user-select: none;
-moz-user-select: none;
user-select: none;
}
.cmdline {
outline: none;
background-color: transparent;
margin: 0;
width: 100%;
font: inherit;
border: none;
color: inherit;
}
.ls-files {
height: 45px;
-webkit-column-width: 100px;
-moz-column-width: 100px;
-o-column-width: 100px;
column-width: 100px;
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment