From abeb01ac6181a8d619c993024251bc71b4d12279 Mon Sep 17 00:00:00 2001 From: coderaiser Date: Thu, 26 Jul 2012 05:08:16 -0400 Subject: [PATCH] fixed bug with load int offline mode --- lib/client/viewer.js | 47 ++++++++++++++++++++++---------------------- 1 file changed, 24 insertions(+), 23 deletions(-) diff --git a/lib/client/viewer.js b/lib/client/viewer.js index 78473c7a..59cfa06d 100644 --- a/lib/client/viewer.js +++ b/lib/client/viewer.js @@ -39,31 +39,32 @@ CloudCommander.Viewer.FancyBox = { padding : 0 }; }), - load: function(){ - var ljsLoad_f = function(){ - CloudCommander.jsload( - 'http://fancyapps.com/fancybox/source/jquery.fancybox.pack.js',{ + load:(function(pParent){ + return function(){ + var ljsLoad_f = function(){ + CloudCommander.jsload( + 'http://fancyapps.com/fancybox/source/jquery.fancybox.pack.js',{ + onerror: (function(){ + CloudCommander.jsload(pParent.dir + + 'jquery.fancybox.pack.js'); + }) + }); + }; + + CloudCommander.cssLoad({ + src : 'http://fancyapps.com/fancybox/source/jquery.fancybox.css', + func : { + onload: ljsLoad_f, onerror: (function(){ - CloudCommander.jsload(this.dir + - 'jquery.fancybox.pack.js'); + CloudCommander.cssLoad({ + src : pParent +'jquery.fancybox.css', + func : ljsLoad_f + }); }) + } }); - }; - - CloudCommander.cssLoad({ - src : 'http://fancyapps.com/fancybox/source/jquery.fancybox.css', - func : { - onload: ljsLoad_f, - onerror: (function(){ - CloudCommander.cssLoad({ - src : this.dir +'jquery.fancybox.css', - func : ljsLoad_f - }); - }) - } - }); - }, - + }, + }), set: function(){ if(this.getByClass('fancybox').length) return; @@ -100,7 +101,7 @@ CloudCommander.Viewer.FancyBox = { CloudCommander.Viewer.Keys = (function(){ "use strict"; - CloudCommander.Viewer.FancyBox.load(); + CloudCommander.Viewer.FancyBox.load(this.FancyBox); var key_event = function(pParent){ return function(event){