improved modules.json format and parsing

This commit is contained in:
coderaiser 2013-01-17 08:02:16 -05:00
parent 0e55523c0b
commit 49b6f672e7
3 changed files with 51 additions and 21 deletions

View file

@ -85,6 +85,8 @@ clicked on menu item.
* Updated jquery to v1.9.0.
* Improved modules.json format and parsing.
2012.12.12, Version 0.1.8

View file

@ -239,7 +239,9 @@ function initModules(pCallBack){
});
CloudCmd.getModules(function(pModules){
var lStorage = 'storage/',
pModules = pModules || [];
var lStorage = 'storage',
lShowLoadFunc = Util.retFunc( DOM.Images.showLoad ),
lDisableMenuFunc = function(){
var lFunc = document.oncontextmenu;
@ -255,24 +257,36 @@ function initModules(pCallBack){
'viewer' : lShowLoadFunc
},
lNames = {};
lNames[lStorage + '_dropbox'] = 'DropBox',
lNames[lStorage + '_github' ] = 'GitHub',
lNames[lStorage + '_gdrive' ] = 'GDrive',
lNames[lStorage + '_vk' ] = 'VK',
lLoad = function(pName, pPath, pDoBefore){
loadModule({
path : pPath,
name : pName,
dobefore : pDoBefore
});
};
lDisableMenuFunc();
if( Util.isArray(pModules) )
for(var i = 0, n = pModules.length; i < n ; i++){
var lModule = pModules[i];
loadModule({
path : lModule,
dobefore : lDoBefore[lModule],
name : lNames[lModule]
});
for(var i = 0, n = pModules.length; i < n ; i++){
var lModule = pModules[i];
if(Util.isObject(lModule)){
for(var lProp in lModule)
if(lProp === lStorage){
var m = lModule[lProp].length,
lMod = lModule[lProp];
for(var j = 0; j < m; j++)
lLoad(lMod[j].name, lStorage + '/' + lMod[j].path);
break;
}
}
else
lLoad(null, lModule, lDoBefore[lModule]);
}
Util.exec(pCallBack);
});

View file

@ -2,10 +2,24 @@
"editor/_codemirror",
"menu",
"viewer",
"storage/_github",
"storage/_dropbox",
"storage/_dropbox_chooser",
"storage/_gdrive",
"storage/_vk",
"terminal"
"terminal",{
"storage":[
{
"name":"DropBox",
"path":"_dropbox"
},
{
"name":"GitHub",
"path":"_github"
},
{
"name":"GDrive",
"path":"_gdrive"
},
{
"name":"VK",
"path":"_vk"
}
]
}
]