From af6d9752c226db8554b71e3065f7a3c0464583ee Mon Sep 17 00:00:00 2001 From: coderaiser Date: Mon, 6 Oct 2014 06:36:15 -0400 Subject: [PATCH] feature(client) refresh: current, panel[, callbac]k -> panel[, callback] --- lib/client.js | 10 ++++++---- lib/client/dom.js | 12 ++++++------ 2 files changed, 12 insertions(+), 10 deletions(-) diff --git a/lib/client.js b/lib/client.js index a4d56ddb..0f54a1cb 100644 --- a/lib/client.js +++ b/lib/client.js @@ -306,13 +306,15 @@ var Util, DOM, CloudFunc, join; }); }; - this.refresh = function(current, panelParam, callback) { - var NEEDREFRESH = true, - panel = panelParam || current && current.parentElement, + this.refresh = function(panelParam, callback) { + var panel, + NEEDREFRESH = true, path = DOM.getCurrentDirPath(panel), notSlashlLink = CloudFunc.rmLastSlash(path) || '/'; - if (!panel) + if (panel) + panel = panelParam; + else panel = Info.panel; CloudCmd.loadDir({ diff --git a/lib/client/dom.js b/lib/client/dom.js index 5922bf46..74d70093 100644 --- a/lib/client/dom.js +++ b/lib/client/dom.js @@ -465,7 +465,7 @@ var CloudCmd, Util, DOM, CloudFunc, Dialog; if (name) RESTful.write(path, function() { - CloudCmd.refresh(null, null, function() { + CloudCmd.refresh(null, function() { var current = DOM.getCurrentFileByName(name); DOM.setCurrentFile(current); @@ -502,7 +502,7 @@ var CloudCmd, Util, DOM, CloudFunc, Dialog; if (name && name !== '..') op(fileFrom, function() { - CloudCmd.refresh(null, null, function() { + CloudCmd.refresh(null, function() { var byName = DOM.getCurrentFileByName, dir = byName(nameDir), file = byName(nameFile); @@ -1604,11 +1604,11 @@ var CloudCmd, Util, DOM, CloudFunc, Dialog; if (!data) { DOM.setCurrentFile(dotDot); - CloudCmd.refresh(dotDot, panel); - CloudCmd.refresh(dotDot, panelPassive); + CloudCmd.refresh(panel); + CloudCmd.refresh(panelPassive); } else { - CloudCmd.refresh(dotDot, panelPassive); - CloudCmd.refresh(dotDot, panel); + CloudCmd.refresh(panelPassive); + CloudCmd.refresh(panel); } }); });