Compare commits
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
bc67c788d2 | ||
|
|
3f455f90d9 | ||
|
|
ede9ee416a | ||
|
|
53f5672524 | ||
|
|
9d00eec6c4 | ||
|
|
3b1f1ddb2d | ||
|
|
a249d2714f | ||
|
|
3d40dcf3c5 | ||
|
|
d07f61314b | ||
|
|
7355a04274 |
@@ -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)
|
||||||
|
|||||||
+17
-2
@@ -5,7 +5,21 @@
|
|||||||
* 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) {
|
|
||||||
|
(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;
|
var term = this;
|
||||||
|
|
||||||
bidirectional = (typeof bidirectional == 'undefined') ? true : bidirectional;
|
bidirectional = (typeof bidirectional == 'undefined') ? true : bidirectional;
|
||||||
@@ -20,4 +34,5 @@ Terminal.prototype.attach = function (socket, bidirectional) {
|
|||||||
socket.send(data);
|
socket.send(data);
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
}
|
};
|
||||||
|
});
|
||||||
+33
-3
@@ -11,19 +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) {
|
||||||
|
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,
|
var container = this.rowContainer,
|
||||||
subjectRow = this.rowContainer.firstElementChild,
|
subjectRow = this.rowContainer.firstElementChild,
|
||||||
rows = parseInt(container.offsetHeight / subjectRow.offsetHeight),
|
rows,
|
||||||
|
contentBuffer,
|
||||||
characterWidth,
|
characterWidth,
|
||||||
cols;
|
cols;
|
||||||
|
|
||||||
subjectRow.style.display = 'inline';
|
subjectRow.style.display = 'inline';
|
||||||
characterWidth = parseInt(subjectRow.offsetWidth / this.cols);
|
|
||||||
|
contentBuffer = subjectRow.textContent;
|
||||||
|
|
||||||
|
subjectRow.innerHTML = ' '; /* Arbitrary character to calculate its dimensions */
|
||||||
|
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);
|
||||||
|
|
||||||
|
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);
|
this.resize(cols, rows);
|
||||||
};
|
};
|
||||||
|
});
|
||||||
@@ -10,7 +10,20 @@
|
|||||||
* 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) {
|
||||||
|
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;
|
var fn;
|
||||||
|
|
||||||
if (typeof fullscreen == 'undefined') {
|
if (typeof fullscreen == 'undefined') {
|
||||||
@@ -22,4 +35,5 @@ Terminal.prototype.toggleFullscreen = function (fullscreen) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
this.element.classList[fn]('fullscreen');
|
this.element.classList[fn]('fullscreen');
|
||||||
}
|
};
|
||||||
|
});
|
||||||
+1
-1
@@ -1,5 +1,5 @@
|
|||||||
{
|
{
|
||||||
"name": "xterm.js",
|
"name": "xterm.js",
|
||||||
"version": "0.13",
|
"version": "0.17",
|
||||||
"ignore": ["demo", "docs", "test", ".gitignore"]
|
"ignore": ["demo", "docs", "test", ".gitignore"]
|
||||||
}
|
}
|
||||||
|
|||||||
+1
-1
@@ -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
@@ -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.13'
|
version = '0.17'
|
||||||
# The full version, including alpha/beta/rc tags.
|
# The full version, including alpha/beta/rc tags.
|
||||||
release = '0.13 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.
|
||||||
|
|||||||
+19
-15
@@ -31,8 +31,20 @@
|
|||||||
* other features.
|
* other features.
|
||||||
*/
|
*/
|
||||||
|
|
||||||
;(function() {
|
(function (xterm) {
|
||||||
|
if (typeof define == 'function') {
|
||||||
|
/*
|
||||||
|
* Require.js is available
|
||||||
|
*/
|
||||||
|
define([], xterm);
|
||||||
|
} else {
|
||||||
|
/*
|
||||||
|
* Plain browser environment
|
||||||
|
*/
|
||||||
|
this.Xterm = xterm.call(this);
|
||||||
|
this.Terminal = this.Xterm; /* Backwards compatibility with term.js */
|
||||||
|
}
|
||||||
|
})(function() {
|
||||||
/**
|
/**
|
||||||
* Terminal Emulation References:
|
* Terminal Emulation References:
|
||||||
* http://vt100.net/
|
* http://vt100.net/
|
||||||
@@ -50,8 +62,7 @@
|
|||||||
* Shared
|
* Shared
|
||||||
*/
|
*/
|
||||||
|
|
||||||
var window = this
|
var window = this, document = this.document;
|
||||||
, document = this.document;
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* EventEmitter
|
* EventEmitter
|
||||||
@@ -916,9 +927,9 @@ Terminal.prototype.bindMouse = function() {
|
|||||||
if (self.mouseEvents) return;
|
if (self.mouseEvents) return;
|
||||||
if (self.applicationKeypad) return;
|
if (self.applicationKeypad) return;
|
||||||
if (ev.type === 'DOMMouseScroll') {
|
if (ev.type === 'DOMMouseScroll') {
|
||||||
self.scrollDisp(ev.detail < 0 ? -5 : 5);
|
self.scrollDisp(ev.detail < 0 ? -1 : 1);
|
||||||
} else {
|
} else {
|
||||||
self.scrollDisp(ev.wheelDeltaY > 0 ? -5 : 5);
|
self.scrollDisp(ev.wheelDeltaY > 0 ? -1 : 1);
|
||||||
}
|
}
|
||||||
return self.cancel(ev);
|
return self.cancel(ev);
|
||||||
});
|
});
|
||||||
@@ -4763,12 +4774,5 @@ Terminal.on = on;
|
|||||||
Terminal.off = off;
|
Terminal.off = off;
|
||||||
Terminal.cancel = cancel;
|
Terminal.cancel = cancel;
|
||||||
|
|
||||||
if (typeof module !== 'undefined') {
|
return Terminal;
|
||||||
module.exports = Terminal;
|
});
|
||||||
} else {
|
|
||||||
this.Terminal = Terminal;
|
|
||||||
}
|
|
||||||
|
|
||||||
}).call(function() {
|
|
||||||
return this || (typeof window !== 'undefined' ? window : global);
|
|
||||||
}());
|
|
||||||
Reference in New Issue
Block a user