on f4 on folder CodeMirror opens json data of folder

This commit is contained in:
coderaiser 2012-08-02 07:39:50 -04:00
parent d993be8603
commit 760e87cfec
2 changed files with 33 additions and 8 deletions

View file

@ -495,7 +495,7 @@ CloudClient._changeLinks = function(pPanelID)
if(a[i].target !== '_blank')
{
/* убираем адрес хоста*/
var link='/'+a[i].href.replace(document.location.href,'');
var link='/'+a[i].href.replace(document.location.href,'');
/* убираем значения, которые говорят,
* об отсутствии js
*/
@ -635,7 +635,7 @@ CloudClient._ajaxLoad=function(path, pNeedRefresh)
/* переводим таблицу файлов в строку, для
* сохранения в localStorage
*/
var lJSON_s=JSON.stringify(data);
var lJSON_s = JSON.stringify(data);
console.log(lJSON_s.length);
/* если размер данных не очень бошьой

View file

@ -1,4 +1,4 @@
var CloudCommander, CodeMirror;
var CloudCommander, CloudFunc, CodeMirror;
/* object contains editors CodeMirror
* and later will be Ace
*/
@ -86,11 +86,32 @@ CloudCommander.Editor.CodeMirror = {
var lA;
if(lCurrent.length){
lCurrent = lCurrent[0];
lA = lCurrent.getElementsByTagName('a');
/* getting link */
lA = lCurrent.getElementsByTagName('a');
if(!lA.length)
return console.log('Error:' +
'can not find links in current file');
lA = lA[0].href;
/* убираем адрес хоста*/
lA = '/' + lA.replace(document.location.href,'');
/* checking is this link is to directory */
var lSize = lCurrent.getElementsByClassName('size');
if(lSize){
lSize = lSize[0].textContent;
if(lA.length)
lA = lA[0].href;
/* if directory - load json
* not html data
*/
if (lSize === '<dir>'){
if (lA.indexOf(CloudFunc.NOJS) ===
CloudFunc.FS.length){
lA = lA.replace(CloudFunc.NOJS, '');
}
}
}
}
/* показываем гиф загрузки возле пути папки сверху*/
@ -116,7 +137,11 @@ CloudCommander.Editor.CodeMirror = {
console.log(jqXHR.responseText);
},
success:function(data, textStatus, jqXHR){
success:function(data, textStatus, jqXHR){
/* if we got json - show it */
if(typeof data === 'object')
data = JSON.stringify(data);
initCodeMirror_f(data);
CloudCommander.keyBinded = false;