From c67f0c0e681735461bf6e75fb5bcfb5028e9939d Mon Sep 17 00:00:00 2001 From: coderaiser Date: Thu, 26 Jul 2012 05:02:18 -0400 Subject: [PATCH] added copy of fancybox for offline mode --- lib/client/viewer.js | 31 +++++++++++++++++++++++++------ 1 file changed, 25 insertions(+), 6 deletions(-) diff --git a/lib/client/viewer.js b/lib/client/viewer.js index 0c66f162..78473c7a 100644 --- a/lib/client/viewer.js +++ b/lib/client/viewer.js @@ -2,10 +2,15 @@ var CloudCommander, CloudFunc, $; /* object contains viewer FancyBox * https://github.com/fancyapps/fancyBox */ -CloudCommander.Viewer = {getByClass : function(pClass){ +CloudCommander.Viewer = { + dir : CloudCommander.LIBDIRCLIENT + 'viewer/', + + getByClass : function(pClass){ return document.getElementsByClassName(pClass); - }}; -CloudCommander.Viewer.FancyBox = { + } +}; +CloudCommander.Viewer.FancyBox = { + dir : CloudCommander.Viewer.dir + 'fancybox/', /* function return configureation * for FancyBox open and * onclick (it shoud be @@ -36,15 +41,29 @@ CloudCommander.Viewer.FancyBox = { }), load: function(){ var ljsLoad_f = function(){ - CloudCommander.jsload( - 'http://fancyapps.com/fancybox/source/jquery.fancybox.pack.js'); + CloudCommander.jsload( + 'http://fancyapps.com/fancybox/source/jquery.fancybox.pack.js',{ + onerror: (function(){ + CloudCommander.jsload(this.dir + + 'jquery.fancybox.pack.js'); + }) + }); }; CloudCommander.cssLoad({ src : 'http://fancyapps.com/fancybox/source/jquery.fancybox.css', - func : ljsLoad_f + 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;