mirror of
https://github.com/coderaiser/cloudcmd.git
synced 2026-01-23 18:55:26 +00:00
refactor(menu) show
This commit is contained in:
parent
d14730b4da
commit
ec95aad451
1 changed files with 25 additions and 7 deletions
|
|
@ -21,11 +21,7 @@ var CloudCmd, Util, DOM, CloudFunc, MenuIO;
|
|||
|
||||
function init() {
|
||||
Loading = true;
|
||||
|
||||
Util.exec.series([
|
||||
DOM.loadMenu,
|
||||
Menu.show
|
||||
]);
|
||||
Menu.show();
|
||||
|
||||
Events.addKey(listener);
|
||||
}
|
||||
|
|
@ -35,7 +31,29 @@ var CloudCmd, Util, DOM, CloudFunc, MenuIO;
|
|||
MenuContextFile.hide();
|
||||
};
|
||||
|
||||
this.show = function(x, y ) {
|
||||
this.show = function(position) {
|
||||
var x, y,
|
||||
showFunc;
|
||||
|
||||
if (position) {
|
||||
x = position.x;
|
||||
y = position.y;
|
||||
}
|
||||
|
||||
showFunc = Util.exec.with(show, x, y);
|
||||
|
||||
Util.exec.if(MenuIO, showFunc, function() {
|
||||
DOM.loadMenu(function(error) {
|
||||
|
||||
if (error)
|
||||
DOM.Dialog.alert(error);
|
||||
else
|
||||
showFunc();
|
||||
});
|
||||
});
|
||||
};
|
||||
|
||||
function show(x, y) {
|
||||
if (!x || !y) {
|
||||
x = (position || Position).x;
|
||||
y = (position || Position).y;
|
||||
|
|
@ -71,7 +89,7 @@ var CloudCmd, Util, DOM, CloudFunc, MenuIO;
|
|||
position = null;
|
||||
});
|
||||
}
|
||||
};
|
||||
}
|
||||
|
||||
function getOptions(notFile) {
|
||||
var name, func, options;
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue