diff --git a/chrome/content/zotero/integration/quickFormat.js b/chrome/content/zotero/integration/quickFormat.js index c891f1b66..66ccec62b 100644 --- a/chrome/content/zotero/integration/quickFormat.js +++ b/chrome/content/zotero/integration/quickFormat.js @@ -276,21 +276,11 @@ var Zotero_QuickFormat = new function () { } /** - * Creates an item to be added to the item list + * Builds a string describing an item. We avoid CSL here for speed. */ - function _buildListItem(item) { - var titleNode = document.createElement("label"); - titleNode.setAttribute("class", "quick-format-title"); - titleNode.setAttribute("flex", "1"); - titleNode.setAttribute("crop", "end"); - titleNode.setAttribute("value", item.getDisplayTitle()); - - var infoNode = document.createElement("hbox"); - infoNode.setAttribute("class", "quick-format-info"); - + function _buildItemDescription(item, infoHbox) { var nodes = []; - // do some basic bibliography formatting; not using CSL here for speed var author, authorDate = ""; if(item.firstCreator) author = authorDate = item.firstCreator; var date = item.getField("date", true); @@ -338,23 +328,35 @@ var Zotero_QuickFormat = new function () { var label = document.createElement("label"); label.setAttribute("value", str); label.setAttribute("crop", "end"); - infoNode.appendChild(label); - infoNode.appendChild(node); + infoHbox.appendChild(label); + infoHbox.appendChild(node); str = ""; } else { str += node; } } - if(nodes.length && (!str.length || str[str.length-1] !== ".")) str += "." + if(nodes.length && (!str.length || str[str.length-1] !== ".")) str += "."; + var label = document.createElement("label"); + label.setAttribute("value", str); + label.setAttribute("crop", "end"); + label.setAttribute("flex", "1"); + infoHbox.appendChild(label); + } + + /** + * Creates an item to be added to the item list + */ + function _buildListItem(item) { + var titleNode = document.createElement("label"); + titleNode.setAttribute("class", "quick-format-title"); + titleNode.setAttribute("flex", "1"); + titleNode.setAttribute("crop", "end"); + titleNode.setAttribute("value", item.getDisplayTitle()); - if(str) { - var label = document.createElement("label"); - label.setAttribute("value", str); - label.setAttribute("crop", "end"); - label.setAttribute("flex", "1"); - infoNode.appendChild(label); - } + var infoNode = document.createElement("hbox"); + infoNode.setAttribute("class", "quick-format-info"); + _buildItemDescription(item, infoNode); // add to rich list item var rll = document.createElement("richlistitem"); @@ -597,6 +599,7 @@ var Zotero_QuickFormat = new function () { var suppressAuthor = document.getElementById("suppress-author"); var locatorLabel = document.getElementById("locator-label"); var locator = document.getElementById("locator"); + var info = document.getElementById("citation-properties-info"); prefix.value = target.citationItem["prefix"] ? target.citationItem["prefix"] : ""; suffix.value = target.citationItem["suffix"] ? target.citationItem["suffix"] : ""; @@ -613,6 +616,11 @@ var Zotero_QuickFormat = new function () { locator.value = target.citationItem["locator"] ? target.citationItem["locator"] : ""; suppressAuthor.checked = !!target.citationItem["suppress-author"]; + var item = Zotero.Items.get(target.citationItem.id); + document.getElementById("citation-properties-title").textContent = item.getDisplayTitle(); + while(info.hasChildNodes()) info.removeChild(info.firstChild); + _buildItemDescription(item, info); + target.setAttribute("selected", "true"); panel.openPopup(target, "after_start", target.clientWidth/2, 0, false, false, null); diff --git a/chrome/content/zotero/integration/quickFormat.xul b/chrome/content/zotero/integration/quickFormat.xul index 6cf5b945e..a972e0da4 100644 --- a/chrome/content/zotero/integration/quickFormat.xul +++ b/chrome/content/zotero/integration/quickFormat.xul @@ -69,6 +69,10 @@ + + + + diff --git a/chrome/skin/default/zotero/integration.css b/chrome/skin/default/zotero/integration.css index 644bd07ac..b4ac863bd 100644 --- a/chrome/skin/default/zotero/integration.css +++ b/chrome/skin/default/zotero/integration.css @@ -204,4 +204,24 @@ richlistitem[selected="true"] { #citation-properties #suppress-author { -moz-user-focus: normal; +} + +#citation-properties-title { + padding-left: 0; + padding-right: 0; + margin-left: 0; + margin-right: 0; + max-width: 300px; + font-weight: bold; +} + +#citation-properties-info > label { + padding-left: 0; + padding-right: 0; + margin-left: 0; + margin-right: 0; +} + +#citation-properties-info { + margin-bottom: 3px; } \ No newline at end of file