mirror of
https://github.com/coderaiser/cloudcmd.git
synced 2026-07-19 01:17:18 +00:00
on f4 on folder CodeMirror opens json data of folder
This commit is contained in:
parent
d993be8603
commit
760e87cfec
2 changed files with 33 additions and 8 deletions
|
|
@ -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);
|
||||
|
||||
/* если размер данных не очень бошьой
|
||||
|
|
|
|||
|
|
@ -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;
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue