diff --git a/ChangeLog b/ChangeLog index d76bcf0d..140f7ed0 100644 --- a/ChangeLog +++ b/ChangeLog @@ -44,6 +44,7 @@ current, file that was previously current must be unset automatically. * Fixed bug with refreshing directory, from now current file would not be seeted up to first, after refresh. +* Added ability to view any file. 2012.08.06, Version 0.1.5 diff --git a/lib/client/editor.js b/lib/client/editor.js index 91379e79..1ca7d509 100644 --- a/lib/client/editor.js +++ b/lib/client/editor.js @@ -83,7 +83,7 @@ CloudCommander.Editor.CodeMirror.show = (function(){ */ var lReadOnly = false; - var lParent = this; + var lThis = this; var initCodeMirror_f = function(pValue){ CodeMirror(lCloudEditor,{ mode : 'javascript', @@ -95,7 +95,7 @@ CloudCommander.Editor.CodeMirror.show = (function(){ autofocus : true, extraKeys: { //Сохранение - "Esc": lParent.hide(lParent) + "Esc": lThis.hide(lThis) }, readOnly : lReadOnly }); @@ -115,7 +115,7 @@ CloudCommander.Editor.CodeMirror.show = (function(){ lA = '/' + lA.replace(document.location.href,''); /* checking is this link is to directory */ - var lSize = lCurrent.getElementsByClassName('size'); + var lSize = this.getByClass('size', lCurrent); if(lSize){ lSize = lSize[0].textContent; @@ -134,15 +134,15 @@ CloudCommander.Editor.CodeMirror.show = (function(){ this.loading = true; setTimeout(function(){ - lParent.loading = false;}, + lThis.loading = false;}, 400); /* reading data from current file */ $.ajax({ url:lA, error: (function(jqXHR, textStatus, errorThrown){ - lParent.loading = false; - return lParent.Images.showError(jqXHR, textStatus, errorThrown); + lThis.loading = false; + return lThis.Images.showError(jqXHR, textStatus, errorThrown); }), success:function(data, textStatus, jqXHR){ @@ -155,10 +155,10 @@ CloudCommander.Editor.CodeMirror.show = (function(){ /* removing keyBinding if set */ CloudCommander.keyBinded = false; - lParent.hidePanel(); - lParent.Images.hideLoad(); + lThis.hidePanel(); + lThis.Images.hideLoad(); - lParent.loading = false; + lThis.loading = false; } }); }); diff --git a/lib/client/keyBinding.js b/lib/client/keyBinding.js index 749c55b5..46e25481 100644 --- a/lib/client/keyBinding.js +++ b/lib/client/keyBinding.js @@ -128,16 +128,15 @@ CloudCommander.keyBinding = (function(){ * если она не заголовок * файловой таблицы */ - if(lCurrentFile.previousSibling && - lCurrentFile.previousSibling.className!=='fm_header' ){ - + lCurrentFile = lCurrentFile.previousSibling; + if(lCurrentFile){ /* выделяем предыдущую строку*/ - Util.setCurrentFile(lCurrentFile.previousSibling); - + Util.setCurrentFile(lCurrentFile); + /* scrolling to current file*/ - if(lCurrentFile.previousSibling) - lCurrentFile.previousSibling - .scrollIntoViewIfNeeded(); + lCurrentFile = lCurrentFile.previousSibling; + if(lCurrentFile) + lCurrentFile.scrollIntoViewIfNeeded(); } event.preventDefault();//запрет на дальнейшее действие @@ -174,8 +173,7 @@ CloudCommander.keyBinding = (function(){ * выделяем верхий файл */ Util.setCurrentFile(lCurrentFile - .parentElement.firstElementChild - .nextElementSibling.nextElementSibling); + .parentElement.children[2]); /* move scrollbar to top */ Util.getPanel().scrollByLines(-100000000000000); diff --git a/lib/client/viewer.js b/lib/client/viewer.js index d25e00ce..16705f0b 100644 --- a/lib/client/viewer.js +++ b/lib/client/viewer.js @@ -47,28 +47,29 @@ CloudCommander.Viewer.FancyBox.getConfig = (function(){ * @pParent - this * @pCallBack - executes, when everything loaded */ -CloudCommander.Viewer.FancyBox.load = (function(pParent, pCallBack){ - return function(){ - var ljsLoad_f = function(){ - var lSrc = pParent.dir + 'jquery.fancybox.pack.js'; - pParent.jsload(lSrc,{ - onload: pCallBack - }); - }; - - var lSrc = pParent.dir +'jquery.fancybox.pack.css'; - pParent.cssLoad({ - src : lSrc, - func : { - onload: ljsLoad_f - } +CloudCommander.Viewer.FancyBox.load = (function(pThis, pCallBack){ + var ljsLoad_f = function(){ + var lSrc = pThis.dir + 'jquery.fancybox.pack.js'; + pThis.jsload(lSrc,{ + onload: pCallBack }); - }(); + }; + + var lSrc = pThis.dir +'jquery.fancybox.pack.css'; + pThis.cssLoad({ + src : lSrc, + func : { + onload: ljsLoad_f + } + }); }); CloudCommander.Viewer.FancyBox.loadData = (function(pA){ var lThis = this; var lConfig = this.getConfig(); + + this.Images.showLoad(); + $.ajax({ url : pA.href, error : (function(jqXHR, textStatus, errorThrown){ @@ -81,7 +82,7 @@ CloudCommander.Viewer.FancyBox.loadData = (function(pA){ if(typeof data === 'object') data = JSON.stringify(data, null, 4); - $.funcybox('
' + data + '
', lConfig); + $.fancybox('
' + data + '
', lConfig); lThis.Images.hideLoad(); } @@ -104,9 +105,10 @@ CloudCommander.Viewer.FancyBox.set = (function(){ return function(){ var lConfig = lThis.getConfig(); lConfig.href = pA.href; - if(pA.href) + if(pA.rel) $.fancybox(lConfig); - else lThis.loadData(pA); + else + lThis.loadData(pA); }; }; @@ -119,7 +121,7 @@ CloudCommander.Viewer.FancyBox.set = (function(){ lA[i].rel = 'gallery'; } - lA[i].ondblclick = lDblClick_f(lA); + lA[i].ondblclick = lDblClick_f(lA[i]); } }catch(pError){ @@ -133,10 +135,10 @@ CloudCommander.Viewer.FancyBox.show = (function(pParent){ CloudCommander.Viewer.FancyBox.set(); var lCurrent = this.getCurrentFile(); - var lA = this.getByClass('fancybox', lCurrent); + var lA = this.getByClass('fancybox', lCurrent)[0]; var lConfig = this.getConfig(); - if(lA.length){ + if(lA){ if(lA.rel) $.fancybox.open({ href : lA[0].href }, lConfig);