Compare commits
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
670efc4454 | ||
|
|
74f9526177 | ||
|
|
28b553caa6 | ||
|
|
22ff176c6a | ||
|
|
d24e00554d | ||
|
|
bc67c788d2 | ||
|
|
3f455f90d9 | ||
|
|
ede9ee416a | ||
|
|
53f5672524 | ||
|
|
9d00eec6c4 | ||
|
|
3b1f1ddb2d | ||
|
|
a249d2714f | ||
|
|
3d40dcf3c5 |
@@ -2,20 +2,18 @@
|
||||
|
||||
Xterm.js is a full xterm clone, written completely in JavaScript.
|
||||
|
||||
Xterm.js supplies a modular, event-based interface that lets developers build addons and themes that augment
|
||||
the experience of running a fully-feature terminal inside the browser.
|
||||
Xterm.js supplies a modular, event-based interface that lets developers build addons and themes that augment the experience of running a fully-featured terminal inside the browser.
|
||||
|
||||
Xterm.js serves as the foundation for the terminal found at www.sourcelair.com.
|
||||
Xterm.js serves as foundation for the terminal found at www.sourcelair.com.
|
||||
|
||||

|
||||
|
||||
### Contribution and License Agreement
|
||||
|
||||
If you contribute code to this project, you are implicitly allowing your code
|
||||
to be distributed under the MIT license. You are also implicitly verifying that
|
||||
all code is your original work.
|
||||
If you contribute code to this project, you are implicitly allowing your code to be distributed under the MIT license. You are also implicitly verifying that all code is your original work.
|
||||
|
||||
## License
|
||||
|
||||
Copyright (c) 2014, sourceLair, Limited (www.sourcelair.com) (MIT License)
|
||||
Copyright (c) 2014, SourceLair, Ltd (www.sourcelair.com) (MIT License)
|
||||
|
||||
Copyright (c) 2012-2013, Christopher Jeffrey (MIT License)
|
||||
|
||||
+43
-16
@@ -5,19 +5,46 @@
|
||||
* The bidirectional argument indicates, whether the terminal should
|
||||
* send data to the socket as well and is true, by default.
|
||||
*/
|
||||
Terminal.prototype.attach = function (socket, bidirectional) {
|
||||
var term = this;
|
||||
|
||||
bidirectional = (typeof bidirectional == 'undefined') ? true : bidirectional;
|
||||
this.socket = socket;
|
||||
|
||||
socket.addEventListener('message', function (ev) {
|
||||
term.write(ev.data);
|
||||
});
|
||||
|
||||
if (bidirectional) {
|
||||
this.on('data', function (data) {
|
||||
socket.send(data);
|
||||
});
|
||||
}
|
||||
}
|
||||
|
||||
(function (attach) {
|
||||
if (typeof define == 'function') {
|
||||
/*
|
||||
* Require.js is available
|
||||
*/
|
||||
define(['../../src/xterm'], attach);
|
||||
} else {
|
||||
/*
|
||||
* Plain browser environment
|
||||
*/
|
||||
attach(this.Xterm);
|
||||
}
|
||||
})(function (Xterm) {
|
||||
Xterm.prototype.attach = function (socket, bidirectional) {
|
||||
var term = this;
|
||||
|
||||
bidirectional = (typeof bidirectional == 'undefined') ? true : bidirectional;
|
||||
this.socket = socket;
|
||||
|
||||
function _getMessage (ev) {
|
||||
term.write(ev.data);
|
||||
}
|
||||
|
||||
function _sendData (data) {
|
||||
socket.send(data);
|
||||
}
|
||||
|
||||
function _detach () {
|
||||
term.off('data', _sendData);
|
||||
socket.removeEventListener('message', _getMessage);
|
||||
}
|
||||
|
||||
socket.addEventListener('message', _getMessage);
|
||||
|
||||
if (bidirectional) {
|
||||
this.on('data', _sendData);
|
||||
}
|
||||
|
||||
socket.addEventListener('close', _detach);
|
||||
socket.addEventListener('error', _detach);
|
||||
};
|
||||
});
|
||||
+44
-20
@@ -11,25 +11,49 @@
|
||||
* terminal row and truncate its width with the current number
|
||||
* of columns)
|
||||
*/
|
||||
Terminal.prototype.fit = function () {
|
||||
var container = this.rowContainer,
|
||||
subjectRow = this.rowContainer.firstElementChild,
|
||||
rows = parseInt(container.offsetHeight / subjectRow.offsetHeight),
|
||||
contentBuffer,
|
||||
characterWidth,
|
||||
cols;
|
||||
|
||||
subjectRow.style.display = 'inline';
|
||||
|
||||
contentBuffer = subjectRow.textContent;
|
||||
(function (fit) {
|
||||
if (typeof define == 'function') {
|
||||
/*
|
||||
* Require.js is available
|
||||
*/
|
||||
define(['../../src/xterm'], fit);
|
||||
} else {
|
||||
/*
|
||||
* Plain browser environment
|
||||
*/
|
||||
fit(this.Xterm);
|
||||
}
|
||||
})(function (Xterm) {
|
||||
Xterm.prototype.fit = function () {
|
||||
var container = this.rowContainer,
|
||||
subjectRow = this.rowContainer.firstElementChild,
|
||||
rows,
|
||||
contentBuffer,
|
||||
characterWidth,
|
||||
cols;
|
||||
|
||||
subjectRow.textContent = ' ';
|
||||
characterWidth = parseInt(subjectRow.offsetWidth);
|
||||
subjectRow.style.display = 'inline';
|
||||
|
||||
subjectRow.style.display = '';
|
||||
|
||||
cols = container.offsetWidth / characterWidth;
|
||||
cols = parseInt(cols);
|
||||
|
||||
this.resize(cols, rows);
|
||||
};
|
||||
contentBuffer = subjectRow.textContent;
|
||||
|
||||
subjectRow.innerHTML = ' '; /* Arbitrary character to calculate its dimensions */
|
||||
characterWidth = parseInt(subjectRow.offsetWidth);
|
||||
characterHeight = parseInt(subjectRow.offsetHeight);
|
||||
|
||||
subjectRow.style.display = '';
|
||||
|
||||
cols = container.offsetWidth / characterWidth;
|
||||
cols = parseInt(cols);
|
||||
|
||||
var parentElementStyle = window.getComputedStyle(this.element.parentElement),
|
||||
parentElementHeight = parseInt(parentElementStyle.getPropertyValue('height')),
|
||||
elementStyle = window.getComputedStyle(this.element),
|
||||
elementPadding = parseInt(elementStyle.getPropertyValue('padding-top')) + parseInt(elementStyle.getPropertyValue('padding-bottom')),
|
||||
availableHeight = parentElementHeight - elementPadding,
|
||||
rowHeight = this.rowContainer.firstElementChild.offsetHeight;
|
||||
|
||||
rows = parseInt(availableHeight / rowHeight);
|
||||
|
||||
this.resize(cols, rows);
|
||||
};
|
||||
});
|
||||
@@ -10,16 +10,30 @@
|
||||
* If the `fullscreen` argument has not been supplied, the
|
||||
* fullscreen mode is being toggled.
|
||||
*/
|
||||
Terminal.prototype.toggleFullscreen = function (fullscreen) {
|
||||
var fn;
|
||||
|
||||
if (typeof fullscreen == 'undefined') {
|
||||
fn = (this.element.classList.contains('fullscreen')) ? 'remove' : 'add';
|
||||
} else if (!fullscreen) {
|
||||
fn = 'remove';
|
||||
} else {
|
||||
fn = 'add';
|
||||
}
|
||||
|
||||
this.element.classList[fn]('fullscreen');
|
||||
}
|
||||
(function (fullscreen) {
|
||||
if (typeof define == 'function') {
|
||||
/*
|
||||
* Require.js is available
|
||||
*/
|
||||
define(['../../src/xterm'], fullscreen);
|
||||
} else {
|
||||
/*
|
||||
* Plain browser environment
|
||||
*/
|
||||
fullscreen(this.Xterm);
|
||||
}
|
||||
})(function (Xterm) {
|
||||
Xterm.prototype.toggleFullscreen = function (fullscreen) {
|
||||
var fn;
|
||||
|
||||
if (typeof fullscreen == 'undefined') {
|
||||
fn = (this.element.classList.contains('fullscreen')) ? 'remove' : 'add';
|
||||
} else if (!fullscreen) {
|
||||
fn = 'remove';
|
||||
} else {
|
||||
fn = 'add';
|
||||
}
|
||||
|
||||
this.element.classList[fn]('fullscreen');
|
||||
};
|
||||
});
|
||||
+1
-1
@@ -1,5 +1,5 @@
|
||||
{
|
||||
"name": "xterm.js",
|
||||
"version": "0.14",
|
||||
"version": "0.19",
|
||||
"ignore": ["demo", "docs", "test", ".gitignore"]
|
||||
}
|
||||
|
||||
+1
-1
@@ -3,7 +3,7 @@
|
||||
<head>
|
||||
<title>xterm.js demo</title>
|
||||
<link rel="stylesheet" href="../src/xterm.css" />
|
||||
<link rel="stylesheet" href="../addon/fullscreen/fullscreen.css" />
|
||||
<link rel="stylesheet" href="../addons/fullscreen/fullscreen.css" />
|
||||
<link rel="stylesheet" href="style.css" />
|
||||
<script src="../src/xterm.js" ></script>
|
||||
<script src="../addons/fit/fit.js" ></script>
|
||||
|
||||
+2
-2
@@ -51,9 +51,9 @@ copyright = u'2014, SourceLair Limited'
|
||||
# built documents.
|
||||
#
|
||||
# The short X.Y version.
|
||||
version = '0.14'
|
||||
version = '0.19'
|
||||
# The full version, including alpha/beta/rc tags.
|
||||
release = '0.14 Alpha'
|
||||
release = '0.19 Alpha'
|
||||
|
||||
# The language for content autogenerated by Sphinx. Refer to documentation
|
||||
# for a list of supported languages.
|
||||
|
||||
@@ -45,6 +45,7 @@
|
||||
|
||||
.xterm .terminal-cursor {
|
||||
background-color: #fff;
|
||||
color: #000;
|
||||
}
|
||||
|
||||
.xterm .xterm-helpers {
|
||||
|
||||
+4559
-4555
File diff suppressed because it is too large
Load Diff
Reference in New Issue
Block a user