mirror of
https://github.com/coderaiser/cloudcmd.git
synced 2026-01-23 10:45:47 +00:00
added ability to view any file
This commit is contained in:
parent
6b8b56b56c
commit
72736e7d3b
4 changed files with 42 additions and 41 deletions
|
|
@ -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
|
||||
|
||||
|
|
|
|||
|
|
@ -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;
|
||||
}
|
||||
});
|
||||
});
|
||||
|
|
|
|||
|
|
@ -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);
|
||||
|
|
|
|||
|
|
@ -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('<div>' + data + '</div>', lConfig);
|
||||
$.fancybox('<div>' + data + '</div>', 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);
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue