Fixes for Firefox 3.6 (ugh)

This commit is contained in:
Simon Kornblith 2012-01-16 22:39:29 -05:00
parent 51b3af7bc7
commit 6c97fed76c

View File

@ -109,6 +109,7 @@ var Zotero_QuickFormat = new function () {
if(event.target !== document) return; if(event.target !== document) return;
// make sure we are visible // make sure we are visible
window.setTimeout(function() { window.setTimeout(function() {
if(!Zotero.isFx4) window.sizeToContent();
var screenX = window.screenX; var screenX = window.screenX;
var screenY = window.screenY; var screenY = window.screenY;
var xRange = [window.screen.availLeft, window.screen.width-window.outerWidth]; 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++) { for(var i=0, n=childNodes.length; i<n && numReferences < SHOWN_REFERENCES; i++) {
if(childNodes[i].className === "quick-format-item") { if(childNodes[i].className === "quick-format-item") {
numReferences++; numReferences++;
firstReference = childNodes[i]; if(!firstReference) {
firstReference = childNodes[i];
if(referenceBox.selectedIndex === -1) referenceBox.selectedIndex = i;
}
} else if(childNodes[i].className === "quick-format-separator") { } else if(childNodes[i].className === "quick-format-separator") {
numSeparators++; 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"; var panelShowing = referencePanel.state === "open" || referencePanel.state === "showing";
if(numReferences || numSeparators) { if(numReferences || numSeparators) {
if(!referenceHeight && firstReference) { if(((!referenceHeight && firstReference) || (!separatorHeight && firstSeparator))
if(!panelShowing) referencePanel.openPopup(document.documentElement, "after_start", 15, && !panelShowing) {
referencePanel.openPopup(document.documentElement, "after_start", 15,
null, false, false, null); 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; referenceHeight = firstReference.scrollHeight;
if(firstReference === referenceBox.lastChild) referenceHeight += 1; if(firstReference === referenceBox.lastChild) referenceHeight += 1;
} }
if(!separatorHeight && firstSeparator) { if(!separatorHeight && firstSeparator) {
if(!panelShowing) referencePanel.openPopup(document.documentElement, "after_start", 15,
null, false, false, null);
panelShowing = true;
separatorHeight = firstSeparator.scrollHeight; separatorHeight = firstSeparator.scrollHeight;
if(firstSeparator === referenceBox.lastChild) separatorHeight += 1; if(firstSeparator === referenceBox.lastChild) separatorHeight += 1;
} }