diff --git a/client.js b/client.js index 79514ead..da99e32b 100644 --- a/client.js +++ b/client.js @@ -347,11 +347,12 @@ CloudClient.Util = (function(){ element.onerror = (function(){ (pParams_o.parent || document.body) .removeChild(element); - + Util.Images.showError({ responseText: 'file ' + lSrc + - ' could not be loaded' + ' could not be loaded', + status : 404 }); if(lFunc && lFunc.onerror && diff --git a/lib/client/viewer.js b/lib/client/viewer.js index c984d3a8..a0760fc1 100644 --- a/lib/client/viewer.js +++ b/lib/client/viewer.js @@ -3,28 +3,27 @@ var CloudCommander, CloudFunc, $; * https://github.com/fancyapps/fancyBox */ (function(){ - var cloudcmd = CloudCommander; - var Util = cloudcmd.Util; - var KeyBinding = cloudcmd.KeyBinding; + var cloudcmd = CloudCommander; + var Util = cloudcmd.Util; + var KeyBinding = cloudcmd.KeyBinding; - CloudCommander.Viewer = { + CloudCommander.Viewer = { get: (function(){ return this.FancyBox; }) }; - CloudCommander.Viewer.FancyBox = {}; + var FancyBox = {}; - CloudCommander.Viewer.dir = './lib/client/viewer/'; - CloudCommander.Viewer.FancyBox.dir = CloudCommander.Viewer.dir + - 'fancybox/'; + cloudcmd.Viewer.dir = './lib/client/viewer/'; + FancyBox.dir = cloudcmd.Viewer.dir + 'fancybox/'; /* function return configureation * for FancyBox open and * onclick (it shoud be * different objects) */ - CloudCommander.Viewer.FancyBox.getConfig = (function(){ + FancyBox.getConfig = (function(){ return{ /* function do her work * before FauncyBox shows @@ -63,7 +62,7 @@ var CloudCommander, CloudFunc, $; * @pParent - this * @pCallBack - executes, when everything loaded */ - CloudCommander.Viewer.FancyBox.load = (function(pThis, pCallBack){ + FancyBox.load = (function(pThis, pCallBack){ Util.jqueryLoad(); var ljsLoad_f = function(){ @@ -95,7 +94,7 @@ var CloudCommander, CloudFunc, $; }); - CloudCommander.Viewer.FancyBox.loadData = (function(pA){ + FancyBox.loadData = (function(pA){ Util.Images.showLoad(); var lThis = this; @@ -129,7 +128,7 @@ var CloudCommander, CloudFunc, $; }); - CloudCommander.Viewer.FancyBox.set = (function(){ + FancyBox.set = (function(){ if(Util.getByClass('fancybox').length) return; try{ @@ -170,8 +169,8 @@ var CloudCommander, CloudFunc, $; }); - CloudCommander.Viewer.FancyBox.show = (function(pCurrentFile){ - CloudCommander.Viewer.FancyBox.set(); + FancyBox.show = (function(pCurrentFile){ + FancyBox.set(); var lConfig = this.getConfig(); @@ -192,7 +191,7 @@ var CloudCommander, CloudFunc, $; Util.Images.hideLoad(); }); - CloudCommander.Viewer.Keys = (function(pCurrentFile){ + cloudcmd.Viewer.Keys = (function(pCurrentFile){ "use strict"; var lCallBack_f = (function(){ @@ -200,10 +199,10 @@ var CloudCommander, CloudFunc, $; /* если клавиши можно обрабатывать */ if( KeyBinding.get() ) /* if f3 pressed */ - if(pEvent.keyCode === CloudCommander.KEY.F3 && + if(pEvent.keyCode === cloudcmd.KEY.F3 && pEvent.shiftKey){ var lCurrentFile = Util.getCurrentFile(); - CloudCommander.Viewer.FancyBox.show(lCurrentFile); + FancyBox.show(lCurrentFile); pEvent.preventDefault(); } @@ -227,10 +226,12 @@ var CloudCommander, CloudFunc, $; } /* showing images preview*/ - CloudCommander.Viewer.FancyBox.show(pCurrentFile); + FancyBox.show(pCurrentFile); Util.Images.hideLoad(); }); - CloudCommander.Viewer.FancyBox.load(this.FancyBox, lCallBack_f); + FancyBox.load(this.FancyBox, lCallBack_f); }); + + cloudcmd.Viewer.FancyBox = FancyBox; })(); \ No newline at end of file