From 80530b9599a63c684e80609c9ce7e3bf50d149d6 Mon Sep 17 00:00:00 2001 From: Simon Kornblith Date: Fri, 25 Nov 2011 12:45:06 -0500 Subject: [PATCH] Tweak UI and don't allow selection of library headers --- .../content/zotero/integration/quickFormat.js | 56 ++++++++++++++----- chrome/skin/default/zotero/integration.css | 11 +++- 2 files changed, 50 insertions(+), 17 deletions(-) diff --git a/chrome/content/zotero/integration/quickFormat.js b/chrome/content/zotero/integration/quickFormat.js index b7d53d6f92..59b4586836 100644 --- a/chrome/content/zotero/integration/quickFormat.js +++ b/chrome/content/zotero/integration/quickFormat.js @@ -25,8 +25,8 @@ var Zotero_QuickFormat = new function () { var io, qfs, qfi, qfiWindow, qfiDocument, qfe, qfb, qfbHeight, keepSorted, showEditor, - referencePanel, referenceBox, referenceHeight, dragX, dragY, curLocator, curLocatorLabel, - curIDs = [], curResizer, dragging; + referencePanel, referenceBox, referenceHeight, separatorHeight, dragX, dragY, curLocator, + curLocatorLabel, curIDs = [], curResizer, dragging; // A variable that contains the timeout object for the latest onKeyPress event var eventTimeout = null; @@ -279,14 +279,17 @@ var Zotero_QuickFormat = new function () { var previousLibrary = -1; for(var i=0, n=items.length; i 30) { @@ -522,7 +545,9 @@ var Zotero_QuickFormat = new function () { var panelShowing = referencePanel.state === "open" || referencePanel.state === "showing"; if(numReferences) { - var height = referenceHeight ? Math.min(numReferences, SHOWN_REFERENCES)*referenceHeight+2 : 39; + var height = referenceHeight ? + Math.min(numReferences*referenceHeight+1+numSeparators*separatorHeight, + SHOWN_REFERENCES*referenceHeight+1+separatorHeight) : 39; if(panelShowing && height !== referencePanel.clientHeight) { referencePanel.sizeTo((window.outerWidth-30), height); @@ -535,9 +560,11 @@ var Zotero_QuickFormat = new function () { false, false, null); if(!referenceHeight) { - referenceHeight = referenceBox.firstChild.scrollHeight; - height = Math.min(numReferences, SHOWN_REFERENCES)*referenceHeight+2; - referencePanel.sizeTo((window.innerWidth-30), height); + separatorHeight = referenceBox.firstChild.scrollHeight; + referenceHeight = referenceBox.childNodes[1].scrollHeight; + height = Math.min(numReferences*referenceHeight+1+numSeparators*separatorHeight, + SHOWN_REFERENCES*referenceHeight+1+separatorHeight); + referencePanel.sizeTo((window.outerWidth-30), height); } } } else { @@ -739,7 +766,6 @@ var Zotero_QuickFormat = new function () { * Handle return or escape */ function _onQuickSearchKeyPress(event) { - var keyCode = event.keyCode; if(keyCode === event.DOM_VK_RETURN || keyCode === event.DOM_VK_ENTER) { event.preventDefault(); diff --git a/chrome/skin/default/zotero/integration.css b/chrome/skin/default/zotero/integration.css index b4ac863bda..cdf3c8c8b4 100644 --- a/chrome/skin/default/zotero/integration.css +++ b/chrome/skin/default/zotero/integration.css @@ -150,15 +150,22 @@ body { font-size: 12px; font: -moz-field; -moz-user-focus: normal; - padding: 5px; + padding: 3px 5px 3px 10px; } -.quick-format-item:not(:last-child) { +.quick-format-item:not(:last-child), .quick-format-separator:not(:last-child) { border-style: solid; border-width: 0 0 1px 0; border-color: #BBB; } +.quick-format-separator { + font-size: 12px; + font: -moz-field; + -moz-user-focus: ignore; + color: gray; +} + richlistitem[selected="true"] { background: Highlight; color: HighlightText;