feature(view) show(pData) -> show(pData, pCallBack)

This commit is contained in:
coderaiser 2013-06-23 03:34:18 -04:00
parent 66ef086561
commit f461d99fc4

View file

@ -9,6 +9,7 @@ var CloudCmd, Util, DOM, CloudFunc, $;
var Key = CloudCmd.Key,
Images = DOM.Images,
View = this,
Element,
Config = {
beforeShow : function(){
@ -16,9 +17,7 @@ var CloudCmd, Util, DOM, CloudFunc, $;
Key.unsetBind();
},
afterShow : function(){
var lEditor = DOM.getById('View');
if(lEditor)
lEditor.focus();
Element.focus();
},
beforeClose : Key.setBind,
@ -53,20 +52,31 @@ var CloudCmd, Util, DOM, CloudFunc, $;
/**
* function shows FancyBox
*/
this.show = function(pData){
var lPath;
this.show = function(pData, pCallBack){
var lPath, lElement,
lAfterFunc, lFunc;
if(pData)
$.fancybox(pData, Config);
else {
lPath = CloudFunc.FS + DOM.getCurrentPath();
Element = $('<div id=view tabindex=0>');
if(pData) {
lElement = $(Element).append(pData);
lAfterFunc = Config.afterShow,
lFunc = function(){
Util.exec(lAfterFunc);
Util.exec(pCallBack);
};
Config.afterShow = lFunc;
$.fancybox(lElement, Config);
} else {
lPath = CloudFunc.FS + DOM.getCurrentPath();
if( Util.checkExtension(lPath, ['png','jpg', 'gif','ico']) ) {
$.fancybox.open({ href : lPath }, Config);
}
else
DOM.getCurrentData(function(pParams){
$.fancybox('<div id=view tabindex=0>' +
pParams.data + '</div>', Config);
$.fancybox( Element.append(pParams.data), Config );
});
}
};