Compare commits

...
8 Commits
Author SHA1 Message Date
paris bc67c788d2 Bump version to 0.17 2014-09-10 11:09:59 +00:00
paris 3f455f90d9 Fix #4 2014-09-10 11:09:23 +00:00
paris ede9ee416a Bump version to 0.16 2014-08-29 09:58:27 +00:00
paris 53f5672524 Fix #3 2014-08-29 09:57:53 +00:00
paris 9d00eec6c4 Fix #2 2014-08-27 09:50:09 +00:00
paris 3b1f1ddb2d Bump version to 0.15 2014-08-19 13:25:27 +00:00
paris a249d2714f Fix terminal fitting height 2014-08-19 13:24:43 +00:00
Paris Kasidiaris 3d40dcf3c5 Update company name 2014-08-18 11:00:49 +03:00
8 changed files with 4666 additions and 4609 deletions
+1 -1
View File
@@ -17,5 +17,5 @@ all code is your original work.
## License ## License
Copyright (c) 2014, sourceLair, Limited (www.sourcelair.com) (MIT License) Copyright (c) 2014, SourceLair, Limited (www.sourcelair.com) (MIT License)
Copyright (c) 2012-2013, Christopher Jeffrey (MIT License) Copyright (c) 2012-2013, Christopher Jeffrey (MIT License)
+28 -13
View File
@@ -5,19 +5,34 @@
* The bidirectional argument indicates, whether the terminal should * The bidirectional argument indicates, whether the terminal should
* send data to the socket as well and is true, by default. * 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; (function (attach) {
this.socket = socket; 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;
socket.addEventListener('message', function (ev) { bidirectional = (typeof bidirectional == 'undefined') ? true : bidirectional;
term.write(ev.data); this.socket = socket;
});
if (bidirectional) { socket.addEventListener('message', function (ev) {
this.on('data', function (data) { term.write(ev.data);
socket.send(data); });
});
} if (bidirectional) {
} this.on('data', function (data) {
socket.send(data);
});
}
};
});
+40 -16
View File
@@ -11,25 +11,49 @@
* terminal row and truncate its width with the current number * terminal row and truncate its width with the current number
* of columns) * of columns)
*/ */
Terminal.prototype.fit = function () { (function (fit) {
var container = this.rowContainer, if (typeof define == 'function') {
subjectRow = this.rowContainer.firstElementChild, /*
rows = parseInt(container.offsetHeight / subjectRow.offsetHeight), * Require.js is available
contentBuffer, */
characterWidth, define(['../../src/xterm'], fit);
cols; } 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.style.display = 'inline'; subjectRow.style.display = 'inline';
contentBuffer = subjectRow.textContent; contentBuffer = subjectRow.textContent;
subjectRow.textContent = ' '; subjectRow.innerHTML = ' '; /* Arbitrary character to calculate its dimensions */
characterWidth = parseInt(subjectRow.offsetWidth); characterWidth = parseInt(subjectRow.offsetWidth);
characterHeight = parseInt(subjectRow.offsetHeight);
subjectRow.style.display = ''; subjectRow.style.display = '';
cols = container.offsetWidth / characterWidth; cols = container.offsetWidth / characterWidth;
cols = parseInt(cols); cols = parseInt(cols);
this.resize(cols, rows); 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);
};
});
+25 -11
View File
@@ -10,16 +10,30 @@
* If the `fullscreen` argument has not been supplied, the * If the `fullscreen` argument has not been supplied, the
* fullscreen mode is being toggled. * fullscreen mode is being toggled.
*/ */
Terminal.prototype.toggleFullscreen = function (fullscreen) { (function (fullscreen) {
var fn; 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') { if (typeof fullscreen == 'undefined') {
fn = (this.element.classList.contains('fullscreen')) ? 'remove' : 'add'; fn = (this.element.classList.contains('fullscreen')) ? 'remove' : 'add';
} else if (!fullscreen) { } else if (!fullscreen) {
fn = 'remove'; fn = 'remove';
} else { } else {
fn = 'add'; fn = 'add';
} }
this.element.classList[fn]('fullscreen'); this.element.classList[fn]('fullscreen');
} };
});
+1 -1
View File
@@ -1,5 +1,5 @@
{ {
"name": "xterm.js", "name": "xterm.js",
"version": "0.14", "version": "0.17",
"ignore": ["demo", "docs", "test", ".gitignore"] "ignore": ["demo", "docs", "test", ".gitignore"]
} }
+1 -1
View File
@@ -3,7 +3,7 @@
<head> <head>
<title>xterm.js demo</title> <title>xterm.js demo</title>
<link rel="stylesheet" href="../src/xterm.css" /> <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" /> <link rel="stylesheet" href="style.css" />
<script src="../src/xterm.js" ></script> <script src="../src/xterm.js" ></script>
<script src="../addons/fit/fit.js" ></script> <script src="../addons/fit/fit.js" ></script>
+2 -2
View File
@@ -51,9 +51,9 @@ copyright = u'2014, SourceLair Limited'
# built documents. # built documents.
# #
# The short X.Y version. # The short X.Y version.
version = '0.14' version = '0.17'
# The full version, including alpha/beta/rc tags. # The full version, including alpha/beta/rc tags.
release = '0.14 Alpha' release = '0.17 Alpha'
# The language for content autogenerated by Sphinx. Refer to documentation # The language for content autogenerated by Sphinx. Refer to documentation
# for a list of supported languages. # for a list of supported languages.
+4513 -4509
View File
File diff suppressed because it is too large Load Diff