added help module

This commit is contained in:
coderaiser 2013-06-12 10:55:06 -04:00
parent 9e62551a34
commit 53d7a0cb7b
4 changed files with 72 additions and 1 deletions

View file

@ -58,6 +58,8 @@ getJSONfromFileTable.
* Added ability to put callback to view.
* Added help module.
2012.04.22, v0.2.0

View file

@ -2,6 +2,7 @@
"edit/_codemirror",
"menu",
"view",
"help",
"terminal", {
"name": "storage",
"data": [{

67
lib/client/help.js Normal file
View file

@ -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);

View file

@ -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
]);