mirror of
https://github.com/coderaiser/cloudcmd.git
synced 2026-07-20 18:18:56 +00:00
fix(dom) change url when current dir changed
This commit is contained in:
parent
38bca0ae7b
commit
99d400843d
2 changed files with 20 additions and 20 deletions
|
|
@ -359,23 +359,9 @@ var Util, DOM, CloudFunc;
|
|||
*/
|
||||
this.ajaxLoad = function(path, options, panel) {
|
||||
var SLASH = '/',
|
||||
dirPath = DOM.getCurrentDirPath(),
|
||||
fsPath = decodeURI(path),
|
||||
noJSONPath = Util.rmStr(fsPath, '?json' ),
|
||||
cleanPath = Util.rmStrOnce(noJSONPath, CloudFunc.FS) || SLASH,
|
||||
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);
|
||||
}
|
||||
};
|
||||
cleanPath = Util.rmStrOnce(noJSONPath, CloudFunc.FS) || SLASH;
|
||||
|
||||
if (!options)
|
||||
options = {};
|
||||
|
|
@ -398,13 +384,11 @@ var Util, DOM, CloudFunc;
|
|||
if (!ret && json) {
|
||||
json = Util.parseJSON(json);
|
||||
CloudCmd.createFileTable(json, panel);
|
||||
setTitle();
|
||||
} else
|
||||
DOM.getCurrentFileContent({
|
||||
url : fsPath,
|
||||
dataType : 'json',
|
||||
success : function(json) {
|
||||
setTitle();
|
||||
CloudCmd.createFileTable(json, panel);
|
||||
Storage.set(cleanPath, json);
|
||||
}
|
||||
|
|
|
|||
|
|
@ -1075,16 +1075,32 @@ var CloudCmd, Util, DOM, CloudFunc, Dialog;
|
|||
* unified way to set current file
|
||||
*/
|
||||
this.setCurrentFile = function(currentFile) {
|
||||
var ret,
|
||||
var ret, path, pathWas, title,
|
||||
FS = CloudFunc.FS,
|
||||
CENTER = true,
|
||||
currentFileWas = this.getCurrentFile();
|
||||
|
||||
if (currentFile) {
|
||||
if (currentFileWas)
|
||||
if (currentFileWas) {
|
||||
pathWas = DOM.getCurrentDirPath();
|
||||
unsetCurrentFile(currentFileWas);
|
||||
}
|
||||
|
||||
this.addClass(currentFile, CURRENT_FILE);
|
||||
|
||||
path = DOM.getCurrentDirPath();
|
||||
|
||||
if (path !== pathWas) {
|
||||
title = CloudFunc.getTitle(path);
|
||||
this.setTitle(title);
|
||||
|
||||
if (path !== '/')
|
||||
path = FS + path;
|
||||
|
||||
DOM.setHistory(path, null, path);
|
||||
}
|
||||
|
||||
|
||||
/* scrolling to current file */
|
||||
this.scrollIntoViewIfNeeded(currentFile, CENTER);
|
||||
|
||||
|
|
@ -1826,7 +1842,7 @@ var CloudCmd, Util, DOM, CloudFunc, Dialog;
|
|||
current = Info.element,
|
||||
panel = Info.panel,
|
||||
filesPassive = Info.filesPassive;
|
||||
|
||||
|
||||
id = panel.id;
|
||||
TabPanel[id] = current;
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue