From f562657d58e25d610fc2a5ad7f456b07cba972a2 Mon Sep 17 00:00:00 2001 From: coderaiser Date: Wed, 22 Jan 2014 09:05:27 -0500 Subject: [PATCH] refactor(key) mv goToParentDir to client --- lib/client.js | 14 ++++++++++++++ lib/client/key.js | 11 +---------- 2 files changed, 15 insertions(+), 10 deletions(-) diff --git a/lib/client.js b/lib/client.js index 49f92af7..e68b6b03 100644 --- a/lib/client.js +++ b/lib/client.js @@ -494,5 +494,19 @@ var Util, DOM, CloudFunc; return ret; } + + this.goToParentDir = function() { + var Info = DOM.CurrentInfo, + path = Info.dirPath, + parentPath = Info.parentDirPath; + + if (path !== parentPath) { + path = parentPath; + path = CloudFunc.FS + CloudFunc.rmLastSlash(path); + + Util.exec(CloudCmd.loadDir(path)); + } + }; + } })(this, Util, DOM, CloudFunc); diff --git a/lib/client/key.js b/lib/client/key.js index 00e804a1..1c0c9774 100644 --- a/lib/client/key.js +++ b/lib/client/key.js @@ -166,7 +166,6 @@ var CloudCmd, Util, DOM; panel = Info.panel, path = Info.path, dirPath = Info.dirPath, - parentDirPath = Info.parentDirPath, filesPassive = Info.filesPassive, prev = current.previousSibling, next = current.nextSibling, @@ -389,15 +388,7 @@ var CloudCmd, Util, DOM; break; case Key.BACKSPACE: - path = Info.dirPath; - - if (path !== parentDirPath) { - path = parentDirPath; - path = CloudFunc.FS + CloudFunc.rmLastSlash(path); - - Util.exec(CloudCmd.loadDir(path)); - } - + CloudCmd.goToParentDir(); DOM.preventDefault(pEvent); break;