www

Unnamed repository; edit this file 'description' to name the repository.
Log | Files | Refs | Submodules | README | LICENSE

commit 3c500b8ebff442e4bbbbb98f3a38112e63c4ec84
parent 82d3293b4c8ad64bb58a1d95d570473910e8c2d8
Author: Simon Kornblith <simon@simonster.com>
Date:   Mon, 20 Feb 2012 03:11:53 -0500

Refocus content when closing Zotero pane by any means besides opening Zotero Standalone

Diffstat:
Mchrome/content/zotero/overlay.js | 15++++++++++++---
1 file changed, 12 insertions(+), 3 deletions(-)

diff --git a/chrome/content/zotero/overlay.js b/chrome/content/zotero/overlay.js @@ -156,10 +156,10 @@ var ZoteroOverlay = new function() // save current state _stateBeforeReload = !zoteroPane.hidden && !zoteroPane.collapsed; // ensure pane is closed - if(!zoteroPane.collapsed) ZoteroOverlay.toggleDisplay(false); + if(!zoteroPane.collapsed) ZoteroOverlay.toggleDisplay(false, true); } else { // reopen pane if it was open before - ZoteroOverlay.toggleDisplay(_stateBeforeReload); + ZoteroOverlay.toggleDisplay(_stateBeforeReload, true); } }); } @@ -176,8 +176,12 @@ var ZoteroOverlay = new function() /** * Hides/displays the Zotero interface + * @param {Boolean} makeVisible Whether or not Zotero interface should be visible + * @param {Boolean} dontRefocus If true, don't focus content when closing Zotero pane. Used + * when closing pane because Zotero Standalone is being opened, to avoid pulling Firefox to + * the foreground. */ - this.toggleDisplay = function(makeVisible) + this.toggleDisplay = function(makeVisible, dontRefocus) { if(!Zotero || !Zotero.initialized) { ZoteroPane.displayStartupError(); @@ -245,6 +249,11 @@ var ZoteroOverlay = new function() zoteroPane.height = 0; document.getElementById('content').setAttribute('collapsed', false); + + if(!dontRefocus) { + // Return focus to the browser content pane + window.content.window.focus(); + } } }