mirror of
https://github.com/coderaiser/cloudcmd.git
synced 2026-01-23 10:45:47 +00:00
added help module
This commit is contained in:
parent
9e62551a34
commit
53d7a0cb7b
4 changed files with 72 additions and 1 deletions
|
|
@ -58,6 +58,8 @@ getJSONfromFileTable.
|
|||
|
||||
* Added ability to put callback to view.
|
||||
|
||||
* Added help module.
|
||||
|
||||
|
||||
2012.04.22, v0.2.0
|
||||
|
||||
|
|
|
|||
|
|
@ -2,6 +2,7 @@
|
|||
"edit/_codemirror",
|
||||
"menu",
|
||||
"view",
|
||||
"help",
|
||||
"terminal", {
|
||||
"name": "storage",
|
||||
"data": [{
|
||||
|
|
|
|||
67
lib/client/help.js
Normal file
67
lib/client/help.js
Normal 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);
|
||||
|
|
@ -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
|
||||
]);
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue