added function socketLoad

This commit is contained in:
coderaiser 2012-10-20 14:42:22 -04:00
parent a942ace3eb
commit 8cbae8c640
3 changed files with 22 additions and 3 deletions

View file

@ -510,6 +510,10 @@ CloudClient.Util = (function(){
}
});
};
this.socketLoad = function(){
Util.jsload('lib/client/socket.js');
};
this.getByTag = function(pTag, pElement){
return (pElement || document).getElementsByTagName(pTag);
@ -1207,6 +1211,9 @@ CloudClient.init = (function(){
getByClass = Util.getByClass;
getById = Util.getById;
Util.socketLoad();
if(!document.body.scrollIntoViewIfNeeded){
this.OLD_BROWSER = true;
Util.jsload(CloudClient.LIBDIRCLIENT + 'ie.js',

View file

@ -7,8 +7,12 @@ var CloudCommander, io;
Util = cloudcmd.Util,
Messages = [],
socket,
JqueryTerminal = cloudcmd.Terminal.JqueryTerminal;
JqueryTerminal;
function getJqueryTerminal(){
return cloudcmd.Terminal.JqueryTerminal;
}
Util.jsload('/socket.io/lib/socket.io.js', {
onload : function(){
socket = io.connect(document.location.hostname);
@ -16,6 +20,8 @@ var CloudCommander, io;
cloudcmd.Socket = socket;
socket.on('connect', function () {
JqueryTerminal = getJqueryTerminal();
outToTerminal({stdout: 'socket connected'});
JqueryTerminal.Term.resume();
@ -29,6 +35,8 @@ var CloudCommander, io;
});
socket.on('disconnect', function () {
JqueryTerminal = getJqueryTerminal();
outToTerminal({stderr: 'socket disconected'});
JqueryTerminal.Term.pause();
@ -42,9 +50,13 @@ var CloudCommander, io;
});
function outToTerminal(pMsg){
var lTerm = JqueryTerminal.Term,
var lTerm,
lResult = true;
JqueryTerminal = getJqueryTerminal();
if(JqueryTerminal)
lTerm = JqueryTerminal.Term;
if(lTerm){
var lStdout,
lStderr;

View file

@ -28,7 +28,7 @@ var CloudCommander, $;
Util.cssLoad(lDir + 'terminal.css');
Util.jsload('lib/client/socket.js');
Util.socketLoad();
Util.anyLoadOnload([