minor changes

This commit is contained in:
coderaiser 2012-12-04 06:41:20 -05:00
parent 2693eba31c
commit 1e585b6082
4 changed files with 49 additions and 63 deletions

View file

@ -97,15 +97,18 @@ var loadModule = function(pParams){
if( !Util.isContainStr(lPath, '.js') )
lPath += '.js';
cloudcmd[lName] = function(pArg){
lPath = Util.exec(lDoBefore) || lPath;
return DOM.jsload(cloudcmd.LIBDIRCLIENT + lPath, lFunc ||
function(){
cloudcmd[lName].Keys(pArg);
});
};
if(!cloudcmd[lName])
cloudcmd[lName] = function(pArg){
Util.exec(lDoBefore);
return DOM.jsload(cloudcmd.LIBDIRCLIENT + lPath, lFunc ||
function(){
cloudcmd[lName].Keys(pArg);
});
};
else
cloudcmd[lName + lPath];
};
CloudClient.GoogleAnalytics = function(){
@ -344,9 +347,6 @@ function initModules(pCallBack){
DOM.ajax({
url:'/modules.json',
success: function(pModules){
const DROPBOX = 'storage/_dropbox',
GITHUB = 'storage/_github';
var lShowLoadFunc = Util.retFunc( DOM.Images.showLoad ),
lDisableMenuFunc = function(){
var lFunc = document.oncontextmenu;
@ -355,32 +355,13 @@ function initModules(pCallBack){
return cloudcmd.Menu.ENABLED || false;
};
},
lStorage = function(){
const lKEY = cloudcmd.KEY;
var lRet = false;
switch(event.keyCode){
case lKEY.G:
lRet = GITHUB;
break;
case lKEY.D:
lRet = DROPBOX;
break;
}
return lRet && (lRet + '.js');
},
lDoBefore = {
'editor/_codemirror' : lShowLoadFunc,
'menu' : lDisableMenuFunc,
'viewer' : lShowLoadFunc
};
lDoBefore[GITHUB] =
lDoBefore[DROPBOX] = lStorage;
lDisableMenuFunc();

View file

@ -78,7 +78,10 @@ var CloudCommander, Util, DOM;
Util.exec(cloudcmd.Config);
}
else if( (lKeyCode === KEY.G || lKeyCode === KEY.D) && event.altKey){
else if(lKeyCode === KEY.G && event.altKey)
Util.exec(cloudcmd.Storage);
else if(lKeyCode === KEY.D && event.altKey){
Util.exec(cloudcmd.Storage);
event.preventDefault();
}
@ -117,7 +120,7 @@ var CloudCommander, Util, DOM;
DOM.removeCurrent(lCurrentFile);
/* if f3 or shift+f3 or alt+f3 pressed */
else if(lKeyCode === KEY.F3){
else if(lKeyCode === KEY.F3){
var lEditor = cloudcmd[event.shiftKey ?
'Viewer' : 'Editor'];

View file

@ -1,23 +1,24 @@
var CloudCommander, DOM, Dropbox; //o7d6llji052vijk
var CloudCommander, Util, DOM, Dropbox;
/* module for work with github */
(function(){
"use strict";
var cloudcmd = CloudCommander,
CLIENT_ID,
DropBoxStore = {},
options = {
linkType: "direct",
success: function(files) {
console.log("Here's the file link:" + files[0].link);
},
cancel: function() {
console.log('Chose something');
}
};
const cloudcmd = CloudCommander;
var CLIENT_ID,
Storage = cloudcmd.Storage,
DropBoxStore = {},
options = {
linkType: "direct",
success: function(files) {
console.log("Here's the file link:" + files[0].link);
},
cancel: function() {
console.log('Chose something');
}
};
/* PRIVATE FUNCTIONS */
/**
@ -42,9 +43,9 @@ var CloudCommander, DOM, Dropbox; //o7d6llji052vijk
Dropbox.choose(options);
};
cloudcmd.Storage.Keys = function(){
Storage.Keys = function(){
load();
};
cloudcmd.Storage.DropBoxStore = DropBoxStore;
Storage.DropBoxStore = DropBoxStore;
})();

View file

@ -4,17 +4,18 @@ var CloudCommander, Util, DOM, $, Github, cb;
(function(){
"use strict";
var cloudcmd = CloudCommander,
APIURL = '/api/v1',
AuthURL = APIURL + '/auth',
GitHubIdURL = APIURL + '/github_id',
GitHub_ID,
Cache = DOM.Cache,
GithubLocal,
User,
GithubStore = {};
const cloudcmd = CloudCommander,
Cache = DOM.Cache,
APIURL = '/api/v1',
AuthURL = APIURL + '/auth',
GitHubIdURL = APIURL + '/github_id';
var GitHub_ID,
GithubLocal,
User,
Storage = cloudcmd.Storage = {},
GithubStore = {};
/* temporary callback function for work with github */
cb = function (err, data){ console.log(err || data);};
@ -157,8 +158,8 @@ var CloudCommander, Util, DOM, $, Github, cb;
User.show(null, lShowUserInfo);
}
cloudcmd.Storage.Keys = function(){
Storage.Keys = function(){
Util.loadOnLoad([
getUserData,
init,
@ -167,5 +168,5 @@ var CloudCommander, Util, DOM, $, Github, cb;
]);
};
cloudcmd.Storage.GithubStore = GithubStore;
Storage.GithubStore = GithubStore;
})();