From 307c22173e376e4ab17f9d47ef7dc288d0ce2278 Mon Sep 17 00:00:00 2001 From: coderaiser Date: Tue, 19 Feb 2013 04:03:52 -0500 Subject: [PATCH] fixed bug with setting current file after refresh and refreshing dir content --- ChangeLog | 3 +++ lib/client.js | 6 +++--- lib/client/keyBinding.js | 3 +-- 3 files changed, 7 insertions(+), 5 deletions(-) diff --git a/ChangeLog b/ChangeLog index 6971ee77..c241903b 100644 --- a/ChangeLog +++ b/ChangeLog @@ -138,6 +138,9 @@ directory. * Removed reflows maded by js. +* Fixed bug with setting current file +after refresh and refreshing dir content. + 2012.12.12, Version 0.1.8 diff --git a/lib/client.js b/lib/client.js index 96bf874e..f9682906 100644 --- a/lib/client.js +++ b/lib/client.js @@ -85,7 +85,7 @@ CloudCmd._loadDir = function(pLink, pNeedRefresh){ lLink = pLink || Util.removeStr(lHref, CloudCmd.HOST), lDir = DOM.getCurrentDir(); - if(pLink || lCurrentLink.target !== '_blank'){ + if(lLink || lCurrentLink.target !== '_blank'){ DOM.Images.showLoad(pNeedRefresh ? {top:true} : null); /* загружаем содержимое каталога */ @@ -536,7 +536,7 @@ CloudCmd._ajaxLoad = function(pPath, pOptions){ var lFSPath = decodeURI(pPath); lFSPath = Util.removeStr( lFSPath, CloudFunc.NOJS ); - var lCleanPath = Util.removeStr(lFSPath, CloudFunc.FS); + var lCleanPath = Util.removeStr(lFSPath, CloudFunc.FS) || '/'; Util.log ('reading dir: "' + lCleanPath + '";'); @@ -601,6 +601,7 @@ CloudCmd._createFileTable = function(pElem, pJSON, pSetCurrent){ var lElem = DOM.getById(pElem), /* getting current element if was refresh */ lPath = DOM.getByClass('path', lElem), + lCurrent = DOM.getCurrentFile(), lWasRefresh_b = lPath[0].textContent === pJSON[0].path; /* говорим построителю, @@ -618,7 +619,6 @@ CloudCmd._createFileTable = function(pElem, pJSON, pSetCurrent){ /* searching current file */ if(lWasRefresh_b){ - var lCurrent = DOM.getCurrentFile(); for(i = 0; i < lElem.childNodes.length; i++) if(lElem.childNodes[i].textContent === lCurrent.textContent){ lCurrent = lElem.childNodes[i]; diff --git a/lib/client/keyBinding.js b/lib/client/keyBinding.js index fdcf2d0c..651143ed 100644 --- a/lib/client/keyBinding.js +++ b/lib/client/keyBinding.js @@ -248,9 +248,8 @@ var CloudCommander, Util, DOM; */ Util.exec( DOM.getListener(lRefreshIcon) ); - CloudCmd._currentToParent(lSelectedName); - DOM.preventDefault(); + DOM.preventDefault(pEvent); } }