Show metadata when clicking an item in quickformat dialog
This commit is contained in:
parent
8da084800e
commit
ccec1243c6
|
@ -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) {
|
function _buildItemDescription(item, infoHbox) {
|
||||||
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");
|
|
||||||
|
|
||||||
var nodes = [];
|
var nodes = [];
|
||||||
|
|
||||||
// do some basic bibliography formatting; not using CSL here for speed
|
|
||||||
var author, authorDate = "";
|
var author, authorDate = "";
|
||||||
if(item.firstCreator) author = authorDate = item.firstCreator;
|
if(item.firstCreator) author = authorDate = item.firstCreator;
|
||||||
var date = item.getField("date", true);
|
var date = item.getField("date", true);
|
||||||
|
@ -338,23 +328,35 @@ var Zotero_QuickFormat = new function () {
|
||||||
var label = document.createElement("label");
|
var label = document.createElement("label");
|
||||||
label.setAttribute("value", str);
|
label.setAttribute("value", str);
|
||||||
label.setAttribute("crop", "end");
|
label.setAttribute("crop", "end");
|
||||||
infoNode.appendChild(label);
|
infoHbox.appendChild(label);
|
||||||
infoNode.appendChild(node);
|
infoHbox.appendChild(node);
|
||||||
str = "";
|
str = "";
|
||||||
} else {
|
} else {
|
||||||
str += node;
|
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 infoNode = document.createElement("hbox");
|
||||||
var label = document.createElement("label");
|
infoNode.setAttribute("class", "quick-format-info");
|
||||||
label.setAttribute("value", str);
|
_buildItemDescription(item, infoNode);
|
||||||
label.setAttribute("crop", "end");
|
|
||||||
label.setAttribute("flex", "1");
|
|
||||||
infoNode.appendChild(label);
|
|
||||||
}
|
|
||||||
|
|
||||||
// add to rich list item
|
// add to rich list item
|
||||||
var rll = document.createElement("richlistitem");
|
var rll = document.createElement("richlistitem");
|
||||||
|
@ -597,6 +599,7 @@ var Zotero_QuickFormat = new function () {
|
||||||
var suppressAuthor = document.getElementById("suppress-author");
|
var suppressAuthor = document.getElementById("suppress-author");
|
||||||
var locatorLabel = document.getElementById("locator-label");
|
var locatorLabel = document.getElementById("locator-label");
|
||||||
var locator = document.getElementById("locator");
|
var locator = document.getElementById("locator");
|
||||||
|
var info = document.getElementById("citation-properties-info");
|
||||||
|
|
||||||
prefix.value = target.citationItem["prefix"] ? target.citationItem["prefix"] : "";
|
prefix.value = target.citationItem["prefix"] ? target.citationItem["prefix"] : "";
|
||||||
suffix.value = target.citationItem["suffix"] ? target.citationItem["suffix"] : "";
|
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"] : "";
|
locator.value = target.citationItem["locator"] ? target.citationItem["locator"] : "";
|
||||||
suppressAuthor.checked = !!target.citationItem["suppress-author"];
|
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");
|
target.setAttribute("selected", "true");
|
||||||
panel.openPopup(target, "after_start",
|
panel.openPopup(target, "after_start",
|
||||||
target.clientWidth/2, 0, false, false, null);
|
target.clientWidth/2, 0, false, false, null);
|
||||||
|
|
|
@ -69,6 +69,10 @@
|
||||||
<richlistbox id="quick-format-reference-list" flex="1"/>
|
<richlistbox id="quick-format-reference-list" flex="1"/>
|
||||||
</panel>
|
</panel>
|
||||||
<panel id="citation-properties" type="arrow" orient="vertical" onkeypress="Zotero_QuickFormat.onPanelKeyPress(event)">
|
<panel id="citation-properties" type="arrow" orient="vertical" onkeypress="Zotero_QuickFormat.onPanelKeyPress(event)">
|
||||||
|
<vbox flex="1">
|
||||||
|
<description id="citation-properties-title"/>
|
||||||
|
<hbox id="citation-properties-info"/>
|
||||||
|
</vbox>
|
||||||
<grid flex="1">
|
<grid flex="1">
|
||||||
<columns>
|
<columns>
|
||||||
<column/>
|
<column/>
|
||||||
|
|
|
@ -204,4 +204,24 @@ richlistitem[selected="true"] {
|
||||||
|
|
||||||
#citation-properties #suppress-author {
|
#citation-properties #suppress-author {
|
||||||
-moz-user-focus: normal;
|
-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;
|
||||||
}
|
}
|
Loading…
Reference in New Issue
Block a user