From ecb92640a265bbf6921f65acadeb31dc41a4c078 Mon Sep 17 00:00:00 2001 From: coderaiser Date: Wed, 25 Jul 2012 04:48:33 -0400 Subject: [PATCH] added show function --- lib/client/viewer.js | 38 ++++++++++++++++++++++++++++++++++++-- 1 file changed, 36 insertions(+), 2 deletions(-) diff --git a/lib/client/viewer.js b/lib/client/viewer.js index fa2d4e1d..3b0a9786 100644 --- a/lib/client/viewer.js +++ b/lib/client/viewer.js @@ -1,4 +1,4 @@ -var CloudCommander, FuncyBox; +var CloudCommander, CloudFunc; /* object contains viewer FuncyBox * https://github.com/fancyapps/fancyBox */ @@ -10,6 +10,40 @@ CloudCommander.Viewer.FuncyBox = { src : 'http://fancyapps.com/fancybox/source/jquery.fancybox.css' }); - CloudCommander.jsload('http://fancyapps.com/fancybox/source/jquery.fancybox.pack.js'); + CloudCommander.jsload( + 'http://fancyapps.com/fancybox/source/jquery.fancybox.pack.js', + function(){ + $(".fancybox").fancybox({ + openEffect : 'none', + closeEffect : 'none' + }); + }); + + }, + show: function(){ + try{ + /* get current panel (left or right) */ + var lPanel = this.getByClass('current-file'); + + lPanel.length && + (lPanel = lPanel[0].parentElement); + + /* get all file links */ + var lA = lPanel.getElementsByTagName('a'); + + var lName; + for (var i; i < lA.length; i++) { + lName = lA[i].title || lA[i].textContent; + + CloudFunc.checkExtension(lName,'png') && + (lA[i].className = 'fancybox'); + } + }catch(pError){ + console.log(pError); + } + }, + getById : function(pId){return document.getElementById(pId);}, + getByClass : function(pClass){ + return document.getElemenstByClassName(pClass); } }; \ No newline at end of file