From aea3d8d9ffa4018cf6995d53caf62631d6a636a2 Mon Sep 17 00:00:00 2001 From: coderaiser Date: Thu, 25 Oct 2012 09:20:48 -0400 Subject: [PATCH] modules moved to modules.json --- client.js | 60 ++++++++++++++++++---------------------- lib/client/keyBinding.js | 2 +- modules.json | 8 ++++++ 3 files changed, 36 insertions(+), 34 deletions(-) create mode 100644 modules.json diff --git a/client.js b/client.js index a5b79f64..0941ec14 100644 --- a/client.js +++ b/client.js @@ -106,30 +106,6 @@ var loadModule = function(pParams){ }; }; -var Modules = [{ - path : 'keyBinding.js', - func : function(){ - KeyBinding = cloudcmd.KeyBinding; - KeyBinding.init(); - } - }, - 'editor/_codemirror', - 'viewer', - 'storage/_github', - 'terminal', - 'menu', - { - path : 'config', - dobefore : function(){ - Util.Images.showLoad({top: true}); - } - } -]; - - - - - /* * Обьект для работы с кэшем * в него будут включены функции для @@ -1267,10 +1243,34 @@ CloudClient.init = function(){ this.OLD_BROWSER = true; Util.jsload(CloudClient.LIBDIRCLIENT + 'ie.js', function(){ - Util.jqueryLoad(CloudClient.baseInit); + Util.jqueryLoad( CloudClient.initModules ); }); } - else CloudClient.baseInit(); + else CloudClient.initModules(); +}; + +CloudClient.initModules = function(){ + + loadModule({ + path : 'keyBinding.js', + func : function(){ + KeyBinding = cloudcmd.KeyBinding; + KeyBinding.init(); + } + }); + + Util.ajax({ + url:'/modules.json', + success: function(pModules){ + if( Util.isArray(pModules) ) + for(var i = 0, n = pModules.length; i < n ; i++) + loadModule(pModules[i]); + + CloudClient.baseInit(); + }, + + error: CloudClient.baseInit + }); }; CloudClient.baseInit = function(){ @@ -1340,13 +1340,7 @@ CloudClient.baseInit = function(){ '.panel{' + 'height:' + lHeight +'px;' + '}' - }); - - - for(var i = 0, n = Modules.length; i < n ; i++){ - loadModule(Modules[i]); - } - + }); }; /* функция меняет ссыки на ajax-овые */ diff --git a/lib/client/keyBinding.js b/lib/client/keyBinding.js index f863869e..7917ec73 100644 --- a/lib/client/keyBinding.js +++ b/lib/client/keyBinding.js @@ -74,7 +74,7 @@ var CloudCommander; if(lKeyCode === KEY.O && event.altKey){ console.log('openning config window...'); - Util.Images.showLoad(); + Util.Images.showLoad({top: true}); if ( Util.isFunction(cloudcmd.Config) ) cloudcmd.Config(); diff --git a/modules.json b/modules.json new file mode 100644 index 00000000..f3b987cc --- /dev/null +++ b/modules.json @@ -0,0 +1,8 @@ +[ + "editor/_codemirror", + "viewer", + "storage/_github", + "terminal", + "menu", + "config" +] \ No newline at end of file