mirror of
https://github.com/coderaiser/cloudcmd.git
synced 2026-01-24 03:05:41 +00:00
refactor(cloudcmd) constructor init: public -> private
This commit is contained in:
parent
52991e1047
commit
2fef19c76e
8 changed files with 52 additions and 47 deletions
|
|
@ -107,7 +107,10 @@ var Util, DOM, CloudFunc, CloudCmd;
|
|||
|
||||
return DOM.jsload(CloudCmd.LIBDIRCLIENT + lPath, lFunc ||
|
||||
function() {
|
||||
Util.exec(CloudCmd[lName].init, pArg);
|
||||
var Proto = CloudCmd[lName];
|
||||
|
||||
if (Util.isFunction(Proto))
|
||||
CloudCmd[lName] = new Proto(pArg);
|
||||
});
|
||||
};
|
||||
}
|
||||
|
|
@ -186,7 +189,8 @@ var Util, DOM, CloudFunc, CloudCmd;
|
|||
/* привязываем клавиши к функциям */
|
||||
path : 'key.js',
|
||||
func : function() {
|
||||
Key = CloudCmd.Key;
|
||||
Key = new CloudCmd.Key();
|
||||
CloudCmd.Key = Key;
|
||||
Key.bind();
|
||||
}
|
||||
});
|
||||
|
|
|
|||
|
|
@ -2,9 +2,9 @@ var CloudCmd, Util, DOM;
|
|||
(function(CloudCmd, Util, DOM){
|
||||
'use strict';
|
||||
|
||||
CloudCmd.Config = new ConfigProto(CloudCmd, Util, DOM);
|
||||
CloudCmd.Config = ConfigProto;
|
||||
|
||||
function ConfigProto(CloudCmd, Util, DOM){
|
||||
function ConfigProto() {
|
||||
var Key = CloudCmd.Key,
|
||||
Images = DOM.Images,
|
||||
Events = DOM.Events,
|
||||
|
|
@ -13,7 +13,7 @@ var CloudCmd, Util, DOM;
|
|||
TEMPLATE,
|
||||
Config = this;
|
||||
|
||||
this.init = function(pCallBack){
|
||||
function init(pCallBack) {
|
||||
Util.loadOnLoad([
|
||||
Config.show,
|
||||
CloudCmd.View,
|
||||
|
|
@ -21,9 +21,7 @@ var CloudCmd, Util, DOM;
|
|||
|
||||
DOM.Events.addKey(listener);
|
||||
DOM.setButtonKey('f10', Config.show);
|
||||
|
||||
delete Config.init;
|
||||
};
|
||||
}
|
||||
|
||||
this.show = function() {
|
||||
var funcs = [
|
||||
|
|
@ -146,6 +144,8 @@ var CloudCmd, Util, DOM;
|
|||
if (keyCode === ESC)
|
||||
Config.hide();
|
||||
}
|
||||
|
||||
init();
|
||||
}
|
||||
|
||||
})(CloudCmd, Util, DOM);
|
||||
|
|
|
|||
|
|
@ -7,9 +7,9 @@ var CloudCmd, Util, DOM, $;
|
|||
error : ''
|
||||
};
|
||||
|
||||
CloudCmd.Console = new ConsoleProto(CloudCmd, Util, DOM);
|
||||
CloudCmd.Console = ConsoleProto;
|
||||
|
||||
function ConsoleProto(CloudCmd, Util, DOM) {
|
||||
function ConsoleProto(CallBack) {
|
||||
var Name = 'Console',
|
||||
Loading,
|
||||
jqconsole,
|
||||
|
|
@ -19,7 +19,7 @@ var CloudCmd, Util, DOM, $;
|
|||
Images = DOM.Images,
|
||||
Console = this;
|
||||
|
||||
this.init = function(pCallBack) {
|
||||
function init() {
|
||||
var lFunc, lIsFunc = Util.isFunction(CloudCmd.View);
|
||||
|
||||
Loading = true;
|
||||
|
|
@ -39,9 +39,7 @@ var CloudCmd, Util, DOM, $;
|
|||
|
||||
DOM.Events.addKey(listener);
|
||||
DOM.setButtonKey('~', Console.show);
|
||||
|
||||
delete Console.init;
|
||||
};
|
||||
}
|
||||
|
||||
this.show = function() {
|
||||
if (!Loading) {
|
||||
|
|
@ -170,6 +168,8 @@ var CloudCmd, Util, DOM, $;
|
|||
}
|
||||
|
||||
}
|
||||
|
||||
init();
|
||||
}
|
||||
|
||||
})(CloudCmd, Util, DOM);
|
||||
|
|
|
|||
|
|
@ -2,9 +2,9 @@ var CloudCmd, Util, DOM, CloudFunc, ace, DiffProto, diff_match_patch;
|
|||
(function(CloudCmd, Util, DOM, CloudFunc) {
|
||||
'use strict';
|
||||
|
||||
CloudCmd.Edit = new EditProto(CloudCmd, Util, DOM, CloudFunc);
|
||||
CloudCmd.Edit = EditProto;
|
||||
|
||||
function EditProto(CloudCmd, Util, DOM, CloudFunc) {
|
||||
function EditProto(CallBack) {
|
||||
var Name = 'Edit',
|
||||
Loading = false,
|
||||
DIR = CloudCmd.LIBDIRCLIENT + 'edit/',
|
||||
|
|
@ -19,7 +19,7 @@ var CloudCmd, Util, DOM, CloudFunc, ace, DiffProto, diff_match_patch;
|
|||
|
||||
Element;
|
||||
|
||||
this.init = function(pCallBack) {
|
||||
function init() {
|
||||
var lFunc, lIsFunc = Util.isFunction(CloudCmd.View);
|
||||
|
||||
Loading = true;
|
||||
|
|
@ -36,9 +36,7 @@ var CloudCmd, Util, DOM, CloudFunc, ace, DiffProto, diff_match_patch;
|
|||
|
||||
DOM.Events.addKey(listener);
|
||||
DOM.setButtonKey('f4', Edit.show);
|
||||
|
||||
delete Edit.init;
|
||||
};
|
||||
}
|
||||
|
||||
this.show = function(pValue) {
|
||||
var lName = DOM.getCurrentName(),
|
||||
|
|
@ -222,6 +220,8 @@ var CloudCmd, Util, DOM, CloudFunc, ace, DiffProto, diff_match_patch;
|
|||
DOM.show(Msg);
|
||||
setTimeout(Util.retExec(DOM.hide, Msg), 2000);
|
||||
};
|
||||
|
||||
init();
|
||||
}
|
||||
|
||||
})(CloudCmd, Util, DOM, CloudFunc);
|
||||
|
|
|
|||
|
|
@ -2,14 +2,14 @@ var CloudCmd, Util, DOM;
|
|||
(function(CloudCmd, Util, DOM){
|
||||
'use strict';
|
||||
|
||||
CloudCmd.Help = new HelpProto(CloudCmd, Util, DOM);
|
||||
CloudCmd.Help = HelpProto;
|
||||
|
||||
function HelpProto(CloudCmd, Util, DOM){
|
||||
function HelpProto(CallBack){
|
||||
var Key = CloudCmd.Key,
|
||||
Images = DOM.Images,
|
||||
Help = this;
|
||||
|
||||
this.init = function(pCallBack) {
|
||||
function init() {
|
||||
Util.loadOnLoad([
|
||||
Help.show,
|
||||
CloudCmd.View,
|
||||
|
|
@ -17,9 +17,7 @@ var CloudCmd, Util, DOM;
|
|||
|
||||
DOM.Events.addKey(listener);
|
||||
DOM.setButtonKey('f1', Help.show);
|
||||
|
||||
delete Help.init;
|
||||
};
|
||||
}
|
||||
|
||||
this.show = function() {
|
||||
Images.showLoad({top:true});
|
||||
|
|
@ -77,6 +75,8 @@ var CloudCmd, Util, DOM;
|
|||
if (lIsBind && lKey === lF1)
|
||||
Help.show();
|
||||
}
|
||||
|
||||
init();
|
||||
}
|
||||
|
||||
})(CloudCmd, Util, DOM);
|
||||
})(CloudCmd, Util, DOM);
|
||||
|
|
|
|||
|
|
@ -45,9 +45,9 @@ var CloudCmd, Util, DOM;
|
|||
};
|
||||
|
||||
KeyProto.prototype = KEY;
|
||||
CloudCmd.Key = new KeyProto(CloudCmd, Util, DOM);
|
||||
CloudCmd.Key = KeyProto;
|
||||
|
||||
function KeyProto(CloudCmd, Util, DOM) {
|
||||
function KeyProto() {
|
||||
var Key = this,
|
||||
Binded,
|
||||
lTabPanel = {
|
||||
|
|
|
|||
|
|
@ -6,9 +6,9 @@ var CloudCmd, Util, DOM, CloudFunc, $;
|
|||
(function(CloudCmd, Util, DOM, CloudFunc){
|
||||
'use strict';
|
||||
|
||||
CloudCmd.Menu = new MenuProto(CloudCmd, Util, DOM, CloudFunc);
|
||||
CloudCmd.Menu = MenuProto;
|
||||
|
||||
function MenuProto(CloudCmd, Util, DOM, CloudFunc) {
|
||||
function MenuProto(pPosition) {
|
||||
var Name = 'Menu',
|
||||
Loading = false,
|
||||
Key = CloudCmd.Key,
|
||||
|
|
@ -20,7 +20,7 @@ var CloudCmd, Util, DOM, CloudFunc, $;
|
|||
|
||||
this.ENABLED = false;
|
||||
|
||||
this.init = function(pPosition){
|
||||
function init() {
|
||||
Loading = true;
|
||||
|
||||
Position = pPosition;
|
||||
|
|
@ -39,9 +39,7 @@ var CloudCmd, Util, DOM, CloudFunc, $;
|
|||
|
||||
Events.dispatch('contextmenu', lCurrent);
|
||||
});
|
||||
|
||||
delete Menu.init;
|
||||
};
|
||||
}
|
||||
|
||||
this.show = function() {
|
||||
if (!Loading) {
|
||||
|
|
@ -320,5 +318,7 @@ var CloudCmd, Util, DOM, CloudFunc, $;
|
|||
else if (lKey === lESC)
|
||||
Key.setBind();
|
||||
}
|
||||
|
||||
init();
|
||||
}
|
||||
})(CloudCmd, Util, DOM, CloudFunc);
|
||||
|
|
|
|||
|
|
@ -3,9 +3,9 @@ var CloudCmd, Util, DOM, CloudFunc, $;
|
|||
(function(CloudCmd, Util, DOM, CloudFunc){
|
||||
'use strict';
|
||||
|
||||
CloudCmd.View = new ViewProto(CloudCmd, Util, DOM, CloudFunc);
|
||||
CloudCmd.View = ViewProto;
|
||||
|
||||
function ViewProto(CloudCmd, Util, DOM, CloudFunc){
|
||||
function ViewProto(CallBack) {
|
||||
var Name = 'View',
|
||||
Loading = false,
|
||||
Key = CloudCmd.Key,
|
||||
|
|
@ -42,19 +42,20 @@ var CloudCmd, Util, DOM, CloudFunc, $;
|
|||
padding : 0
|
||||
};
|
||||
|
||||
this.init = function(pCallBack) {
|
||||
function init() {
|
||||
var lFunc, lIsFunc, lIsCallBack;
|
||||
|
||||
Loading = true;
|
||||
if (pCallBack){
|
||||
lIsFunc = Util.isFunction(pCallBack);
|
||||
lIsCallBack = Util.isFunction(pCallBack.callback);
|
||||
|
||||
if (CallBack){
|
||||
lIsFunc = Util.isFunction(CallBack);
|
||||
lIsCallBack = Util.isFunction(CallBack.callback);
|
||||
}
|
||||
|
||||
if (lIsFunc)
|
||||
lFunc = pCallBack;
|
||||
lFunc = CallBack;
|
||||
else if (lIsCallBack)
|
||||
lFunc = pCallBack.callback;
|
||||
lFunc = CallBack.callback;
|
||||
|
||||
Util.loadOnLoad([
|
||||
lFunc || Util.retExec(View.show, null),
|
||||
|
|
@ -64,9 +65,7 @@ var CloudCmd, Util, DOM, CloudFunc, $;
|
|||
|
||||
DOM.Events.addKey(listener);
|
||||
DOM.setButtonKey('f3', view);
|
||||
|
||||
delete View.init;
|
||||
};
|
||||
}
|
||||
|
||||
/**
|
||||
* function shows FancyBox
|
||||
|
|
@ -168,6 +167,8 @@ var CloudCmd, Util, DOM, CloudFunc, $;
|
|||
DOM.preventDefault(pEvent);
|
||||
}
|
||||
}
|
||||
|
||||
init();
|
||||
}
|
||||
|
||||
})(CloudCmd, Util, DOM, CloudFunc);
|
||||
})(CloudCmd, Util, DOM, CloudFunc);
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue