commit d8cd5cf7ae497894c4d98baa1b260fdc808fc0ff
parent f2f7bf00f779e1ae7cfe22cb6604fd34b55f1dd1
Author: Simon Kornblith <simon@simonster.com>
Date: Mon, 1 Aug 2011 04:27:47 +0000
Fix some (but not all) sizing and focus issues
Diffstat:
3 files changed, 22 insertions(+), 10 deletions(-)
diff --git a/chrome/content/zotero/integration/quickFormat.js b/chrome/content/zotero/integration/quickFormat.js
@@ -40,10 +40,11 @@ var Zotero_QuickFormat = new function () {
qfb = document.getElementById("quick-format-entry");
qfbHeight = qfb.scrollHeight;
referencePanel = document.getElementById("quick-format-reference-panel");
- referencePanel.addEventListener("popuphidden", function() {
- window.focus();
- qfe.focus();
- }, false);
+ referencePanel.addEventListener("popuphidden", _refocusQfe, false);
+ referencePanel.addEventListener("popupshown", _refocusQfe, false);
+ referencePanel.addEventListener("focus", _refocusQfe, false);
+ referencePanel.addEventListener("activate", _refocusQfe, false);
+ referencePanel.addEventListener("keypress", _onReferencePanelKeypress, false);
referenceBox = document.getElementById("quick-format-reference-list");
qfiWindow = qfi.contentWindow;
qfiDocument = qfi.contentDocument;
@@ -99,6 +100,11 @@ var Zotero_QuickFormat = new function () {
}
};
+ function _refocusQfe() {
+ window.focus();
+ qfe.focus();
+ }
+
/**
* Gets the content of the text node that the cursor is currently within
*/
@@ -223,12 +229,12 @@ var Zotero_QuickFormat = new function () {
for(var i=0, n=items.length; i<n; i++) {
referenceBox.appendChild(_buildListItem(items[i]));
}
- referenceBox.ensureIndexIsVisible(0);
}
_resize();
referenceBox.selectedIndex = 0;
+ referenceBox.ensureIndexIsVisible(0);
}
/**
@@ -432,8 +438,7 @@ var Zotero_QuickFormat = new function () {
var panelShowing = referencePanel.state === "open" || referencePanel.state === "showing";
if(numReferences) {
- const referenceHeight = 39;
- var height = (numReferences < SHOWN_REFERENCES ? numReferences : SHOWN_REFERENCES)*referenceHeight+2;
+ var height = referenceHeight ? Math.min(numReferences, SHOWN_REFERENCES)*referenceHeight+2 : 39;
if(panelShowing && height !== referencePanel.clientHeight) {
referencePanel.sizeTo((window.innerWidth-30), height);
@@ -444,6 +449,13 @@ var Zotero_QuickFormat = new function () {
referencePanel.sizeTo((window.innerWidth-30), height);
referencePanel.openPopup(document.documentElement, "after_start", 15, null,
false, false, null);
+
+ if(!referenceHeight) {
+ referenceHeight = referenceBox.firstChild.scrollHeight;
+ height = Math.min(numReferences, SHOWN_REFERENCES)*referenceHeight+2;
+ referencePanel.sizeTo((window.innerWidth-30), height);
+ window.setTimeout(_refocusQfe, 100);
+ }
}
} else {
if(panelShowing) {
diff --git a/chrome/content/zotero/integration/quickFormat.xul b/chrome/content/zotero/integration/quickFormat.xul
@@ -90,10 +90,10 @@
<label value="&zotero.citation.suffix.label;"/>
<textbox class="citation-textbox" id="suffix" flex="1"/>
</row>
- <hbox pack="left">
+ <html:div>
<html:input type="checkbox" id="suppress-author"/>
<html:label for="suppress-author">&zotero.citation.suppressAuthor.label;</html:label>
- </hbox>
+ </html:div>
</rows>
</grid>
</panel>
diff --git a/chrome/skin/default/zotero/integration.css b/chrome/skin/default/zotero/integration.css
@@ -193,12 +193,12 @@ richlistitem[selected="true"] {
background: white;
opacity: 0.9;
-moz-user-focus: ignore;
- height: 37px;
}
#quick-format-reference-list {
margin: 0;
padding: 0;
+ -moz-user-focus: ignore;
}
#citation-properties menulist {