mirror of
https://github.com/coderaiser/cloudcmd.git
synced 2026-07-18 17:05:17 +00:00
fix(client) ajaxLoad: do not save path to history if content not load
This commit is contained in:
parent
ce31430f52
commit
4b4b71b9d5
1 changed files with 17 additions and 10 deletions
|
|
@ -331,11 +331,23 @@ var Util, DOM, CloudFunc;
|
|||
var json, str,
|
||||
ret = options && options.refresh,
|
||||
SLASH = '/',
|
||||
dirPath = DOM.getCurrentDirPath(),
|
||||
fsPath = decodeURI(path),
|
||||
noJSONPath = Util.removeStr(fsPath, '?json' ),
|
||||
cleanPath = Util.removeStrOneTime(noJSONPath, CloudFunc.FS) || SLASH,
|
||||
title = CloudFunc.getTitle(cleanPath),
|
||||
oldURL = window.location.pathname;
|
||||
setTitle = function() {
|
||||
var title;
|
||||
|
||||
dirPath = CloudFunc.rmLastSlash(dirPath) || '/';
|
||||
|
||||
if (dirPath !== cleanPath) {
|
||||
if (!options.nohistory)
|
||||
DOM.setHistory(noJSONPath, null, noJSONPath);
|
||||
|
||||
title = CloudFunc.getTitle(cleanPath);
|
||||
DOM.setTitle(title);
|
||||
}
|
||||
};
|
||||
|
||||
if (!options)
|
||||
options = {};
|
||||
|
|
@ -345,11 +357,6 @@ var Util, DOM, CloudFunc;
|
|||
|
||||
Util.log ('reading dir: "' + cleanPath + '";');
|
||||
|
||||
if (!options.nohistory)
|
||||
DOM.setHistory(noJSONPath, null, noJSONPath);
|
||||
|
||||
DOM.setTitle(title);
|
||||
|
||||
/* если доступен localStorage и
|
||||
* в нём есть нужная нам директория -
|
||||
* читаем данные с него и
|
||||
|
|
@ -365,6 +372,7 @@ var Util, DOM, CloudFunc;
|
|||
else {
|
||||
json = Util.parseJSON(str);
|
||||
CloudCmd.createFileTable(json);
|
||||
setTitle();
|
||||
}
|
||||
}
|
||||
|
||||
|
|
@ -372,13 +380,12 @@ var Util, DOM, CloudFunc;
|
|||
DOM.getCurrentFileContent({
|
||||
url : fsPath,
|
||||
dataType : 'json',
|
||||
error : function() {
|
||||
DOM.setHistory(oldURL, null, oldURL);
|
||||
},
|
||||
success : function(data) {
|
||||
var str = Util.stringifyJSON(data),
|
||||
MAX_SIZE = 50000;
|
||||
|
||||
setTitle();
|
||||
|
||||
CloudCmd.createFileTable(data);
|
||||
Util.log(str.length);
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue