From 6c97fed76c2fd7b4b781de69b09bf31e6935a9ab Mon Sep 17 00:00:00 2001 From: Simon Kornblith <simon@simonster.com> Date: Mon, 16 Jan 2012 22:39:29 -0500 Subject: [PATCH] Fixes for Firefox 3.6 (ugh) --- .../content/zotero/integration/quickFormat.js | 33 +++++++++++++------ 1 file changed, 23 insertions(+), 10 deletions(-) diff --git a/chrome/content/zotero/integration/quickFormat.js b/chrome/content/zotero/integration/quickFormat.js index d91adac63..1f507d912 100644 --- a/chrome/content/zotero/integration/quickFormat.js +++ b/chrome/content/zotero/integration/quickFormat.js @@ -106,9 +106,10 @@ var Zotero_QuickFormat = new function () { * Initialize add citation dialog */ this.onLoad = function(event) { - if(event.target !== document) return; + if(event.target !== document) return; // make sure we are visible - window.setTimeout(function() { + window.setTimeout(function() { + if(!Zotero.isFx4) window.sizeToContent(); var screenX = window.screenX; var screenY = window.screenY; var xRange = [window.screen.availLeft, window.screen.width-window.outerWidth]; @@ -687,10 +688,13 @@ var Zotero_QuickFormat = new function () { for(var i=0, n=childNodes.length; i<n && numReferences < SHOWN_REFERENCES; i++) { if(childNodes[i].className === "quick-format-item") { numReferences++; - firstReference = childNodes[i]; + if(!firstReference) { + firstReference = childNodes[i]; + if(referenceBox.selectedIndex === -1) referenceBox.selectedIndex = i; + } } else if(childNodes[i].className === "quick-format-separator") { numSeparators++; - firstSeparator = childNodes[i]; + if(!firstSeparator) firstSeparator = childNodes[i]; } } @@ -711,18 +715,27 @@ var Zotero_QuickFormat = new function () { var panelShowing = referencePanel.state === "open" || referencePanel.state === "showing"; if(numReferences || numSeparators) { - if(!referenceHeight && firstReference) { - if(!panelShowing) referencePanel.openPopup(document.documentElement, "after_start", 15, + if(((!referenceHeight && firstReference) || (!separatorHeight && firstSeparator)) + && !panelShowing) { + referencePanel.openPopup(document.documentElement, "after_start", 15, null, false, false, null); - panelShowing = true; + if(!Zotero.isFx4) { + window.setTimeout(function() { + panelShowing = true; + _resize(); + }, 0); + return; + } else { + panelShowing = true; + } + } + + if(!referenceHeight && firstReference) { referenceHeight = firstReference.scrollHeight; if(firstReference === referenceBox.lastChild) referenceHeight += 1; } if(!separatorHeight && firstSeparator) { - if(!panelShowing) referencePanel.openPopup(document.documentElement, "after_start", 15, - null, false, false, null); - panelShowing = true; separatorHeight = firstSeparator.scrollHeight; if(firstSeparator === referenceBox.lastChild) separatorHeight += 1; }