mirror of
https://github.com/coderaiser/cloudcmd.git
synced 2026-01-23 18:55:26 +00:00
rewrited with method anyLoadOnload
This commit is contained in:
parent
4e41cdea20
commit
5302f7962c
2 changed files with 30 additions and 36 deletions
|
|
@ -103,25 +103,17 @@ var CloudCommander, $;
|
|||
* @param pPosition - position of menu
|
||||
*/
|
||||
function load(){
|
||||
var ljsLoad_f = function(){
|
||||
var lUISrc = Menu.dir + 'ui.position.js';
|
||||
var lMenuSrc = Menu.dir + 'contextMenu.js';
|
||||
|
||||
Util.jsload(lUISrc, function(){
|
||||
Util.jsload(lMenuSrc, Menu.show());
|
||||
console.time('menu load');
|
||||
|
||||
var lDir = Menu.dir;
|
||||
|
||||
Util.anyLoadOnload([
|
||||
lDir + 'contextMenu.js',
|
||||
lDir + 'contextMenu.css'],
|
||||
function(){
|
||||
console.timeEnd('menu load');
|
||||
Menu.show();
|
||||
});
|
||||
};
|
||||
|
||||
var lSrc = Menu.dir + 'contextMenu.css';
|
||||
|
||||
Util.cssLoad({
|
||||
src : lSrc,
|
||||
func : {
|
||||
onload: function(){
|
||||
Util.jqueryLoad(ljsLoad_f);
|
||||
}
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
function set(){
|
||||
|
|
@ -193,16 +185,14 @@ var CloudCommander, $;
|
|||
* right away after loading
|
||||
*/
|
||||
Menu.show = function(){
|
||||
return function(){
|
||||
set();
|
||||
|
||||
Util.Images.hideLoad();
|
||||
|
||||
if(Position && Position.x && Position.y)
|
||||
$('li').contextMenu(Position);
|
||||
else
|
||||
$('li').contextMenu();
|
||||
};
|
||||
set();
|
||||
|
||||
Util.Images.hideLoad();
|
||||
|
||||
if(Position && Position.x && Position.y)
|
||||
$('li').contextMenu(Position);
|
||||
else
|
||||
$('li').contextMenu();
|
||||
};
|
||||
|
||||
/* key binding function */
|
||||
|
|
@ -246,11 +236,11 @@ var CloudCommander, $;
|
|||
key_event();
|
||||
};
|
||||
|
||||
/* showing context menu preview*/
|
||||
Menu.show();
|
||||
/* showing context menu preview*/
|
||||
Menu.show();
|
||||
}
|
||||
|
||||
load();
|
||||
Util.jqueryLoad( load );
|
||||
};
|
||||
|
||||
cloudcmd.Menu = Menu;
|
||||
|
|
|
|||
|
|
@ -22,9 +22,11 @@ var CloudCommander, io;
|
|||
socket.on('connect', function () {
|
||||
JqueryTerminal = getJqueryTerminal();
|
||||
|
||||
outToTerminal({stdout: 'socket connected'});
|
||||
if(JqueryTerminal){
|
||||
outToTerminal({stdout: 'socket connected'});
|
||||
|
||||
JqueryTerminal.Term.resume();
|
||||
JqueryTerminal.Term.resume();
|
||||
}
|
||||
});
|
||||
|
||||
socket.on('message', function (msg) {
|
||||
|
|
@ -37,9 +39,11 @@ var CloudCommander, io;
|
|||
socket.on('disconnect', function () {
|
||||
JqueryTerminal = getJqueryTerminal();
|
||||
|
||||
outToTerminal({stderr: 'socket disconected'});
|
||||
|
||||
JqueryTerminal.Term.pause();
|
||||
if(JqueryTerminal){
|
||||
outToTerminal({stderr: 'socket disconected'});
|
||||
|
||||
JqueryTerminal.Term.pause();
|
||||
}
|
||||
});
|
||||
},
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue