From 53d7a0cb7b80a97494c8302edc865a70f1a13d4b Mon Sep 17 00:00:00 2001 From: coderaiser Date: Wed, 12 Jun 2013 10:55:06 -0400 Subject: [PATCH] added help module --- ChangeLog | 2 ++ json/modules.json | 1 + lib/client/help.js | 67 ++++++++++++++++++++++++++++++++++++++++++++++ lib/client/view.js | 3 ++- 4 files changed, 72 insertions(+), 1 deletion(-) create mode 100644 lib/client/help.js diff --git a/ChangeLog b/ChangeLog index 44c31fc2..35cde65a 100644 --- a/ChangeLog +++ b/ChangeLog @@ -58,6 +58,8 @@ getJSONfromFileTable. * Added ability to put callback to view. +* Added help module. + 2012.04.22, v0.2.0 diff --git a/json/modules.json b/json/modules.json index 8ea623b7..a37640b7 100644 --- a/json/modules.json +++ b/json/modules.json @@ -2,6 +2,7 @@ "edit/_codemirror", "menu", "view", + "help", "terminal", { "name": "storage", "data": [{ diff --git a/lib/client/help.js b/lib/client/help.js new file mode 100644 index 00000000..438c087a --- /dev/null +++ b/lib/client/help.js @@ -0,0 +1,67 @@ +var CloudCmd, Util, DOM; +(function(CloudCmd, Util, DOM){ + 'use strict'; + + CloudCmd.Help = new HelpProto(CloudCmd, Util, DOM); + + function HelpProto(CloudCmd, Util, DOM){ + var Key = CloudCmd.Key, + Images = DOM.Images, + Help = this; + + this.init = function(pCallBack){ + Util.loadOnLoad([ + Help.show, + CloudCmd.View, + ]); + + DOM.Events.addKey(listener); + DOM.setButtonKey('f1', Help.show); + + delete Help.init; + }; + + this.show = function(){ + 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){ + Images.hideLoad(); + CloudCmd.View.Show(pResult); + }, + + error: Images.showError + }); + }, + + error:Images.showError + }); + }; + + + this.hide = CloudCmd.View.hide; + + function listener(pEvent){ + var lF1 = Key.F1, + lIsBind = Key.isBind(), + lKey = pEvent.keyCode; + + /* если клавиши можно обрабатывать */ + if (lIsBind) { + switch(lKey){ + + case lF1: + Help.show(); + break; + } + } + } + } + +})(CloudCmd, Util, DOM); \ No newline at end of file diff --git a/lib/client/view.js b/lib/client/view.js index 92e36a38..0d35e08b 100644 --- a/lib/client/view.js +++ b/lib/client/view.js @@ -36,8 +36,9 @@ var CloudCmd, Util, DOM, CloudFunc, $; }; this.init = function(pCallBack){ + debugger; Util.loadOnLoad([ - pCallBack || Util.retExec(View.show, null), + pCallBack || View.show, load, DOM.jqueryLoad ]);