Merge pull request #283 from KLuka/cleanup
Project cleanup * Updated .gitignore * Autogenerated .js files were removed. * Fixes for issues 39, 43, 166 and 172 were transferred from .js to .jspp files
This commit is contained in:
commit
79574d8ac4
7 changed files with 73 additions and 10416 deletions
27
.gitignore
vendored
27
.gitignore
vendored
|
@ -1,4 +1,31 @@
|
||||||
*.o
|
*.o
|
||||||
|
*.la
|
||||||
*.lo
|
*.lo
|
||||||
*~
|
*~
|
||||||
.libs
|
.libs
|
||||||
|
.deps
|
||||||
|
autom4te.cache
|
||||||
|
config.h
|
||||||
|
config.log
|
||||||
|
config.status
|
||||||
|
demo/demo.js
|
||||||
|
demo/vt100.js
|
||||||
|
libtool
|
||||||
|
Makefile
|
||||||
|
shellinabox/beep.h
|
||||||
|
shellinabox/cgi_root.h
|
||||||
|
shellinabox/enabled.h
|
||||||
|
shellinabox/favicon.h
|
||||||
|
shellinabox/keyboard.h
|
||||||
|
shellinabox/keyboard-layout.h
|
||||||
|
shellinabox/print-styles.h
|
||||||
|
shellinabox/root_page.h
|
||||||
|
shellinabox/shell_in_a_box.h
|
||||||
|
shellinabox/shell_in_a_box.js
|
||||||
|
shellinabox/styles.h
|
||||||
|
shellinabox/vt100.h
|
||||||
|
shellinabox/vt100.js
|
||||||
|
shellinaboxd
|
||||||
|
shellinaboxd.1
|
||||||
|
shellinaboxd.ps
|
||||||
|
stamp-h1
|
||||||
|
|
1186
demo/demo.js
1186
demo/demo.js
File diff suppressed because it is too large
Load diff
4393
demo/vt100.js
4393
demo/vt100.js
File diff suppressed because it is too large
Load diff
|
@ -1,373 +0,0 @@
|
||||||
// ShellInABox.js -- Use XMLHttpRequest to provide an AJAX terminal emulator.
|
|
||||||
// Copyright (C) 2008-2010 Markus Gutschke <markus@shellinabox.com>
|
|
||||||
//
|
|
||||||
// This program is free software; you can redistribute it and/or modify
|
|
||||||
// it under the terms of the GNU General Public License version 2 as
|
|
||||||
// published by the Free Software Foundation.
|
|
||||||
//
|
|
||||||
// This program is distributed in the hope that it will be useful,
|
|
||||||
// but WITHOUT ANY WARRANTY; without even the implied warranty of
|
|
||||||
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
|
||||||
// GNU General Public License for more details.
|
|
||||||
//
|
|
||||||
// You should have received a copy of the GNU General Public License along
|
|
||||||
// with this program; if not, write to the Free Software Foundation, Inc.,
|
|
||||||
// 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
|
|
||||||
//
|
|
||||||
// In addition to these license terms, the author grants the following
|
|
||||||
// additional rights:
|
|
||||||
//
|
|
||||||
// If you modify this program, or any covered work, by linking or
|
|
||||||
// combining it with the OpenSSL project's OpenSSL library (or a
|
|
||||||
// modified version of that library), containing parts covered by the
|
|
||||||
// terms of the OpenSSL or SSLeay licenses, the author
|
|
||||||
// grants you additional permission to convey the resulting work.
|
|
||||||
// Corresponding Source for a non-source form of such a combination
|
|
||||||
// shall include the source code for the parts of OpenSSL used as well
|
|
||||||
// as that of the covered work.
|
|
||||||
//
|
|
||||||
// You may at your option choose to remove this additional permission from
|
|
||||||
// the work, or from any part of it.
|
|
||||||
//
|
|
||||||
// It is possible to build this program in a way that it loads OpenSSL
|
|
||||||
// libraries at run-time. If doing so, the following notices are required
|
|
||||||
// by the OpenSSL and SSLeay licenses:
|
|
||||||
//
|
|
||||||
// This product includes software developed by the OpenSSL Project
|
|
||||||
// for use in the OpenSSL Toolkit. (http://www.openssl.org/)
|
|
||||||
//
|
|
||||||
// This product includes cryptographic software written by Eric Young
|
|
||||||
// (eay@cryptsoft.com)
|
|
||||||
//
|
|
||||||
//
|
|
||||||
// The most up-to-date version of this program is always available from
|
|
||||||
// http://shellinabox.com
|
|
||||||
//
|
|
||||||
//
|
|
||||||
// Notes:
|
|
||||||
//
|
|
||||||
// The author believes that for the purposes of this license, you meet the
|
|
||||||
// requirements for publishing the source code, if your web server publishes
|
|
||||||
// the source in unmodified form (i.e. with licensing information, comments,
|
|
||||||
// formatting, and identifier names intact). If there are technical reasons
|
|
||||||
// that require you to make changes to the source code when serving the
|
|
||||||
// JavaScript (e.g to remove pre-processor directives from the source), these
|
|
||||||
// changes should be done in a reversible fashion.
|
|
||||||
//
|
|
||||||
// The author does not consider websites that reference this script in
|
|
||||||
// unmodified form, and web servers that serve this script in unmodified form
|
|
||||||
// to be derived works. As such, they are believed to be outside of the
|
|
||||||
// scope of this license and not subject to the rights or restrictions of the
|
|
||||||
// GNU General Public License.
|
|
||||||
//
|
|
||||||
// If in doubt, consult a legal professional familiar with the laws that
|
|
||||||
// apply in your country.
|
|
||||||
|
|
||||||
// #define XHR_UNITIALIZED 0
|
|
||||||
// #define XHR_OPEN 1
|
|
||||||
// #define XHR_SENT 2
|
|
||||||
// #define XHR_RECEIVING 3
|
|
||||||
// #define XHR_LOADED 4
|
|
||||||
|
|
||||||
// IE does not define XMLHttpRequest by default, so we provide a suitable
|
|
||||||
// wrapper.
|
|
||||||
if (typeof XMLHttpRequest == 'undefined') {
|
|
||||||
XMLHttpRequest = function() {
|
|
||||||
try { return new ActiveXObject('Msxml2.XMLHTTP.6.0');} catch (e) { }
|
|
||||||
try { return new ActiveXObject('Msxml2.XMLHTTP.3.0');} catch (e) { }
|
|
||||||
try { return new ActiveXObject('Msxml2.XMLHTTP'); } catch (e) { }
|
|
||||||
try { return new ActiveXObject('Microsoft.XMLHTTP'); } catch (e) { }
|
|
||||||
throw new Error('');
|
|
||||||
};
|
|
||||||
}
|
|
||||||
|
|
||||||
function extend(subClass, baseClass) {
|
|
||||||
function inheritance() { }
|
|
||||||
inheritance.prototype = baseClass.prototype;
|
|
||||||
subClass.prototype = new inheritance();
|
|
||||||
subClass.prototype.constructor = subClass;
|
|
||||||
subClass.prototype.superClass = baseClass.prototype;
|
|
||||||
};
|
|
||||||
|
|
||||||
function ShellInABox(url, container) {
|
|
||||||
if (url == undefined) {
|
|
||||||
this.rooturl = document.location.href;
|
|
||||||
this.url = document.location.href.replace(/[?#].*/, '');
|
|
||||||
} else {
|
|
||||||
this.rooturl = url;
|
|
||||||
this.url = url;
|
|
||||||
}
|
|
||||||
if (document.location.hash != '') {
|
|
||||||
var hash = decodeURIComponent(document.location.hash).
|
|
||||||
replace(/^#/, '');
|
|
||||||
this.nextUrl = hash.replace(/,.*/, '');
|
|
||||||
this.session = hash.replace(/[^,]*,/, '');
|
|
||||||
} else {
|
|
||||||
this.nextUrl = this.url;
|
|
||||||
this.session = null;
|
|
||||||
}
|
|
||||||
this.pendingKeys = '';
|
|
||||||
this.keysInFlight = false;
|
|
||||||
this.connected = false;
|
|
||||||
this.superClass.constructor.call(this, container);
|
|
||||||
|
|
||||||
// We have to initiate the first XMLHttpRequest from a timer. Otherwise,
|
|
||||||
// Chrome never realizes that the page has loaded.
|
|
||||||
setTimeout(function(shellInABox) {
|
|
||||||
return function() {
|
|
||||||
shellInABox.sendRequest();
|
|
||||||
};
|
|
||||||
}(this), 1);
|
|
||||||
};
|
|
||||||
extend(ShellInABox, VT100);
|
|
||||||
|
|
||||||
ShellInABox.prototype.sessionClosed = function() {
|
|
||||||
try {
|
|
||||||
this.connected = false;
|
|
||||||
if (this.session) {
|
|
||||||
this.session = undefined;
|
|
||||||
if (this.cursorX > 0) {
|
|
||||||
this.vt100('\r\n');
|
|
||||||
}
|
|
||||||
this.vt100('Session closed.');
|
|
||||||
}
|
|
||||||
this.showReconnect(true);
|
|
||||||
} catch (e) {
|
|
||||||
}
|
|
||||||
};
|
|
||||||
|
|
||||||
ShellInABox.prototype.reconnect = function() {
|
|
||||||
this.showReconnect(false);
|
|
||||||
if (!this.session) {
|
|
||||||
if (document.location.hash != '') {
|
|
||||||
// A shellinaboxd daemon launched from a CGI only allows a single
|
|
||||||
// session. In order to reconnect, we must reload the frame definition
|
|
||||||
// and obtain a new port number. As this is a different origin, we
|
|
||||||
// need to get enclosing page to help us.
|
|
||||||
parent.location = this.nextUrl;
|
|
||||||
} else {
|
|
||||||
if (this.url != this.nextUrl) {
|
|
||||||
document.location.replace(this.nextUrl);
|
|
||||||
} else {
|
|
||||||
this.pendingKeys = '';
|
|
||||||
this.keysInFlight = false;
|
|
||||||
this.reset(true);
|
|
||||||
this.sendRequest();
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
return false;
|
|
||||||
};
|
|
||||||
|
|
||||||
ShellInABox.prototype.sendRequest = function(request) {
|
|
||||||
if (request == undefined) {
|
|
||||||
request = new XMLHttpRequest();
|
|
||||||
}
|
|
||||||
request.open('POST', this.url + '?', true);
|
|
||||||
request.setRequestHeader('Cache-Control', 'no-cache');
|
|
||||||
request.setRequestHeader('Content-Type',
|
|
||||||
'application/x-www-form-urlencoded; charset=utf-8');
|
|
||||||
var content = 'width=' + this.terminalWidth +
|
|
||||||
'&height=' + this.terminalHeight +
|
|
||||||
(this.session ? '&session=' +
|
|
||||||
encodeURIComponent(this.session) : '&rooturl='+
|
|
||||||
encodeURIComponent(this.rooturl));
|
|
||||||
request.setRequestHeader('Content-Length', content.length);
|
|
||||||
|
|
||||||
request.onreadystatechange = function(shellInABox) {
|
|
||||||
return function() {
|
|
||||||
try {
|
|
||||||
return shellInABox.onReadyStateChange(request);
|
|
||||||
} catch (e) {
|
|
||||||
shellInABox.sessionClosed();
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}(this);
|
|
||||||
request.send(content);
|
|
||||||
};
|
|
||||||
|
|
||||||
ShellInABox.prototype.onReadyStateChange = function(request) {
|
|
||||||
if (request.readyState == 4 /* XHR_LOADED */) {
|
|
||||||
if (request.status == 200) {
|
|
||||||
this.connected = true;
|
|
||||||
var response = eval('(' + request.responseText + ')');
|
|
||||||
if (response.data) {
|
|
||||||
this.vt100(response.data);
|
|
||||||
}
|
|
||||||
|
|
||||||
if (!response.session ||
|
|
||||||
this.session && this.session != response.session) {
|
|
||||||
this.sessionClosed();
|
|
||||||
} else {
|
|
||||||
this.session = response.session;
|
|
||||||
this.sendRequest(request);
|
|
||||||
}
|
|
||||||
} else if (request.status == 0) {
|
|
||||||
// Time Out
|
|
||||||
this.sendRequest(request);
|
|
||||||
} else {
|
|
||||||
this.sessionClosed();
|
|
||||||
}
|
|
||||||
}
|
|
||||||
};
|
|
||||||
|
|
||||||
ShellInABox.prototype.sendKeys = function(keys) {
|
|
||||||
if (!this.connected) {
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
if (this.keysInFlight || this.session == undefined) {
|
|
||||||
this.pendingKeys += keys;
|
|
||||||
} else {
|
|
||||||
this.keysInFlight = true;
|
|
||||||
keys = this.pendingKeys + keys;
|
|
||||||
this.pendingKeys = '';
|
|
||||||
var request = new XMLHttpRequest();
|
|
||||||
request.open('POST', this.url + '?', true);
|
|
||||||
request.setRequestHeader('Cache-Control', 'no-cache');
|
|
||||||
request.setRequestHeader('Content-Type',
|
|
||||||
'application/x-www-form-urlencoded; charset=utf-8');
|
|
||||||
var content = 'width=' + this.terminalWidth +
|
|
||||||
'&height=' + this.terminalHeight +
|
|
||||||
'&session=' +encodeURIComponent(this.session)+
|
|
||||||
'&keys=' + encodeURIComponent(keys);
|
|
||||||
request.setRequestHeader('Content-Length', content.length);
|
|
||||||
request.onreadystatechange = function(shellInABox) {
|
|
||||||
return function() {
|
|
||||||
try {
|
|
||||||
return shellInABox.keyPressReadyStateChange(request);
|
|
||||||
} catch (e) {
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}(this);
|
|
||||||
request.send(content);
|
|
||||||
}
|
|
||||||
};
|
|
||||||
|
|
||||||
ShellInABox.prototype.keyPressReadyStateChange = function(request) {
|
|
||||||
if (request.readyState == 4 /* XHR_LOADED */) {
|
|
||||||
this.keysInFlight = false;
|
|
||||||
if (this.pendingKeys) {
|
|
||||||
this.sendKeys('');
|
|
||||||
}
|
|
||||||
}
|
|
||||||
};
|
|
||||||
|
|
||||||
ShellInABox.prototype.keysPressed = function(ch) {
|
|
||||||
var hex = '0123456789ABCDEF';
|
|
||||||
var s = '';
|
|
||||||
for (var i = 0; i < ch.length; i++) {
|
|
||||||
var c = ch.charCodeAt(i);
|
|
||||||
if (c < 128) {
|
|
||||||
s += hex.charAt(c >> 4) + hex.charAt(c & 0xF);
|
|
||||||
} else if (c < 0x800) {
|
|
||||||
s += hex.charAt(0xC + (c >> 10) ) +
|
|
||||||
hex.charAt( (c >> 6) & 0xF ) +
|
|
||||||
hex.charAt(0x8 + ((c >> 4) & 0x3)) +
|
|
||||||
hex.charAt( c & 0xF );
|
|
||||||
} else if (c < 0x10000) {
|
|
||||||
s += 'E' +
|
|
||||||
hex.charAt( (c >> 12) ) +
|
|
||||||
hex.charAt(0x8 + ((c >> 10) & 0x3)) +
|
|
||||||
hex.charAt( (c >> 6) & 0xF ) +
|
|
||||||
hex.charAt(0x8 + ((c >> 4) & 0x3)) +
|
|
||||||
hex.charAt( c & 0xF );
|
|
||||||
} else if (c < 0x110000) {
|
|
||||||
s += 'F' +
|
|
||||||
hex.charAt( (c >> 18) ) +
|
|
||||||
hex.charAt(0x8 + ((c >> 16) & 0x3)) +
|
|
||||||
hex.charAt( (c >> 12) & 0xF ) +
|
|
||||||
hex.charAt(0x8 + ((c >> 10) & 0x3)) +
|
|
||||||
hex.charAt( (c >> 6) & 0xF ) +
|
|
||||||
hex.charAt(0x8 + ((c >> 4) & 0x3)) +
|
|
||||||
hex.charAt( c & 0xF );
|
|
||||||
}
|
|
||||||
}
|
|
||||||
this.sendKeys(s);
|
|
||||||
};
|
|
||||||
|
|
||||||
ShellInABox.prototype.resized = function(w, h) {
|
|
||||||
// Do not send a resize request until we are fully initialized.
|
|
||||||
if (this.session) {
|
|
||||||
// sendKeys() always transmits the current terminal size. So, flush all
|
|
||||||
// pending keys.
|
|
||||||
this.sendKeys('');
|
|
||||||
}
|
|
||||||
};
|
|
||||||
|
|
||||||
ShellInABox.prototype.toggleSSL = function() {
|
|
||||||
if (document.location.hash != '') {
|
|
||||||
if (this.nextUrl.match(/\?plain$/)) {
|
|
||||||
this.nextUrl = this.nextUrl.replace(/\?plain$/, '');
|
|
||||||
} else {
|
|
||||||
this.nextUrl = this.nextUrl.replace(/[?#].*/, '') + '?plain';
|
|
||||||
}
|
|
||||||
if (!this.session) {
|
|
||||||
parent.location = this.nextUrl;
|
|
||||||
}
|
|
||||||
} else {
|
|
||||||
this.nextUrl = this.nextUrl.match(/^https:/)
|
|
||||||
? this.nextUrl.replace(/^https:/, 'http:').replace(/\/*$/, '/plain')
|
|
||||||
: this.nextUrl.replace(/^http/, 'https').replace(/\/*plain$/, '');
|
|
||||||
}
|
|
||||||
if (this.nextUrl.match(/^[:]*:\/\/[^/]*$/)) {
|
|
||||||
this.nextUrl += '/';
|
|
||||||
}
|
|
||||||
if (this.session && this.nextUrl != this.url) {
|
|
||||||
alert('This change will take effect the next time you login.');
|
|
||||||
}
|
|
||||||
};
|
|
||||||
|
|
||||||
ShellInABox.prototype.extendContextMenu = function(entries, actions) {
|
|
||||||
// Modify the entries and actions in place, adding any locally defined
|
|
||||||
// menu entries.
|
|
||||||
var oldActions = [ ];
|
|
||||||
for (var i = 0; i < actions.length; i++) {
|
|
||||||
oldActions[i] = actions[i];
|
|
||||||
}
|
|
||||||
for (var node = entries.firstChild, i = 0, j = 0; node;
|
|
||||||
node = node.nextSibling) {
|
|
||||||
if (node.tagName == 'LI') {
|
|
||||||
actions[i++] = oldActions[j++];
|
|
||||||
if (node.id == "endconfig") {
|
|
||||||
node.id = '';
|
|
||||||
if (typeof serverSupportsSSL != 'undefined' && serverSupportsSSL &&
|
|
||||||
!(typeof disableSSLMenu != 'undefined' && disableSSLMenu)) {
|
|
||||||
// If the server supports both SSL and plain text connections,
|
|
||||||
// provide a menu entry to switch between the two.
|
|
||||||
var newNode = document.createElement('li');
|
|
||||||
var isSecure;
|
|
||||||
if (document.location.hash != '') {
|
|
||||||
isSecure = !this.nextUrl.match(/\?plain$/);
|
|
||||||
} else {
|
|
||||||
isSecure = this.nextUrl.match(/^https:/);
|
|
||||||
}
|
|
||||||
newNode.innerHTML = (isSecure ? '✔ ' : '') + 'Secure';
|
|
||||||
if (node.nextSibling) {
|
|
||||||
entries.insertBefore(newNode, node.nextSibling);
|
|
||||||
} else {
|
|
||||||
entries.appendChild(newNode);
|
|
||||||
}
|
|
||||||
actions[i++] = this.toggleSSL;
|
|
||||||
node = newNode;
|
|
||||||
}
|
|
||||||
node.id = 'endconfig';
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
};
|
|
||||||
|
|
||||||
ShellInABox.prototype.about = function() {
|
|
||||||
alert("Shell In A Box version " + "2.10 (revision 239)" +
|
|
||||||
"\nCopyright 2008-2010 by Markus Gutschke\n" +
|
|
||||||
"For more information check http://shellinabox.com" +
|
|
||||||
(typeof serverSupportsSSL != 'undefined' && serverSupportsSSL ?
|
|
||||||
"\n\n" +
|
|
||||||
"This product includes software developed by the OpenSSL Project\n" +
|
|
||||||
"for use in the OpenSSL Toolkit. (http://www.openssl.org/)\n" +
|
|
||||||
"\n" +
|
|
||||||
"This product includes cryptographic software written by " +
|
|
||||||
"Eric Young\n(eay@cryptsoft.com)" :
|
|
||||||
""));
|
|
||||||
};
|
|
||||||
|
|
|
@ -267,16 +267,16 @@ ShellInABox.prototype.keysPressed = function(ch) {
|
||||||
} else if (c < 0x10000) {
|
} else if (c < 0x10000) {
|
||||||
s += 'E' +
|
s += 'E' +
|
||||||
hex.charAt( (c >> 12) ) +
|
hex.charAt( (c >> 12) ) +
|
||||||
hex.charAt(0x8 + (c >> 10) & 0x3 ) +
|
hex.charAt(0x8 + ((c >> 10) & 0x3)) +
|
||||||
hex.charAt( (c >> 6) & 0xF ) +
|
hex.charAt( (c >> 6) & 0xF ) +
|
||||||
hex.charAt(0x8 + ((c >> 4) & 0x3)) +
|
hex.charAt(0x8 + ((c >> 4) & 0x3)) +
|
||||||
hex.charAt( c & 0xF );
|
hex.charAt( c & 0xF );
|
||||||
} else if (c < 0x110000) {
|
} else if (c < 0x110000) {
|
||||||
s += 'F' +
|
s += 'F' +
|
||||||
hex.charAt( (c >> 18) ) +
|
hex.charAt( (c >> 18) ) +
|
||||||
hex.charAt(0x8 + (c >> 16) & 0x3 ) +
|
hex.charAt(0x8 + ((c >> 16) & 0x3)) +
|
||||||
hex.charAt( (c >> 12) & 0xF ) +
|
hex.charAt( (c >> 12) & 0xF ) +
|
||||||
hex.charAt(0x8 + (c >> 10) & 0x3 ) +
|
hex.charAt(0x8 + ((c >> 10) & 0x3)) +
|
||||||
hex.charAt( (c >> 6) & 0xF ) +
|
hex.charAt( (c >> 6) & 0xF ) +
|
||||||
hex.charAt(0x8 + ((c >> 4) & 0x3)) +
|
hex.charAt(0x8 + ((c >> 4) & 0x3)) +
|
||||||
hex.charAt( c & 0xF );
|
hex.charAt( c & 0xF );
|
||||||
|
|
4449
shellinabox/vt100.js
4449
shellinabox/vt100.js
File diff suppressed because it is too large
Load diff
|
@ -887,7 +887,7 @@ VT100.prototype.initializeElements = function(container) {
|
||||||
'<div class="hidden">' +
|
'<div class="hidden">' +
|
||||||
'<div id="usercss"></div>' +
|
'<div id="usercss"></div>' +
|
||||||
'<pre><div><span id="space"></span></div></pre>' +
|
'<pre><div><span id="space"></span></div></pre>' +
|
||||||
'<input type="textfield" id="input" />' +
|
'<input type="textfield" id="input" autocorrect="off" autocapitalize="off" />' +
|
||||||
'<input type="textfield" id="cliphelper" />' +
|
'<input type="textfield" id="cliphelper" />' +
|
||||||
(typeof suppressAllAudio != 'undefined' &&
|
(typeof suppressAllAudio != 'undefined' &&
|
||||||
suppressAllAudio ? "" :
|
suppressAllAudio ? "" :
|
||||||
|
@ -1106,7 +1106,7 @@ VT100.prototype.repairElements = function(console) {
|
||||||
for (var span = line.firstChild; span; span = span.nextSibling) {
|
for (var span = line.firstChild; span; span = span.nextSibling) {
|
||||||
var newSpan = document.createElement(span.tagName);
|
var newSpan = document.createElement(span.tagName);
|
||||||
newSpan.style.cssText = span.style.cssText;
|
newSpan.style.cssText = span.style.cssText;
|
||||||
newSpan.style.className = span.style.className;
|
newSpan.className = span.className;
|
||||||
this.setTextContent(newSpan, this.getTextContent(span));
|
this.setTextContent(newSpan, this.getTextContent(span));
|
||||||
newLine.appendChild(newSpan);
|
newLine.appendChild(newSpan);
|
||||||
}
|
}
|
||||||
|
@ -1517,7 +1517,7 @@ VT100.prototype.insertBlankLine = function(y, color, style) {
|
||||||
line = document.createElement('div');
|
line = document.createElement('div');
|
||||||
var span = document.createElement('span');
|
var span = document.createElement('span');
|
||||||
span.style.cssText = style;
|
span.style.cssText = style;
|
||||||
span.style.className = color;
|
span.className = color;
|
||||||
this.setTextContent(span, this.spaces(this.terminalWidth));
|
this.setTextContent(span, this.spaces(this.terminalWidth));
|
||||||
line.appendChild(span);
|
line.appendChild(span);
|
||||||
}
|
}
|
||||||
|
@ -2321,6 +2321,13 @@ VT100.prototype.pasteFnc = function() {
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
|
VT100.prototype.pasteBrowserFnc = function() {
|
||||||
|
var clipboard = prompt("Paste into this box:","");
|
||||||
|
if (clipboard != undefined) {
|
||||||
|
return this.keysPressed('' + clipboard);
|
||||||
|
}
|
||||||
|
};
|
||||||
|
|
||||||
VT100.prototype.toggleUTF = function() {
|
VT100.prototype.toggleUTF = function() {
|
||||||
this.utfEnabled = !this.utfEnabled;
|
this.utfEnabled = !this.utfEnabled;
|
||||||
|
|
||||||
|
@ -2426,6 +2433,7 @@ VT100.prototype.showContextMenu = function(x, y) {
|
||||||
'<ul id="menuentries">' +
|
'<ul id="menuentries">' +
|
||||||
'<li id="beginclipboard">Copy</li>' +
|
'<li id="beginclipboard">Copy</li>' +
|
||||||
'<li id="endclipboard">Paste</li>' +
|
'<li id="endclipboard">Paste</li>' +
|
||||||
|
'<li id="browserclipboard">Paste from browser</li>' +
|
||||||
'<hr />' +
|
'<hr />' +
|
||||||
'<li id="reset">Reset</li>' +
|
'<li id="reset">Reset</li>' +
|
||||||
'<hr />' +
|
'<hr />' +
|
||||||
|
@ -2467,7 +2475,7 @@ VT100.prototype.showContextMenu = function(x, y) {
|
||||||
}
|
}
|
||||||
|
|
||||||
// Actions for default items
|
// Actions for default items
|
||||||
var actions = [ this.copyLast, p, this.reset,
|
var actions = [ this.copyLast, p, this.pasteBrowserFnc, this.reset,
|
||||||
this.toggleUTF, this.toggleBell,
|
this.toggleUTF, this.toggleBell,
|
||||||
this.toggleSoftKeyboard,
|
this.toggleSoftKeyboard,
|
||||||
this.toggleCursorBlinking ];
|
this.toggleCursorBlinking ];
|
||||||
|
@ -2711,10 +2719,14 @@ VT100.prototype.handleKey = function(event) {
|
||||||
case 189: /* - */ ch = this.applyModifiers(45, event); break;
|
case 189: /* - */ ch = this.applyModifiers(45, event); break;
|
||||||
case 190: /* . */ ch = this.applyModifiers(46, event); break;
|
case 190: /* . */ ch = this.applyModifiers(46, event); break;
|
||||||
case 191: /* / */ ch = this.applyModifiers(47, event); break;
|
case 191: /* / */ ch = this.applyModifiers(47, event); break;
|
||||||
case 192: /* ` */ ch = this.applyModifiers(96, event); break;
|
// Conflicts with dead key " on Swiss keyboards
|
||||||
case 219: /* [ */ ch = this.applyModifiers(91, event); break;
|
//case 192: /* ` */ ch = this.applyModifiers(96, event); break;
|
||||||
|
// Conflicts with dead key " on Swiss keyboards
|
||||||
|
//case 219: /* [ */ ch = this.applyModifiers(91, event); break;
|
||||||
case 220: /* \ */ ch = this.applyModifiers(92, event); break;
|
case 220: /* \ */ ch = this.applyModifiers(92, event); break;
|
||||||
case 221: /* ] */ ch = this.applyModifiers(93, event); break;
|
// Conflicts with dead key ^ and ` on Swiss keaboards
|
||||||
|
// ^ and " on French keyboards
|
||||||
|
//case 221: /* ] */ ch = this.applyModifiers(93, event); break;
|
||||||
case 222: /* ' */ ch = this.applyModifiers(39, event); break;
|
case 222: /* ' */ ch = this.applyModifiers(39, event); break;
|
||||||
default: return;
|
default: return;
|
||||||
}
|
}
|
||||||
|
@ -2884,21 +2896,36 @@ VT100.prototype.keyDown = function(event) {
|
||||||
this.lastKeyDownEvent = undefined;
|
this.lastKeyDownEvent = undefined;
|
||||||
this.lastNormalKeyDownEvent = event;
|
this.lastNormalKeyDownEvent = event;
|
||||||
|
|
||||||
|
// Swiss keyboard conflicts:
|
||||||
|
// [ 59
|
||||||
|
// ] 192
|
||||||
|
// ' 219 (dead key)
|
||||||
|
// { 220
|
||||||
|
// ~ 221 (dead key)
|
||||||
|
// } 223
|
||||||
|
// French keyoard conflicts:
|
||||||
|
// ~ 50 (dead key)
|
||||||
|
// } 107
|
||||||
var asciiKey =
|
var asciiKey =
|
||||||
event.keyCode == 32 ||
|
event.keyCode == 32 ||
|
||||||
event.keyCode >= 48 && event.keyCode <= 57 ||
|
event.keyCode >= 48 && event.keyCode <= 57 ||
|
||||||
event.keyCode >= 65 && event.keyCode <= 90;
|
event.keyCode >= 65 && event.keyCode <= 90;
|
||||||
var alphNumKey =
|
var alphNumKey =
|
||||||
asciiKey ||
|
asciiKey ||
|
||||||
|
event.keyCode == 59 ||
|
||||||
event.keyCode >= 96 && event.keyCode <= 105 ||
|
event.keyCode >= 96 && event.keyCode <= 105 ||
|
||||||
|
event.keyCode == 107 ||
|
||||||
|
event.keyCode == 192 ||
|
||||||
|
event.keyCode >= 219 && event.keyCode <= 221 ||
|
||||||
|
event.keyCode == 223 ||
|
||||||
event.keyCode == 226;
|
event.keyCode == 226;
|
||||||
var normalKey =
|
var normalKey =
|
||||||
alphNumKey ||
|
alphNumKey ||
|
||||||
event.keyCode == 59 || event.keyCode == 61 ||
|
event.keyCode == 61 ||
|
||||||
event.keyCode == 106 || event.keyCode == 107 ||
|
event.keyCode == 106 ||
|
||||||
event.keyCode >= 109 && event.keyCode <= 111 ||
|
event.keyCode >= 109 && event.keyCode <= 111 ||
|
||||||
event.keyCode >= 186 && event.keyCode <= 192 ||
|
event.keyCode >= 186 && event.keyCode <= 191 ||
|
||||||
event.keyCode >= 219 && event.keyCode <= 223 ||
|
event.keyCode == 222 ||
|
||||||
event.keyCode == 252;
|
event.keyCode == 252;
|
||||||
try {
|
try {
|
||||||
if (navigator.appName == 'Konqueror') {
|
if (navigator.appName == 'Konqueror') {
|
||||||
|
@ -3026,10 +3053,14 @@ VT100.prototype.keyUp = function(event) {
|
||||||
this.catchModifiersEarly = true;
|
this.catchModifiersEarly = true;
|
||||||
var asciiKey =
|
var asciiKey =
|
||||||
event.keyCode == 32 ||
|
event.keyCode == 32 ||
|
||||||
event.keyCode >= 48 && event.keyCode <= 57 ||
|
// Conflicts with dead key ~ (code 50) on French keyboards
|
||||||
|
//event.keyCode >= 48 && event.keyCode <= 57 ||
|
||||||
|
event.keyCode >= 48 && event.keyCode <= 49 ||
|
||||||
|
event.keyCode >= 51 && event.keyCode <= 57 ||
|
||||||
event.keyCode >= 65 && event.keyCode <= 90;
|
event.keyCode >= 65 && event.keyCode <= 90;
|
||||||
var alphNumKey =
|
var alphNumKey =
|
||||||
asciiKey ||
|
asciiKey ||
|
||||||
|
event.keyCode == 50 ||
|
||||||
event.keyCode >= 96 && event.keyCode <= 105;
|
event.keyCode >= 96 && event.keyCode <= 105;
|
||||||
var normalKey =
|
var normalKey =
|
||||||
alphNumKey ||
|
alphNumKey ||
|
||||||
|
|
Loading…
Reference in a new issue