diff --git a/lib/client.js b/lib/client.js index 214ce4a6..4b46cfe9 100644 --- a/lib/client.js +++ b/lib/client.js @@ -74,7 +74,7 @@ var Util, DOM, CloudFunc, join; if (panelChanged || isRefresh || !history) imgPosition = 'top'; - Images.show.load(imgPosition); + Images.show.load(imgPosition, panel); /* загружаем содержимое каталога */ ajaxLoad(link, { @@ -328,11 +328,15 @@ var Util, DOM, CloudFunc, join; this.refresh = function(panelParam, options, callback) { var panel = panelParam || Info.panel, + noCurrent, NEEDREFRESH = true, path = DOM.getCurrentDirPath(panel), notSlashlLink = CloudFunc.rmLastSlash(path); - if (!callback) { + if (options) + noCurrent = options.noCurrent + + if (!callback && typeof options === 'function') { callback = options; options = {}; } @@ -342,7 +346,7 @@ var Util, DOM, CloudFunc, join; isRefresh : NEEDREFRESH, history : false, panel : panel, - noCurrent : options.noCurrent + noCurrent : noCurrent }, callback); }; diff --git a/lib/client/dom.js b/lib/client/dom.js index b011c895..33aac2cf 100644 --- a/lib/client/dom.js +++ b/lib/client/dom.js @@ -87,13 +87,13 @@ var CloudCmd, Util, DOM, CloudFunc, Dialog; * Function shows loading spinner * position = {top: true}; */ - function load(position) { + function load(position, panel) { var current, image = Images.loading(), parent = image.parentElement; if (position === 'top') { - current = DOM.getRefreshButton().parentElement; + current = DOM.getRefreshButton(panel).parentElement; } else { current = DOM.getCurrentFile(); current = DOM.getByDataName('js-name', current); @@ -782,9 +782,9 @@ var CloudCmd, Util, DOM, CloudFunc, Dialog; /** * unified way to get RefreshButton */ - this.getRefreshButton = function() { - var panel = this.getPanel(), - refresh = this.getByDataName('js-refresh', panel); + this.getRefreshButton = function(panel) { + var currentPanel = panel || this.getPanel(), + refresh = this.getByDataName('js-refresh', currentPanel); return refresh; }; diff --git a/lib/client/key.js b/lib/client/key.js index 0d20a7d1..922bf6f6 100644 --- a/lib/client/key.js +++ b/lib/client/key.js @@ -491,7 +491,6 @@ var CloudCmd, Util, DOM; case Key.R: if (ctrlMeta) { CloudCmd.log('reloading page...\n'); - CloudCmd.refresh(); event.preventDefault(); } diff --git a/lib/client/listeners.js b/lib/client/listeners.js index 6413fab9..9868325e 100644 --- a/lib/client/listeners.js +++ b/lib/client/listeners.js @@ -75,12 +75,21 @@ var Util, DOM, CloudFunc, CloudCmd; pathElement = DOM.getByDataName('js-path', panel); /* ставим загрузку гифа на клик*/ - Events.addClick(pathElement, onPathElementClick); + Events.addClick(pathElement, getPathListener(panel)); Events.add(filesElement, EventsFiles); }; - function onPathElementClick(event) { + function getPathListener(panel) { + var fn = onPathElementClick.bind(null, panel); + + return fn; + } + + function onPathElementClick(panel, event) { var link, href, url, + namePanel, + nameInfoPanel, + noCurrent = false, element = event.target, attr = element.getAttribute('data-name'); @@ -90,7 +99,16 @@ var Util, DOM, CloudFunc, CloudCmd; break; case 'js-refresh': - CloudCmd.refresh(); + namePanel = panel.getAttribute('data-name'); + nameInfoPanel = Info.panel.getAttribute('data-name'); + + if (namePanel !== nameInfoPanel) + noCurrent = true; + + CloudCmd.refresh(panel, { + noCurrent: noCurrent + }); + event.preventDefault(); break; diff --git a/lib/client/operation.js b/lib/client/operation.js index 05645c0e..d14c9109 100644 --- a/lib/client/operation.js +++ b/lib/client/operation.js @@ -321,7 +321,9 @@ }; if (!Info.isOnePanel) - CloudCmd.refresh(panelPassive, {noCurrent: true}, function() {}); + CloudCmd.refresh(panelPassive, { + noCurrent: true + }); CloudCmd.refresh(panel, setCurrent); });