From d30b4f7742db859f8b7e4fd84526fff0a1d9afff Mon Sep 17 00:00:00 2001 From: coderaiser Date: Tue, 4 Dec 2012 09:27:28 -0500 Subject: [PATCH] minor changes --- cloudcmd.js | 1 - lib/client.js | 16 ++++++++++------ lib/client/keyBinding.js | 4 ++-- lib/client/storage/_dropbox.js | 6 +++--- lib/client/storage/_github.js | 11 ++++++----- 5 files changed, 21 insertions(+), 17 deletions(-) diff --git a/cloudcmd.js b/cloudcmd.js index efe5ab2f..9f6f4ad3 100644 --- a/cloudcmd.js +++ b/cloudcmd.js @@ -33,7 +33,6 @@ /** * additional processing of index file - * */ function indexProcessing(pData){ var lReplace_s, diff --git a/lib/client.js b/lib/client.js index e9f56c6b..c5baf5fe 100644 --- a/lib/client.js +++ b/lib/client.js @@ -333,7 +333,6 @@ CloudClient.init = function(){ }; function initModules(pCallBack){ - loadModule({ /* привязываем клавиши к функциям */ path : 'keyBinding.js', @@ -346,7 +345,8 @@ function initModules(pCallBack){ DOM.ajax({ url:'/modules.json', success: function(pModules){ - var lShowLoadFunc = Util.retFunc( DOM.Images.showLoad ), + var lStorage = 'storage/', + lShowLoadFunc = Util.retFunc( DOM.Images.showLoad ), lDisableMenuFunc = function(){ var lFunc = document.oncontextmenu; document.oncontextmenu = function(){ @@ -359,8 +359,11 @@ function initModules(pCallBack){ 'editor/_codemirror' : lShowLoadFunc, 'menu' : lDisableMenuFunc, 'viewer' : lShowLoadFunc - }; - + }, + + lNames = {}; + lNames[lStorage + '_dropbox'] = 'DropBox', + lNames[lStorage + '_github' ] = 'GitHub', lDisableMenuFunc(); @@ -369,8 +372,9 @@ function initModules(pCallBack){ var lModule = pModules[i]; loadModule({ - path: lModule, - dobefore: lDoBefore[lModule] + path : lModule, + dobefore : lDoBefore[lModule], + name : lNames[lModule] }); } diff --git a/lib/client/keyBinding.js b/lib/client/keyBinding.js index caddda62..ec5f48e0 100644 --- a/lib/client/keyBinding.js +++ b/lib/client/keyBinding.js @@ -79,10 +79,10 @@ var CloudCommander, Util, DOM; } else if(lKeyCode === KEY.G && event.altKey) - Util.exec(cloudcmd.Storage); + Util.exec(cloudcmd.GitHub); else if(lKeyCode === KEY.D && event.altKey){ - Util.exec(cloudcmd.Storage); + Util.exec(cloudcmd.DropBox); event.preventDefault(); } diff --git a/lib/client/storage/_dropbox.js b/lib/client/storage/_dropbox.js index 14e6d3b4..409c383c 100644 --- a/lib/client/storage/_dropbox.js +++ b/lib/client/storage/_dropbox.js @@ -7,7 +7,6 @@ var CloudCommander, Util, DOM, Dropbox; const cloudcmd = CloudCommander; var CLIENT_ID, - Storage = cloudcmd.Storage, DropBoxStore = {}, options = { linkType: "direct", @@ -43,9 +42,10 @@ var CloudCommander, Util, DOM, Dropbox; Dropbox.choose(options); }; - Storage.init = function(){ + DropBoxStore.init = function(){ load(); + this.init = null; }; - Storage.DropBoxStore = DropBoxStore; + cloudcmd.DropBox = DropBoxStore; })(); diff --git a/lib/client/storage/_github.js b/lib/client/storage/_github.js index a738c161..2972f1c7 100644 --- a/lib/client/storage/_github.js +++ b/lib/client/storage/_github.js @@ -14,7 +14,6 @@ var CloudCommander, Util, DOM, $, Github, cb; var GitHub_ID, GithubLocal, User, - Storage = cloudcmd.Storage = {}, GithubStore = {}; /* temporary callback function for work with github */ @@ -65,7 +64,7 @@ var CloudCommander, Util, DOM, $, Github, cb; /* PUBLICK FUNCTIONS */ GithubStore.basicLogin = function(pUser, pPasswd){ - cloudcmd.Storage.Github = GithubLocal = new Github({ + GithubLocal = new Github({ username: pUser, password: pPasswd, auth : 'basic' @@ -73,7 +72,7 @@ var CloudCommander, Util, DOM, $, Github, cb; }; GithubStore.Login = function(pToken){ - cloudcmd.Storage.Github = Github = GithubLocal = new Github({ + Github = GithubLocal = new Github({ token : pToken, auth : 'oauth' }); @@ -159,14 +158,16 @@ var CloudCommander, Util, DOM, $, Github, cb; User.show(null, lShowUserInfo); } - Storage.init = function(){ + cloudcmd.GitHub.init = function(){ Util.loadOnLoad([ getUserData, init, setConfig, load ]); + + this.init = null; }; - Storage.GithubStore = GithubStore; + cloudcmd.Github = GithubStore; })();