added load spinner on keys button click

This commit is contained in:
coderaiser 2012-11-14 09:36:17 -05:00
parent 1771067856
commit 8bd2af052f
8 changed files with 75 additions and 39 deletions

View file

@ -1,7 +1,7 @@
2012.10.*, Version 0.1.8
* Added ability to shutdown Cloud Commander
thrue terminal command: "cloudcmd exit"
thru terminal command: "cloudcmd exit"
* Fixed bug with showing terminal and viewer
at the same time.
@ -9,7 +9,7 @@ at the same time.
* Fixed bug with appcache config. Windows reads
file not just like Linux.
* Added ability to update thrue git.
* Added ability to update thru git.
* Added ability to change charset on terminal only if
it's build in command on win32.
@ -60,7 +60,7 @@ server.js to cloudcmd.js.
* Added ability of authorithation in GitHub.
* Rewrited sizing of names if they are to
long thrue css, from JavaScript.
long thru css, from JavaScript.
* Fixed bug with application cahe forming on windows
and linux.
@ -75,7 +75,7 @@ listing in json from menu.
* Util object moved from client.js to modules
dom.js and util.js.
* Fixed bug with navigation thrue path panel.
* Fixed bug with navigation thru path panel.
* Added functions DOM.addKeyListener and Util.loadOnLoad
@ -83,6 +83,8 @@ dom.js and util.js.
* Fixed bug with config file, when no need to minification.
* Added ability to hide keys panel thru config option.
2012.10.01, Version 0.1.7
@ -104,7 +106,7 @@ loaded any time by any extension.
* Fixed bug with getByClass IE version.
* Fixed bug with keyboard not responding when go deeper
in file tree thrue mouse double click.
in file tree thru mouse double click.
* Removed property keyBinded. From not it's private
member of KeyBinding class.
@ -114,11 +116,11 @@ Function scrollIntoViewIfNeeded was polyfilled.
* Added classic borders to panels.
* Added ability to download files thrue drag'n'drop.
* Added ability to download files thru drag'n'drop.
* Fixed bug with setting current file when mouse down.
* Improved borders over CodeMirror and panels thrue css.
* Improved borders over CodeMirror and panels thru css.
* Added ability to watch is file changed wile server is
running
@ -145,7 +147,7 @@ disabled in browsers.
* Added plagin terminal ( ` button under TAB).
* Added ability to execute commands on server thrue terminal.
* Added ability to execute commands on server thru terminal.
* Added appcache paramter to config.json

View file

@ -73,7 +73,7 @@ CloudFunc, $, KeyBinding,
* function load modules
* @pParams = {name, path, func, dobefore, arg}
*/
var loadModule = function(pParams){
var loadModule = function(pParams){
if(!pParams) return;
var lName = pParams.name,
@ -98,7 +98,7 @@ var loadModule = function(pParams){
if( !Util.isContainStr(lPath, '.js') )
lPath += '.js';
cloudcmd[lName] = function(pArg){
cloudcmd[lName] = function(pArg){
Util.exec(lDoBefore);
return DOM.jsload(cloudcmd.LIBDIRCLIENT + lPath, lFunc ||
@ -418,9 +418,21 @@ function initModules(pCallBack){
DOM.ajax({
url:'/modules.json',
success: function(pModules){
var lFunc = Util.retFunc( DOM.Images.showLoad ),
lDoBefore = {
'viewer' : lFunc,
"editor/_codemirror" : lFunc
};
if( Util.isArray(pModules) )
for(var i = 0, n = pModules.length; i < n ; i++)
loadModule(pModules[i]);
for(var i = 0, n = pModules.length; i < n ; i++){
var lModule = pModules[i];
loadModule({
path: lModule,
dobefore: lDoBefore[lModule]
});
}
Util.exec(pCallBack);
}
@ -430,14 +442,14 @@ function initModules(pCallBack){
function initCmdButtons(pCallBack){
var lFuncs =[
null,
null, /* f1 */
null, /* f2 */
cloudcmd.Viewer, /* f3 */
cloudcmd.Editor, /* f4 */
null, /* f5 */
null, /* f6 */
null, /* f7 */
null, /* f8 */
null, /* f1 */
null, /* f2 */
cloudcmd.Viewer, /* f3 */
cloudcmd.Editor, /* f4 */
null, /* f5 */
null, /* f6 */
null, /* f7 */
null, /* f8 */
];
for(var i = 1; i <= 8; i++)
getById('f' + i).onclick = lFuncs[i];

View file

@ -47,6 +47,11 @@
if(!srv.Config.appcache)
pIndex = Util.removeStr(pIndex, ' manifest=/cloudcmd.appcache');
if(!srv.Config.show_keys_panel){
var lKeysPanel = '<div id=keyspanel';
pIndex = pIndex.replace(lKeysPanel, lKeysPanel +' class=hidden');
}
return pIndex;
}

View file

@ -9,6 +9,7 @@
},
"oauth_client_id" : "891c251b925e4e967fa9",
"oauth_client_secret" : "afe9bed1e810c5dc44c4c2a953fc6efb1e5b0545",
"show_keys_panel" : true,
"server" : true,
"logs" : false,
"socket" : true,

View file

@ -197,8 +197,13 @@ var CloudCommander, Util, DOM, CloudFunc, CodeMirror;
initCodeMirror,
CodeMirrorEditor.show,
load
];
Util.loadOnLoad( lShowCodemirror );
],
lEditor = function(){
DOM.Images.showLoad();
Util.loadOnLoad( lShowCodemirror );
};
lEditor();
lShowCodemirror.pop();
var lKeyListener = function(pEvent){
@ -213,11 +218,11 @@ var CloudCommander, Util, DOM, CloudFunc, CodeMirror;
{
case lF4:
ReadOnly = false;
Util.loadOnLoad( lShowCodemirror );
lEditor();
break;
case lF3:
ReadOnly = true;
Util.loadOnLoad( lShowCodemirror );
lEditor();
break;
}
}
@ -226,7 +231,7 @@ var CloudCommander, Util, DOM, CloudFunc, CodeMirror;
/* добавляем обработчик клавишь */
DOM.addKeyListener( lKeyListener );
DOM.getById('f4').onclick = Util.retLoadOnLoad( lShowCodemirror );
DOM.getById('f4').onclick = lEditor;
};
cloudcmd.Editor.CodeMirror = CodeMirrorEditor;

View file

@ -2,10 +2,11 @@ var CloudCommander, Util, DOM;
(function(){
"use strict";
var cloudcmd = CloudCommander;
DOM.Images.hideLoad();
var cloudcmd = CloudCommander,
/* private property set or set key binding */
var keyBinded;
keyBinded;
/* Key constants*/
cloudcmd.KEY = {
@ -60,7 +61,7 @@ var CloudCommander, Util, DOM;
};
var key_event = function(event){
var key_event = function(event){
/* получаем выдленный файл*/
var lCurrentFile = DOM.getCurrentFile(),
lName, i;
@ -118,8 +119,7 @@ var CloudCommander, Util, DOM;
DOM.removeCurrent(lCurrentFile);
/* if f3 or shift+f3 or alt+f3 pressed */
else if(lKeyCode === KEY.F3){
DOM.Images.showLoad();
else if(lKeyCode === KEY.F3){
var lEditor = cloudcmd[event.shiftKey ?
'Viewer' : 'Editor'];

View file

@ -137,7 +137,6 @@ var CloudCommander, Util, DOM, CloudFunc, $;
* Example: loadData('index.html', function(pData){console.log(pData)});
*/
FancyBox.loadData = function(pA, pSuccess_f){
DOM.Images.showLoad();
var lLink = pA.href;
/* убираем адрес хоста */
@ -176,7 +175,6 @@ var CloudCommander, Util, DOM, CloudFunc, $;
* function shows FancyBox
*/
FancyBox.show = function(pCallBack){
DOM.Images.hideLoad();
set();
var lConfig = FancyBox.getConfig(),
@ -203,19 +201,21 @@ var CloudCommander, Util, DOM, CloudFunc, $;
]));
var lView = function(){
DOM.Images.showLoad();
FancyBox.show( DOM.getCurrentFile() );
};
var lKeyListener = function(){
var lF3 = cloudcmd.KEY.F3;
var lF3 = cloudcmd.KEY.F3,
lKeyBinded = KeyBinding.get(),
lKey = event.keyCode,
lShift = event.shiftKey;
/* если клавиши можно обрабатывать */
if( KeyBinding.get() &&
event.keyCode === lF3 &&
event.shiftKey ){
lView();
event.preventDefault();
}
if( lKeyBinded && lKey === lF3 && lShift ){
lView();
event.preventDefault();
}
};
/* добавляем обработчик клавишь */

View file

@ -149,6 +149,17 @@ var Util, exports;
Util.exec(pCallBack, pArg);
};
};
/**
* return function wich exec function in params
* @param pCallBack
* @param pArg
*/
Util.retFunc = function(pCallBack, pArg){
return function(){
return Util.exec(pCallBack, pArg);
};
};
/**
* return load functions thrue callbacks one-by-one