www

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

commit 189b3cd146a7d095ae9fedeee1bb02420a39b26d
parent 6c6505a7baf4ae24fd513617c4917bb1a6ce6314
Author: Simon Kornblith <simon@simonster.com>
Date:   Mon, 16 Jan 2012 22:58:32 -0500

Fix refocusing of Quick Format window on Linux

Diffstat:
Mchrome/content/zotero/integration/quickFormat.js | 31++++++++++++++++++++++---------
1 file changed, 22 insertions(+), 9 deletions(-)

diff --git a/chrome/content/zotero/integration/quickFormat.js b/chrome/content/zotero/integration/quickFormat.js @@ -717,13 +717,13 @@ var Zotero_QuickFormat = new function () { if(numReferences || numSeparators) { if(((!referenceHeight && firstReference) || (!separatorHeight && firstSeparator)) && !panelShowing) { - referencePanel.openPopup(document.documentElement, "after_start", 15, - null, false, false, null); + _openReferencePanel(); if(!Zotero.isFx4) { - window.setTimeout(function() { + referencePanel.addEventListener("popupshown", function() { + referencePanel.removeEventListener("popupshown", arguments.callee, false); panelShowing = true; _resize(); - }, 0); + }, false); return; } else { panelShowing = true; @@ -741,9 +741,8 @@ var Zotero_QuickFormat = new function () { } referencePanel.sizeTo(window.outerWidth-30, - numReferences*referenceHeight+1+numSeparators*separatorHeight-1); - if(!panelShowing) referencePanel.openPopup(document.documentElement, "after_start", 15, - null, false, false, null); + numReferences*referenceHeight+numSeparators*separatorHeight); + if(!panelShowing) _openReferencePanel(); } else if(panelShowing) { referencePanel.hidePopup(); referencePanel.sizeTo(window.outerWidth-30, 0); @@ -751,6 +750,21 @@ var Zotero_QuickFormat = new function () { } /** + * Opens the reference panel and potentially refocuses the main text box + */ + function _openReferencePanel() { + referencePanel.openPopup(document.documentElement, "after_start", 15, + null, false, false, null); + if(!Zotero.isMac && !Zotero.isWin) { + // When it opens, we will lose focus + referencePanel.addEventListener("popupshown", function() { + referencePanel.removeEventListener("popupshown", arguments.callee, false); + _refocusQfe(); + }, false); + } + } + + /** * Clears all citations */ function _clearCitation() { @@ -1146,4 +1160,4 @@ var Zotero_QuickFormat = new function () { } window.addEventListener("DOMContentLoaded", Zotero_QuickFormat.onDOMContentLoaded, false); -window.addEventListener("load", Zotero_QuickFormat.onLoad, false); -\ No newline at end of file +window.addEventListener("load", Zotero_QuickFormat.onLoad, false);