Update lib/client/menu.js

This commit is contained in:
coderaiser 2012-08-24 18:14:00 +03:00
parent 0174817be5
commit 07d7df6461

View file

@ -14,9 +14,24 @@ var CloudCommander, $;
/* enable and disable menu constant */
CloudCommander.Menu.ENABLED = false;
/* function return configureation
* for menu
*/
CloudCommander.Menu.showEditor = (function(pReadOnly){
Util.Images.showLoad();
var lCloudcmd = CloudCommander;
var lEditor = pReadOnly ? lCloudcmd.Viewer:lCloudcmd.Editor;
var lCurrent = Util.getCurrentFile();
if(lCurrent){
if(typeof lEditor === 'function')
lEditor(lCurrent);
else{
lEditor = lEditor.get();
if(lEditor && lEditor.show)
lEditor.show(lCurrent);
}
}
});
/* function return configureation for menu */
CloudCommander.Menu.getConfig = (function(){
return{
// define which elements trigger this menu
@ -30,32 +45,12 @@ var CloudCommander, $;
},
// define the elements of the menu
items: {
view: {name: 'View', callback: function(key, opt){
var lCurrent = Util.getCurrentFile();
if(lCurrent){
if(typeof CloudCommander.Viewer === 'function')
CloudCommander.Viewer(lCurrent);
else{
var lViewer = CloudCommander.Viewer.get();
if(lViewer && lViewer.show)
lViewer.show(lCurrent);
}
view: {name: 'View', callback: function(key, opt){
CloudCommander.showEditor(true);
}},
edit: {name: 'Edit', callback: function(key, opt){
Util.Images.showLoad();
if(typeof CloudCommander.Editor === 'function')
CloudCommander.Editor();
else{
var lEditor = CloudCommander.Editor.get();
if(lEditor && lEditor.show){
var lCurrent = Util.getCurrentFile();
if(lCurrent)
lEditor.show(lCurrent);
}
}
CloudCommander.showEditor(false);
}},
'delete': {name: 'Delete',
@ -90,11 +85,10 @@ var CloudCommander, $;
document.body.removeChild(lDownload);
}, 10000);
}
else{
else
Util.Images.showError({
responseText: 'Error: You trying to' +
'download same file to often'});
}
}}
}
};