mirror of
https://github.com/coderaiser/cloudcmd.git
synced 2026-01-23 10:45:47 +00:00
refactored
This commit is contained in:
parent
6cd646854c
commit
7c5b85c1d4
7 changed files with 40 additions and 27 deletions
|
|
@ -3,7 +3,7 @@
|
|||
"appcache" : false,
|
||||
"cache" : {"allowed" : false},
|
||||
"minification" : {
|
||||
"js" : true,
|
||||
"js" : false,
|
||||
"css" : true,
|
||||
"html" : true,
|
||||
"img" : true
|
||||
|
|
|
|||
|
|
@ -259,9 +259,10 @@ function initModules(pCallBack){
|
|||
},
|
||||
|
||||
lNames = {};
|
||||
lNames[lStorage + '_dropbox'] = 'DropBox',
|
||||
lNames[lStorage + '_github' ] = 'GitHub',
|
||||
lNames[lStorage + '_gdrive' ] = 'GDrive',
|
||||
lNames[lStorage + '_dropbox'] = 'DropBox',
|
||||
lNames[lStorage + '_github' ] = 'GitHub',
|
||||
lNames[lStorage + '_gdrive' ] = 'GDrive',
|
||||
lNames[lStorage + '_vk' ] = 'VK',
|
||||
|
||||
lDisableMenuFunc();
|
||||
|
||||
|
|
@ -320,7 +321,7 @@ function baseInit(pCallBack){
|
|||
};
|
||||
}
|
||||
|
||||
/* загружаем общие функции для клиента и сервера */
|
||||
/* загружаем общие функции для клиента и сервера */
|
||||
DOM.jsload(CloudCmd.LIBDIR + 'cloudfunc.js',function(){
|
||||
DOM.addListener("popstate", function(pEvent) {
|
||||
var lPath = pEvent.state;
|
||||
|
|
@ -478,8 +479,7 @@ CloudCmd._changeLinks = function(pPanelID){
|
|||
|
||||
lUrl = CloudCmd.HOST;
|
||||
|
||||
for(var i = 0, n = a.length; i < n ; i++)
|
||||
{
|
||||
for(var i = 0, n = a.length; i < n ; i++){
|
||||
/* убираем адрес хоста*/
|
||||
var link = a[i].href.replace(lUrl,'');
|
||||
|
||||
|
|
|
|||
|
|
@ -113,7 +113,7 @@ var CloudCommander, Util, DOM, $;
|
|||
|
||||
callback: function(key, options) {
|
||||
var m = "clicked: " + key;
|
||||
console.log(m, options);
|
||||
Util.log(m, options);
|
||||
|
||||
KeyBinding.set();
|
||||
},
|
||||
|
|
@ -123,7 +123,13 @@ var CloudCommander, Util, DOM, $;
|
|||
'View' : Util.retExec(showEditor, true),
|
||||
'Edit' : Util.retExec(showEditor, false),
|
||||
'Delete' : Util.retExec(DOM.promptRemoveCurrent),
|
||||
'Upload to' : getUploadToItem( ['GitHub', 'GDrive', 'DropBox'] ),
|
||||
'Upload to' : getUploadToItem(
|
||||
[
|
||||
'DropBox',
|
||||
'GDrive',
|
||||
'GitHub',
|
||||
'VK'
|
||||
]),
|
||||
'Download' : function(key, opt){
|
||||
DOM.Images.showLoad();
|
||||
|
||||
|
|
|
|||
|
|
@ -7,7 +7,7 @@ var CloudCommander, Util, DOM, Dropbox, cb, Client;
|
|||
var DropBoxStore = {};
|
||||
|
||||
/* temporary callback function for work with github */
|
||||
cb = function (err, data){ console.log(err || data);};
|
||||
cb = function (err, data){ Util.log(err || data);};
|
||||
|
||||
/* PRIVATE FUNCTIONS */
|
||||
|
||||
|
|
@ -34,15 +34,12 @@ var CloudCommander, Util, DOM, Dropbox, cb, Client;
|
|||
}
|
||||
|
||||
function getUserData(pCallBack){
|
||||
var lName,
|
||||
lShowUserInfo = function(pError, pData){
|
||||
if(!pError){
|
||||
lName = pData.name;
|
||||
console.log('Hello ' + lName + ' :)!');
|
||||
}
|
||||
};
|
||||
Client.getUserInfo(function(pError, pData){
|
||||
var lHello = 'Hello ' + pData.name + ' :)!',
|
||||
lMsg = pError ? pError : lHello;
|
||||
|
||||
Client.getUserInfo(lShowUserInfo);
|
||||
Util.log(lMsg);
|
||||
});
|
||||
|
||||
Util.exec(pCallBack);
|
||||
}
|
||||
|
|
@ -87,7 +84,7 @@ var CloudCommander, Util, DOM, Dropbox, cb, Client;
|
|||
|
||||
Client.writeFile(lName, lContent, function(pError, pData){
|
||||
DOM.Images.hideLoad();
|
||||
console.log(pError || pData);
|
||||
Util.log(pError || pData);
|
||||
Util.exec(pCallBack);
|
||||
});
|
||||
}
|
||||
|
|
|
|||
|
|
@ -31,12 +31,24 @@ var CloudCommander, Util, DOM, VK;
|
|||
|
||||
}
|
||||
|
||||
function auth(){
|
||||
function auth(pCallBack){
|
||||
CloudCmd.getConfig(function(pConfig){
|
||||
var lDOCUMENTS_ACCESS = 131072;
|
||||
|
||||
VK.init({ apiId: pConfig.vk_id});
|
||||
VK.Auth.login(function(pResponse){
|
||||
console.log(pResponse);
|
||||
}, 131072); /* Доступ к документам пользователя */
|
||||
|
||||
VK.Auth.login(function(){
|
||||
var lNAME = 1281;
|
||||
VK.Api.call('getVariable', {key: lNAME}, function(r) {
|
||||
var lName = r.response;
|
||||
|
||||
if(lName)
|
||||
Util.log ('Hello, ' + lName + ':)');
|
||||
});
|
||||
|
||||
Util.exec(pCallBack);
|
||||
|
||||
}, lDOCUMENTS_ACCESS); /* Доступ к документам пользователя */
|
||||
});
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -97,11 +97,8 @@ Util = exports || {};
|
|||
lConsole = Scope.console,
|
||||
lDate = '[' + Util.getDate() + '] ';
|
||||
|
||||
if(!Util.isString(lArg))
|
||||
lArg = JSON.stringify(lArg);
|
||||
|
||||
if(lConsole && pArg)
|
||||
lConsole.log(lDate + lArg);
|
||||
lConsole.log(lDate, lArg);
|
||||
|
||||
return pArg;
|
||||
};
|
||||
|
|
|
|||
|
|
@ -6,5 +6,6 @@
|
|||
"storage/_dropbox",
|
||||
"storage/_dropbox_chooser",
|
||||
"storage/_gdrive",
|
||||
"storage/_vk",
|
||||
"terminal"
|
||||
]
|
||||
Loading…
Add table
Add a link
Reference in a new issue