mirror of
https://github.com/coderaiser/cloudcmd.git
synced 2026-07-25 17:04:16 +00:00
refactored
This commit is contained in:
parent
a537c56e46
commit
ebeffdc16e
8 changed files with 133 additions and 79 deletions
|
|
@ -40,17 +40,8 @@ var CloudCommander, Util, DOM, $;
|
|||
*/
|
||||
function setUploadToItemNames(pCallBack){
|
||||
CloudCmd.getModules(function(pModules){
|
||||
var lStorage = 'storage',
|
||||
lItems = pModules[lStorage];
|
||||
|
||||
for(var i = 0, n = pModules.length; i < n; i++ ){
|
||||
lItems = pModules[i][lStorage];
|
||||
|
||||
if(lItems)
|
||||
break;
|
||||
}
|
||||
|
||||
UploadToItemNames = lItems || [];
|
||||
var lStorageObj = Util.findObjByNameInArr( pModules, 'storage' );
|
||||
UploadToItemNames = Util.getNamesFromObjArray( lStorageObj.data ) || [];
|
||||
|
||||
Util.exec(pCallBack);
|
||||
});
|
||||
|
|
|
|||
|
|
@ -49,9 +49,13 @@ var CloudCommander, Util, DOM, Dropbox, cb, Client;
|
|||
* @param pData = {key, secret}
|
||||
*/
|
||||
DropBoxStore.login = function(pCallBack){
|
||||
CloudCmd.getConfig(function(pConfig){
|
||||
CloudCmd.getModules(function(pModules){
|
||||
var lStorage = Util.findObjByNameInArr(pModules, 'storage'),
|
||||
lDropBox = Util.findObjByNameInArr(lStorage.data, 'DropBox'),
|
||||
lDropBoxKey = lDropBox && lDropBox.data.encodedKey;
|
||||
|
||||
Client = new Dropbox.Client({
|
||||
key: pConfig.dropbox_encoded_key
|
||||
key: lDropBoxKey
|
||||
});
|
||||
|
||||
//Client.authDriver(new Dropbox.Drivers.Redirect({rememberUser: true}));
|
||||
|
|
|
|||
|
|
@ -5,9 +5,6 @@ var CloudCommander, Util, DOM, $, Github, cb;
|
|||
"use strict";
|
||||
|
||||
var Cache = DOM.Cache,
|
||||
|
||||
APIURL,
|
||||
AuthURL,
|
||||
GithubLocal,
|
||||
User,
|
||||
GitHubStore = {};
|
||||
|
|
@ -73,19 +70,15 @@ var CloudCommander, Util, DOM, $, Github, cb;
|
|||
}
|
||||
};
|
||||
|
||||
GitHubStore.getUserData = function(pCallBack){
|
||||
var lName,
|
||||
|
||||
lShowUserInfo = function(pError, pData){
|
||||
if(!pError){
|
||||
lName = pData.name;
|
||||
Util.log('Hello ' + lName + ' :)!');
|
||||
}
|
||||
else
|
||||
DOM.Cache.remove('token');
|
||||
};
|
||||
|
||||
User.show(null, lShowUserInfo);
|
||||
GitHubStore.getUserData = function(pCallBack){
|
||||
User.show(null, function(pError, pData){
|
||||
if(!pError){
|
||||
var lName = pData.name;
|
||||
Util.log('Hello ' + lName + ' :)!');
|
||||
}
|
||||
else
|
||||
DOM.Cache.remove('token');
|
||||
});
|
||||
|
||||
Util.exec(pCallBack);
|
||||
};
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue