mirror of
https://github.com/coderaiser/cloudcmd.git
synced 2026-01-23 18:55:26 +00:00
refactored
This commit is contained in:
parent
9ed41613ff
commit
5fcd84c559
1 changed files with 14 additions and 26 deletions
|
|
@ -109,25 +109,15 @@ var CloudCommander, Util, DOM, $;
|
|||
* pItems = [{pName, pFunc}]
|
||||
*/
|
||||
function getAllItems(pItems){
|
||||
var lRet = {};
|
||||
var lRet = {},
|
||||
lName,
|
||||
lFunc;
|
||||
|
||||
if( Util.isArray(pItems) ){
|
||||
var lName,
|
||||
lFunc,
|
||||
i, n = pItems.length;
|
||||
for(i = 0; i < n; i++){
|
||||
var lItem = pItems[i];
|
||||
if(lItem){
|
||||
lName = lItem.name;
|
||||
|
||||
for(var lProp in lItem){
|
||||
lName = lProp;
|
||||
lFunc = lItem[lProp];
|
||||
}
|
||||
lRet[lName] = getItem(lName, lFunc);
|
||||
}
|
||||
if(pItems)
|
||||
for(lName in pItems){
|
||||
lFunc = pItems[lName];
|
||||
lRet[lName] = getItem(lName, lFunc);
|
||||
}
|
||||
}
|
||||
|
||||
return lRet;
|
||||
}
|
||||
|
|
@ -148,13 +138,12 @@ var CloudCommander, Util, DOM, $;
|
|||
},
|
||||
|
||||
// define the elements of the menu
|
||||
items: getAllItems([
|
||||
{ 'View' : Util.retExec(showEditor, true) },
|
||||
{ 'Edit' : Util.retExec(showEditor) },
|
||||
{ 'Delete' : Util.retExec(DOM.promptRemoveCurrent) },
|
||||
{ 'Upload to' : getUploadToItem( ['GitHub', 'GDrive', 'DropBox'] ) },
|
||||
{
|
||||
'Download' : function(key, opt){
|
||||
items: getAllItems({
|
||||
'View' : Util.retExec(showEditor, true),
|
||||
'Edit' : Util.retExec(showEditor),
|
||||
'Delete' : Util.retExec(DOM.promptRemoveCurrent),
|
||||
'Upload to' : getUploadToItem( ['GitHub', 'GDrive', 'DropBox'] ),
|
||||
'Download' : function(key, opt){
|
||||
DOM.Images.showLoad();
|
||||
|
||||
var lPath = DOM.getCurrentPath(),
|
||||
|
|
@ -183,8 +172,7 @@ var CloudCommander, Util, DOM, $;
|
|||
responseText: 'Error: You trying to' +
|
||||
'download same file to often'});
|
||||
}
|
||||
}
|
||||
])
|
||||
})
|
||||
};
|
||||
}
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue