refactor(view) View: this -> Util.exec

This commit is contained in:
coderaiser 2013-12-30 08:15:57 +00:00
parent 69cef5f7b8
commit cd2846ef5f
4 changed files with 13 additions and 31 deletions

View file

@ -16,23 +16,15 @@ var CloudCmd, Util, DOM;
Config = this;
function init(pCallBack) {
var func,
isFunc = Util.isFunction(CloudCmd.View);
Loading = true;
if (isFunc)
func = CloudCmd.View;
else
func = Util.exec;
Util.loadOnLoad([
Config.show,
function(callback) {
Loading = false;
Util.exec(callback);
},
func,
CloudCmd.View,
]);
DOM.Events.addKey(listener);

View file

@ -21,19 +21,12 @@ var CloudCmd, Util, DOM, CloudFunc, $;
Console = this;
function init() {
var lFunc, lIsFunc = Util.isFunction(CloudCmd.View);
Loading = true;
if (lIsFunc)
lFunc = CloudCmd.View;
else
lFunc = Util.exec;
Util.loadOnLoad([
Console.show,
load,
lFunc,
CloudCmd.View,
DOM.jqueryLoad,
DOM.socketLoad
]);

View file

@ -23,18 +23,11 @@ var CloudCmd, Util, DOM, CloudFunc, ace, DiffProto, diff_match_patch;
Element;
function init() {
var lFunc, lIsFunc = Util.isFunction(CloudCmd.View);
Loading = true;
if (lIsFunc)
lFunc = CloudCmd.View;
else
lFunc = Util.exec;
Util.loadOnLoad([
Edit.show,
load,
lFunc
CloudCmd.View
]);
DOM.Events.addKey(listener);

View file

@ -11,7 +11,7 @@ var CloudCmd, Util, DOM, CloudFunc, $;
Info = DOM.CurrentInfo,
Key = CloudCmd.Key,
Images = DOM.Images,
View = this,
View = Util.exec,
Element,
Config = {
@ -43,6 +43,9 @@ var CloudCmd, Util, DOM, CloudFunc, $;
padding : 0
};
View.show = show;
View.hide = hide;
function init() {
var lFunc, lIsFunc, lIsCallBack;
@ -71,7 +74,7 @@ var CloudCmd, Util, DOM, CloudFunc, $;
/**
* function shows FancyBox
*/
this.show = function(pData, pCallBack, pConfig) {
function show(pData, pCallBack, pConfig) {
var lPath, lElement, lAfterFunc, lFunc, name,
config = {};
@ -107,15 +110,14 @@ var CloudCmd, Util, DOM, CloudFunc, $;
});
}
}
};
}
this.hide = function() {
function hide() {
$.fancybox.close();
};
}
/**
* function loads css and js of FancyBox
* @pParent - this
* @pCallBack - executes, when everything loaded
*/
function load(pCallBack) {
@ -171,6 +173,8 @@ var CloudCmd, Util, DOM, CloudFunc, $;
}
init();
return View;
}
})(CloudCmd, Util, DOM, CloudFunc);