Revamped the attach addon

Also updated docs with proper attach url
This commit is contained in:
paris 2014-05-02 23:45:00 +00:00
parent a1717fdd8d
commit 01e48b7406
2 changed files with 57 additions and 1 deletions

View File

@ -5,8 +5,61 @@
<link rel="stylesheet" href="../../demo/style.css" />
<script src="../../src/xterm.js"></script>
<script src="attach.js"></script>
<style>
body {
color: #111;
}
h1, h2 {
color: #444;
border-bottom: 1px solid #ddd;
text-align: left;
}
form {
margin-bottom: 32px;
}
input, button {
line-height: 22px;
font-size: 16px;
display: inline-block;
border-radius: 2px;
border: 1px solid #ccc;
}
input {
height: 22px;
padding-left: 4px;
padding-right: 4px;
}
button {
height: 28px;
background-color: #ccc;
cursor: pointer;
color: #333;
}
.container {
max-width: 900px;
margin: 0 auto;
}
</style>
</head>
<body>
<div class="container">
<h1>
xterm.js: socket attach
</h1>
<p>
Attach the terminal to a WebSocket terminal stream with ease. Perfect for attaching to your
Docker containers.
</p>
<h2>
Socket information
</h2>
<form id="socket-form">
<input id="socket-url"
type="text"
@ -17,6 +70,8 @@
</button>
</form>
<div id="terminal-container"></div>
</div>
<script>
var term = new Terminal(),
container = document.getElementById('terminal-container'),

View File

@ -19,7 +19,8 @@ Getting started
.. code-block:: javascript
var term = new Terminal(),
socket = new WebSocket('ws://docker/containers/mycontainer/attach/ws');
url = 'ws://docker/containers/mycontainer/attach/ws/?stdin=1&stdout=1&stderr=1&logs=1',
socket = new WebSocket(url);
term.open(document.body);
term.on('data', function (data) {