mirror of
https://github.com/coderaiser/cloudcmd.git
synced 2026-07-19 09:24:51 +00:00
added loadData function
This commit is contained in:
parent
307d509d42
commit
6b8b56b56c
1 changed files with 33 additions and 9 deletions
|
|
@ -66,6 +66,28 @@ CloudCommander.Viewer.FancyBox.load = (function(pParent, pCallBack){
|
|||
}();
|
||||
});
|
||||
|
||||
CloudCommander.Viewer.FancyBox.loadData = (function(pA){
|
||||
var lThis = this;
|
||||
var lConfig = this.getConfig();
|
||||
$.ajax({
|
||||
url : pA.href,
|
||||
error : (function(jqXHR, textStatus, errorThrown){
|
||||
lThis.loading = false;
|
||||
return lThis.Images.showError(jqXHR, textStatus, errorThrown);
|
||||
}),
|
||||
|
||||
success:function(data, textStatus, jqXHR){
|
||||
/* if we got json - show it */
|
||||
if(typeof data === 'object')
|
||||
data = JSON.stringify(data, null, 4);
|
||||
|
||||
$.funcybox('<div>' + data + '</div>', lConfig);
|
||||
|
||||
lThis.Images.hideLoad();
|
||||
}
|
||||
});
|
||||
});
|
||||
|
||||
CloudCommander.Viewer.FancyBox.set = (function(){
|
||||
if(this.getByClass('fancybox').length)
|
||||
return;
|
||||
|
|
@ -78,27 +100,26 @@ CloudCommander.Viewer.FancyBox.set = (function(){
|
|||
|
||||
var lThis = this;
|
||||
|
||||
var lDblClick_f = function(pHref, pIsImg){
|
||||
var lDblClick_f = function(pA){
|
||||
return function(){
|
||||
var lConfig = lThis.getConfig();
|
||||
lConfig.href = pHref;
|
||||
if(pIsImg)
|
||||
lConfig.href = pA.href;
|
||||
if(pA.href)
|
||||
$.fancybox(lConfig);
|
||||
else lThis.loadData(pA);
|
||||
};
|
||||
};
|
||||
|
||||
/* first two is not files nor folders*/
|
||||
for (var i=2; i < lA.length; i++) {
|
||||
var lIsImg_b = false;
|
||||
var lName = lA[i].title || lA[i].textContent;
|
||||
|
||||
lA[i].className = 'fancybox';
|
||||
if(CloudFunc.checkExtension(lName, ['png','jpg', 'gif','ico'])){
|
||||
lA[i].rel = 'gallery';
|
||||
var lIsImg_b = true;
|
||||
}
|
||||
|
||||
lA[i].ondblclick = lDblClick_f(lA[i].href, lIsImg_b);
|
||||
lA[i].ondblclick = lDblClick_f(lA);
|
||||
}
|
||||
|
||||
}catch(pError){
|
||||
|
|
@ -115,9 +136,12 @@ CloudCommander.Viewer.FancyBox.show = (function(pParent){
|
|||
var lA = this.getByClass('fancybox', lCurrent);
|
||||
var lConfig = this.getConfig();
|
||||
|
||||
lA.length &&
|
||||
$.fancybox.open({ href : lA[0].href },
|
||||
lConfig);
|
||||
if(lA.length){
|
||||
if(lA.rel)
|
||||
$.fancybox.open({ href : lA[0].href },
|
||||
lConfig);
|
||||
else this.loadData(lA);
|
||||
}
|
||||
});
|
||||
|
||||
CloudCommander.Viewer.Keys = (function(){
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue