fix(console) F10 -> TRA

This commit is contained in:
coderaiser 2013-06-25 10:47:10 +00:00
parent a444b009c2
commit ff3bed82b8
2 changed files with 20 additions and 40 deletions

View file

@ -48,8 +48,10 @@ var CloudCmd, Util, DOM, $;
// Handle a command.
var handler = function(command) {
if (command)
if (command) {
Images.showLoad({ top:true });
CloudCmd.Socket.send(command);
}
jqconsole.Prompt(true, handler);
};
@ -89,14 +91,15 @@ var CloudCmd, Util, DOM, $;
}
function listener(pEvent){
var lF10 = Key.F10,
var lTRA = Key.TRA,
lESC = Key.ESC,
lIsBind = Key.isBind(),
lKey = pEvent.keyCode;
switch(lKey){
case lF10:
Console.show();
case lTRA:
if (lIsBind)
Console.show();
break;
case lESC:
Console.hide();

View file

@ -10,10 +10,6 @@ var CloudCmd, Util, DOM, jqconsole, io;
ERROR_MSG = 'could not connect to socket.io\n'+
'npm i socket.io';
function getTerminal(){
return CloudCmd.Terminal.JqueryTerminal;
}
DOM.jsload('/socket.io/lib/socket.io.js', {
onerror : Util.retExec(Util.log, ERROR_MSG),
@ -23,13 +19,7 @@ var CloudCmd, Util, DOM, jqconsole, io;
CloudCmd.Socket = socket;
socket.on('connect', function () {
Terminal = getTerminal();
if(Terminal){
outToTerminal({stdout: 'socket connected'});
Terminal.Term.resume();
}
outToTerminal({stdout: 'socket connected'});
});
socket.on('message', function (msg) {
@ -40,38 +30,25 @@ var CloudCmd, Util, DOM, jqconsole, io;
});
socket.on('disconnect', function () {
Terminal = getTerminal();
if(Terminal){
outToTerminal({stderr: 'socket disconected'});
Terminal.Term.pause();
}
outToTerminal({stderr: 'socket disconected'});
});
}
});
function outToTerminal(pMsg){
var lResult, lTerm;
var lResult, lTerm, lStdout, lStderr;
Terminal = getTerminal();
if(Terminal)
lTerm = Terminal.Term;
else {
var lEcho = function(pResult){
CloudCmd.Console.jqconsole.Write(pResult);
};
lTerm = {
echo : lEcho,
error : lEcho
};
}
var lEcho = function(pResult){
CloudCmd.Console.jqconsole.Write(pResult + '\n');
DOM.Images.hideLoad();
};
if(lTerm){
var lStdout,
lStderr;
lTerm = {
echo : lEcho,
error : lEcho
};
if(CloudCmd.Console.jqconsole){
if(Messages.length){
/* show oll msg from buffer */
for(var i = 0, n = Messages.length; i < n; i++){