diff --git a/ChangeLog b/ChangeLog
index 903a8339..1f927aef 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -189,6 +189,8 @@ generation of json of directory listing.
* Added RESTfull object to DOM for easy work with
CloudCmd REST API.
+* Added help screen (on F1 after viewer loads).
+
2012.12.12, Version 0.1.8
diff --git a/json/config.json b/json/config.json
index a99ff7dc..00346937 100644
--- a/json/config.json
+++ b/json/config.json
@@ -2,7 +2,7 @@
"api_url" : "/api/v1",
"appcache" : false,
"minification" : {
- "js" : true,
+ "js" : false,
"css" : true,
"html" : true,
"img" : true
diff --git a/lib/client.js b/lib/client.js
index 6afd17d3..36ae8b58 100644
--- a/lib/client.js
+++ b/lib/client.js
@@ -281,7 +281,7 @@ function initKeysPanel(pCallBack){
lFuncs =[
null,
null, /* f1 */
- null, /* f2 */
+ DOM.renameCurrentFile, /* f2 */
CloudCmd.Viewer, /* f3 */
CloudCmd.Editor, /* f4 */
null, /* f5 */
diff --git a/lib/client/dom.js b/lib/client/dom.js
index ab8bfef3..c79407de 100644
--- a/lib/client/dom.js
+++ b/lib/client/dom.js
@@ -1400,7 +1400,7 @@ var CloudCommander, Util,
* @pCurrent
*/
DOM.renameCurrentFile = function(pCurrentFile){
- if( Util.isString(pCurrentFile) )
+ if( !DOM.isCurrentFile(pCurrentFile) )
pCurrentFile = null;
var lCurrent = pCurrentFile || DOM.getCurrentFile(),
diff --git a/lib/client/keyBinding.js b/lib/client/keyBinding.js
index 6372d162..4ef0d5c2 100644
--- a/lib/client/keyBinding.js
+++ b/lib/client/keyBinding.js
@@ -30,6 +30,7 @@ var CloudCommander, Util, DOM;
S : 83,
T : 84,
+ F1 : 112,
F2 : 113,
F3 : 114,
F4 : 115,
@@ -118,6 +119,9 @@ var CloudCommander, Util, DOM;
else
DOM.promptDeleteCurrent(lCurrentFile);
}
+ else if(lKeyCode === KEY.F1){
+ DOM.preventDefault(pEvent);
+ }
else if(lKeyCode === KEY.F2)
DOM.renameCurrentFile(lCurrentFile);
/* if f3 or shift+f3 or alt+f3 pressed */
diff --git a/lib/client/viewer.js b/lib/client/viewer.js
index ff389b5e..0e4a4b91 100644
--- a/lib/client/viewer.js
+++ b/lib/client/viewer.js
@@ -1,125 +1,156 @@
-var CloudCommander, Util, DOM, $;
-/* object contains viewer FancyBox
- * https://github.com/fancyapps/fancyBox
- */
-(function(CloudCmd, Util, DOM){
- 'use strict';
-
- var KeyBinding = CloudCmd.KeyBinding,
- FancyBox = {},
-
- Config = {
- beforeShow : function(){
- DOM.Images.hideLoad();
- KeyBinding.unSet();
- },
-
- afterShow : function(){
- var lEditor = DOM.getById('CloudViewer');
- if(lEditor)
- lEditor.focus();
- },
-
- beforeClose : Util.retFunc( KeyBinding.set ),
-
- openEffect : 'none',
- closeEffect : 'none',
- autoSize : false,
- height : window.innerHeight,
- helpers : {
- overlay : {
- css : {
- 'background' : 'rgba(255, 255, 255, 0.1)'
- }
- }
- },
- padding : 0
- };
-
- CloudCmd.Viewer = {
- get: (function(){
- return this.FancyBox;
- })
- };
-
- /**
- * function loads css and js of FancyBox
- * @pParent - this
- * @pCallBack - executes, when everything loaded
- */
- FancyBox.load = function(pCallBack){
- console.time('fancybox load');
- var lDir = CloudCmd.LIBDIRCLIENT + 'viewer/fancyBox/source/',
- lFiles = [ lDir + 'jquery.fancybox.css',
- lDir + 'jquery.fancybox.js' ];
-
- DOM.anyLoadOnLoad([lFiles], function(){
- console.timeEnd('fancybox load');
- Util.exec( pCallBack );
- })
- .cssSet({id:'viewer',
- inner : '#CloudViewer{' +
- 'font-size: 16px;' +
- 'white-space :pre' +
- '}' +
- '#CloudViewer::selection{' +
- /*
- 'background: #fe57a1;'
- 'color: #fff;'
- */
- 'background: #b3d4fc;' +
- 'text-shadow: none;' +
- '}'
- });
-
- };
-
-
- /**
- * function shows FancyBox
- */
- FancyBox.show = function(){
- var lPath = DOM.getCurrentPath();
-
- if( Util.checkExtension(lPath, ['png','jpg', 'gif','ico']) )
- $.fancybox.open({ href : lPath }, Config);
- else
- DOM.getCurrentData(function(pParams){
- $.fancybox('
' +
- pParams.data + '
', Config);
- });
- };
-
- CloudCmd.Viewer.init = function(){
- Util.loadOnLoad([
- FancyBox.show,
- FancyBox.load,
- DOM.jqueryLoad
- ]);
-
- var lView = function(){
- DOM.Images.showLoad();
- FancyBox.show( DOM.getCurrentFile() );
- };
-
- var lKeyListener = function(pEvent){
- var lF3 = CloudCmd.KEY.F3,
- lKeyBinded = KeyBinding.get(),
- lKey = pEvent.keyCode,
- lShift = pEvent.shiftKey;
-
- /* если клавиши можно обрабатывать */
- if( lKeyBinded && lKey === lF3 && lShift ){
- lView();
- pEvent.preventDefault();
- }
- };
-
- /* добавляем обработчик клавишь */
- DOM.addKeyListener(lKeyListener)
- .setButtonKey('f3', lView);
- };
-
- CloudCmd.Viewer.FancyBox = FancyBox;
-
+var CloudCommander, Util, DOM, $;
+/* object contains viewer FancyBox
+ * https://github.com/fancyapps/fancyBox
+ */
+(function(CloudCmd, Util, DOM){
+ 'use strict';
+
+ var KeyBinding = CloudCmd.KeyBinding,
+ FancyBox = {},
+
+ Config = {
+ beforeShow : function(){
+ DOM.Images.hideLoad();
+ KeyBinding.unSet();
+ },
+
+ afterShow : function(){
+ var lEditor = DOM.getById('CloudViewer');
+ if(lEditor)
+ lEditor.focus();
+ },
+
+ beforeClose : Util.retFunc( KeyBinding.set ),
+
+ openEffect : 'none',
+ closeEffect : 'none',
+ autoSize : false,
+ height : window.innerHeight,
+ helpers : {
+ overlay : {
+ css : {
+ 'background' : 'rgba(255, 255, 255, 0.1)'
+ }
+ }
+ },
+ padding : 0
+ };
+
+ CloudCmd.Viewer = {
+ get: (function(){
+ return this.FancyBox;
+ })
+ };
+
+ /**
+ * function loads css and js of FancyBox
+ * @pParent - this
+ * @pCallBack - executes, when everything loaded
+ */
+ FancyBox.load = function(pCallBack){
+ console.time('fancybox load');
+ var lDir = CloudCmd.LIBDIRCLIENT + 'viewer/fancyBox/source/',
+ lFiles = [ lDir + 'jquery.fancybox.css',
+ lDir + 'jquery.fancybox.js' ];
+
+ DOM.anyLoadOnLoad([lFiles], function(){
+ console.timeEnd('fancybox load');
+ Util.exec( pCallBack );
+ })
+ .cssSet({id:'viewer',
+ inner : '#CloudViewer{' +
+ 'font-size: 16px;' +
+ 'white-space :pre' +
+ '}' +
+ '#CloudViewer::selection{' +
+ /*
+ 'background: #fe57a1;'
+ 'color: #fff;'
+ */
+ 'background: #b3d4fc;' +
+ 'text-shadow: none;' +
+ '}'
+ });
+
+ };
+
+
+ FancyBox.showHelp = function(){
+ DOM.Images.showLoad();
+ DOM.ajax({
+ url: '/README.md',
+ success: function (pData){
+ var lData = {text: pData};
+ DOM.ajax({
+ method : 'post',
+ url : 'https://api.github.com/markdown',
+ data : Util.stringifyJSON(lData),
+ success:function(pResult){
+ DOM.Images.hideLoad();
+ $.fancybox(pResult, Config);
+ },
+
+ error: DOM.Images.showError
+ });
+ },
+
+ error:DOM.Images.showError
+ });
+ };
+
+ /**
+ * function shows FancyBox
+ */
+ FancyBox.show = function(pCallBack){
+ var lPath = DOM.getCurrentPath();
+
+ if( Util.checkExtension(lPath, ['png','jpg', 'gif','ico']) )
+ $.fancybox.open({ href : lPath }, Config);
+ else
+ DOM.getCurrentData(function(pParams){
+ $.fancybox('' +
+ pParams.data + '
', Config);
+ });
+
+ Util.exec(pCallBack);
+ };
+
+ CloudCmd.Viewer.init = function(pCallBack){
+ Util.loadOnLoad([
+ pCallBack,
+ FancyBox.show,
+ FancyBox.load,
+ DOM.jqueryLoad
+ ]);
+
+ var lView = function(){
+ DOM.Images.showLoad();
+ FancyBox.show( DOM.getCurrentFile() );
+ };
+
+ var lKeyListener = function(pEvent){
+ var lKEY = CloudCmd.KEY,
+ lF3 = lKEY.F3,
+ lKeyBinded = KeyBinding.get(),
+ lKeyCode = pEvent.keyCode,
+ lShift = pEvent.shiftKey;
+
+ /* если клавиши можно обрабатывать */
+ if( lKeyBinded){
+ if(lKeyCode === lF3 && lShift){
+ lView();
+ pEvent.preventDefault();
+ }
+ else if(lKeyCode === lKEY.F1)
+ FancyBox.showHelp();
+ }
+ };
+
+ /* добавляем обработчик клавишь */
+ DOM.addKeyListener(lKeyListener)
+ .setButtonKey('f3', lView);
+ };
+
+ CloudCmd.Viewer.FancyBox = FancyBox;
+
})(CloudCommander, Util, DOM);
\ No newline at end of file
diff --git a/lib/server/socket.js b/lib/server/socket.js
index 2a3dceed..f064a044 100644
--- a/lib/server/socket.js
+++ b/lib/server/socket.js
@@ -1,4 +1,4 @@
-/* module make possible connectoin thrue socket.io on a server */
+/* module make possible connectoin thru socket.io on a server */
(function(){
'use strict';