diff --git a/lib/client/dom.js b/lib/client/dom.js index 1072c07c..5916389d 100644 --- a/lib/client/dom.js +++ b/lib/client/dom.js @@ -872,6 +872,20 @@ var CloudCmd, Util, DOM, CloudFunc, Dialog; return lRet; }; + /** + * get current direcotory path + */ + this.getParentDirPath = function(panel) { + var path = DOM.getCurrentDirPath(panel), + dirName = DOM.getCurrentDirName() + '/', + ret = '/'; + + if (path !== '/') + ret = Util.removeStr(path, dirName); + + return ret; + }; + /** * get not current direcotory path */ @@ -1824,6 +1838,7 @@ var CloudCmd, Util, DOM, CloudFunc, Dialog; info.dir = Cmd.getCurrentDirName(); info.dirPath = Cmd.getCurrentDirPath(); + info.parentDirPath = Cmd.getParentDirPath(); info.element = current; info.ext = Util.getExtension(name); info.files = files.children, @@ -1836,7 +1851,7 @@ var CloudCmd, Util, DOM, CloudFunc, Dialog; info.name = name; info.path = Cmd.getCurrentPath(current); info.panel = panel; - info.panelPassive = panelPassive + info.panelPassive = panelPassive; info.size = Cmd.getCurrentSize(current); info.isDir = Cmd.isCurrentIsDir(); info.isSelected = Cmd.isSelected(current); diff --git a/lib/client/key.js b/lib/client/key.js index 983bb1c6..7699c7ee 100644 --- a/lib/client/key.js +++ b/lib/client/key.js @@ -5,6 +5,7 @@ var CloudCmd, Util, DOM; var Info = DOM.CurrentInfo, Chars = [], KEY = { + BACKSPACE : 8, TAB : 9, ENTER : 13, ESC : 27, @@ -162,6 +163,9 @@ var CloudCmd, Util, DOM; var i, n, id, current = Info.element, panel = Info.panel, + path = Info.path, + dirPath = Info.dirPath, + parentDirPath = Info.parentDirPath, filesPassive = Info.filesPassive, prev = current.previousSibling, next = current.nextSibling, @@ -197,8 +201,6 @@ var CloudCmd, Util, DOM; case Key.DELETE: if (shift) { - var path = Info.path; - if (Info.isDir) path += '?dir'; @@ -384,6 +386,19 @@ var CloudCmd, Util, DOM; if (Info.isDir) Util.exec(CloudCmd.loadDir()); break; + + case Key.BACKSPACE: + path = Info.dirPath; + + if (path !== parentDirPath) { + path = parentDirPath; + path = CloudFunc.FS + CloudFunc.rmLastSlash(path); + + Util.exec(CloudCmd.loadDir(path)); + } + + DOM.preventDefault(pEvent); + break; case Key.A: if (pEvent.ctrlKey) {