From 2693eba31c6dbc182f10df6857dbbc13598bacb4 Mon Sep 17 00:00:00 2001 From: coderaiser Date: Tue, 4 Dec 2012 05:17:01 -0500 Subject: [PATCH] added ability to run dropbox chooser on + --- ChangeLog | 2 ++ config.json | 12 +++++++----- lib/client.js | 32 ++++++++++++++++++++++++++++---- lib/client/keyBinding.js | 4 +++- lib/client/storage/_dropbox.js | 3 +-- lib/client/storage/_github.js | 3 +-- lib/util.js | 4 ++-- modules.json | 5 +++-- 8 files changed, 47 insertions(+), 18 deletions(-) diff --git a/ChangeLog b/ChangeLog index 10678c8b..29f3aa05 100644 --- a/ChangeLog +++ b/ChangeLog @@ -152,6 +152,8 @@ Added dropbox_id option. * Fixed bug in github show function. +* Added ability to call dropbox chooser on + . + 2012.10.01, Version 0.1.7 diff --git a/config.json b/config.json index 205537c8..bf8a5656 100644 --- a/config.json +++ b/config.json @@ -3,13 +3,15 @@ "appcache" : false, "minification" : { "js" : false, - "css" : true, + "css" : false, "html" : false, - "img" : true + "img" : false }, - "github_id" : "891c251b925e4e967fa9", - "github_secret" : "afe9bed1e810c5dc44c4c2a953fc6efb1e5b0545", - "dropbox_id" : "o7d6llji052vijk", + "github_id" : "891c251b925e4e967fa9", + "github_secret" : "afe9bed1e810c5dc44c4c2a953fc6efb1e5b0545", + "dropbox_id" : "0nd3ssnp5fp7tqs", + "dropbox_secret" : "r61lxpchmk8l06o", + "dropbox_chooser_id" : "o7d6llji052vijk", "show_keys_panel" : true, "server" : true, "logs" : false, diff --git a/lib/client.js b/lib/client.js index 342397be..9a94064f 100644 --- a/lib/client.js +++ b/lib/client.js @@ -97,8 +97,9 @@ var loadModule = function(pParams){ if( !Util.isContainStr(lPath, '.js') ) lPath += '.js'; - cloudcmd[lName] = function(pArg){ - Util.exec(lDoBefore); + cloudcmd[lName] = function(pArg){ + + lPath = Util.exec(lDoBefore) || lPath; return DOM.jsload(cloudcmd.LIBDIRCLIENT + lPath, lFunc || function(){ @@ -343,6 +344,9 @@ 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; @@ -351,12 +355,32 @@ 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 = { - 'viewer' : lShowLoadFunc, 'editor/_codemirror' : lShowLoadFunc, - 'menu' : lDisableMenuFunc + 'menu' : lDisableMenuFunc, + 'viewer' : lShowLoadFunc }; + + lDoBefore[GITHUB] = + lDoBefore[DROPBOX] = lStorage; lDisableMenuFunc(); diff --git a/lib/client/keyBinding.js b/lib/client/keyBinding.js index 084a7f01..3091625a 100644 --- a/lib/client/keyBinding.js +++ b/lib/client/keyBinding.js @@ -78,8 +78,10 @@ var CloudCommander, Util, DOM; Util.exec(cloudcmd.Config); } - else if(lKeyCode === KEY.G && event.altKey) + else if( (lKeyCode === KEY.G || lKeyCode === KEY.D) && event.altKey){ Util.exec(cloudcmd.Storage); + event.preventDefault(); + } /* если нажали таб: * переносим курсор на diff --git a/lib/client/storage/_dropbox.js b/lib/client/storage/_dropbox.js index 3d4f1490..d930dbda 100644 --- a/lib/client/storage/_dropbox.js +++ b/lib/client/storage/_dropbox.js @@ -16,8 +16,7 @@ var CloudCommander, DOM, Dropbox; //o7d6llji052vijk console.log('Chose something'); } }; - - cloudcmd.Storage = {}; + /* PRIVATE FUNCTIONS */ diff --git a/lib/client/storage/_github.js b/lib/client/storage/_github.js index 3f79e549..86e8f093 100644 --- a/lib/client/storage/_github.js +++ b/lib/client/storage/_github.js @@ -14,8 +14,7 @@ var CloudCommander, Util, DOM, $, Github, cb; GithubLocal, User, GithubStore = {}; - - cloudcmd.Storage = {}; + /* temporary callback function for work with github */ cb = function (err, data){ console.log(err || data);}; diff --git a/lib/util.js b/lib/util.js index b5742814..4c2d3372 100644 --- a/lib/util.js +++ b/lib/util.js @@ -350,7 +350,7 @@ var Util, exports; * @param pCallBack * @param pArg */ - Util.exec = function(pCallBack, pArg){ + Util.exec = function(pCallBack, pArg){ var lRet = false; if( Util.isFunction(pCallBack) ) @@ -362,7 +362,7 @@ var Util, exports; /** * Gets current time in format hh:mm:ss */ - Util.getTime = function(){ + Util.getTime = function(){ var date = new Date(), hours = date.getHours(), minutes = date.getMinutes(), diff --git a/modules.json b/modules.json index b1ae657a..46d42f3a 100644 --- a/modules.json +++ b/modules.json @@ -1,7 +1,8 @@ [ "editor/_codemirror", + "menu", "viewer", "storage/_github", - "terminal", - "menu" + "storage/_dropbox", + "terminal" ] \ No newline at end of file