Closes #548, Add export format support to Quick Copy
This commit is contained in:
parent
30281f7976
commit
cf95e4db2a
|
@ -53,7 +53,7 @@ var Zotero_File_Interface_Export = new function() {
|
||||||
var selectedTranslator = Zotero.Prefs.get("export.lastTranslator");
|
var selectedTranslator = Zotero.Prefs.get("export.lastTranslator");
|
||||||
|
|
||||||
// add styles to list
|
// add styles to list
|
||||||
for(i in translators) {
|
for(var i in translators) {
|
||||||
var itemNode = document.createElement("menuitem");
|
var itemNode = document.createElement("menuitem");
|
||||||
itemNode.setAttribute("label", translators[i].label);
|
itemNode.setAttribute("label", translators[i].label);
|
||||||
listbox.appendChild(itemNode);
|
listbox.appendChild(itemNode);
|
||||||
|
|
|
@ -167,10 +167,10 @@ var Zotero_File_Interface = new function() {
|
||||||
/*
|
/*
|
||||||
* exports items to clipboard
|
* exports items to clipboard
|
||||||
*/
|
*/
|
||||||
function exportItemsToClipboard(items, format) {
|
function exportItemsToClipboard(items, translatorID) {
|
||||||
var translation = new Zotero.Translate("export");
|
var translation = new Zotero.Translate("export");
|
||||||
translation.setItems(items);
|
translation.setItems(items);
|
||||||
translation.setTranslator(format);
|
translation.setTranslator(translatorID);
|
||||||
translation.setHandler("done", _copyToClipboard);
|
translation.setHandler("done", _copyToClipboard);
|
||||||
translation.translate();
|
translation.translate();
|
||||||
}
|
}
|
||||||
|
|
|
@ -881,11 +881,14 @@ var ZoteroPane = new function()
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
// TODO: we only support bibliography output at the moment
|
var [mode, format] = Zotero.Prefs.get("export.quickCopy.setting").split('=');
|
||||||
var mode = Zotero.Prefs.get("export.quickCopy.mode");
|
Zotero.debug(mode);
|
||||||
|
Zotero.debug(format);
|
||||||
if (mode == 'bibliography') {
|
if (mode == 'bibliography') {
|
||||||
var style = Zotero.Prefs.get("export.quickCopy.setting");
|
Zotero_File_Interface.copyItemsToClipboard(items, format);
|
||||||
Zotero_File_Interface.copyItemsToClipboard(items, style);
|
}
|
||||||
|
else if (mode == 'export') {
|
||||||
|
Zotero_File_Interface.exportItemsToClipboard(items, format);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -136,18 +136,50 @@ function populateOpenURLResolvers() {
|
||||||
function populateQuickCopyList() {
|
function populateQuickCopyList() {
|
||||||
var formatMenu = document.getElementById("quickCopy-menu");
|
var formatMenu = document.getElementById("quickCopy-menu");
|
||||||
var listbox = formatMenu.firstChild;
|
var listbox = formatMenu.firstChild;
|
||||||
var styles = Zotero.Cite.getStyles();
|
|
||||||
|
|
||||||
var format = Zotero.Prefs.get("export.quickCopy.setting");
|
var format = Zotero.Prefs.get("export.quickCopy.setting");
|
||||||
|
|
||||||
// add styles to list
|
|
||||||
for (i in styles) {
|
|
||||||
var itemNode = document.createElement("menuitem");
|
var itemNode = document.createElement("menuitem");
|
||||||
itemNode.setAttribute("value", i);
|
itemNode.setAttribute("label", Zotero.getString('zotero.preferences.export.quickCopy.bibStyles'));
|
||||||
|
itemNode.setAttribute("disabled", true);
|
||||||
|
listbox.appendChild(itemNode);
|
||||||
|
|
||||||
|
// add styles to list
|
||||||
|
var styles = Zotero.Cite.getStyles();
|
||||||
|
for (var i in styles) {
|
||||||
|
var val = 'bibliography=' + i;
|
||||||
|
var itemNode = document.createElement("menuitem");
|
||||||
|
itemNode.setAttribute("value", val);
|
||||||
itemNode.setAttribute("label", styles[i]);
|
itemNode.setAttribute("label", styles[i]);
|
||||||
listbox.appendChild(itemNode);
|
listbox.appendChild(itemNode);
|
||||||
|
|
||||||
if (i == format) {
|
if (val == format) {
|
||||||
|
formatMenu.selectedItem = itemNode;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
var itemNode = document.createElement("menuitem");
|
||||||
|
itemNode.setAttribute("label", Zotero.getString('zotero.preferences.export.quickCopy.exportFormats'));
|
||||||
|
itemNode.setAttribute("disabled", true);
|
||||||
|
listbox.appendChild(itemNode);
|
||||||
|
|
||||||
|
// add export formats to list
|
||||||
|
var translation = new Zotero.Translate("export");
|
||||||
|
var translators = translation.getTranslators();
|
||||||
|
|
||||||
|
for (var i in translators) {
|
||||||
|
// Skip RDF formats
|
||||||
|
switch (translators[i].translatorID) {
|
||||||
|
case '6e372642-ed9d-4934-b5d1-c11ac758ebb7':
|
||||||
|
case '14763d24-8ba0-45df-8f52-b8d1108e7ac9':
|
||||||
|
continue;
|
||||||
|
}
|
||||||
|
var val = 'export=' + translators[i].translatorID;
|
||||||
|
var itemNode = document.createElement("menuitem");
|
||||||
|
itemNode.setAttribute("value", val);
|
||||||
|
itemNode.setAttribute("label", translators[i].label);
|
||||||
|
listbox.appendChild(itemNode);
|
||||||
|
|
||||||
|
if (val == format) {
|
||||||
formatMenu.selectedItem = itemNode;
|
formatMenu.selectedItem = itemNode;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -290,6 +290,8 @@ zotero.preferences.update.error = Error
|
||||||
zotero.preferences.openurl.resolversFound.zero = %S resolvers found
|
zotero.preferences.openurl.resolversFound.zero = %S resolvers found
|
||||||
zotero.preferences.openurl.resolversFound.singular = %S resolver found
|
zotero.preferences.openurl.resolversFound.singular = %S resolver found
|
||||||
zotero.preferences.openurl.resolversFound.plural = %S resolvers found
|
zotero.preferences.openurl.resolversFound.plural = %S resolvers found
|
||||||
|
zotero.preferences.export.quickCopy.bibStyles = Bibliographic Styles
|
||||||
|
zotero.preferences.export.quickCopy.exportFormats = Export Formats
|
||||||
zotero.preferences.export.quickCopy.instructions = Select one or more references and press the shortcut key (%S) to copy the references to the clipboard.
|
zotero.preferences.export.quickCopy.instructions = Select one or more references and press the shortcut key (%S) to copy the references to the clipboard.
|
||||||
|
|
||||||
fileInterface.itemsImported = Importing items...
|
fileInterface.itemsImported = Importing items...
|
||||||
|
|
|
@ -42,10 +42,9 @@ pref("extensions.zotero.fulltext.pdfMaxPages", 100);
|
||||||
// Export and citation settings
|
// Export and citation settings
|
||||||
pref("extensions.zotero.export.lastTranslator", '14763d24-8ba0-45df-8f52-b8d1108e7ac9');
|
pref("extensions.zotero.export.lastTranslator", '14763d24-8ba0-45df-8f52-b8d1108e7ac9');
|
||||||
pref("extensions.zotero.export.translatorSettings", 'true,false');
|
pref("extensions.zotero.export.translatorSettings", 'true,false');
|
||||||
pref("extensions.zotero.export.lastStyle", 'http://purl.org/net/xbiblio/csl/styles/apa.csl');
|
pref("extensions.zotero.export.lastStyle", 'http://purl.org/net/xbiblio/csl/styles/chicago-note.csl');
|
||||||
pref("extensions.zotero.export.bibliographySettings", 'save-as-rtf');
|
pref("extensions.zotero.export.bibliographySettings", 'save-as-rtf');
|
||||||
|
|
||||||
pref("extensions.zotero.export.quickCopy.mode", 'bibliography');
|
pref("extensions.zotero.export.quickCopy.setting", 'bibliography=http://purl.org/net/xbiblio/csl/styles/chicago-note.csl');
|
||||||
pref("extensions.zotero.export.quickCopy.setting", 'http://purl.org/net/xbiblio/csl/styles/apa.csl');
|
|
||||||
|
|
||||||
pref("extensions.zotero.annotations.warnOnClose", true);
|
pref("extensions.zotero.annotations.warnOnClose", true);
|
Loading…
Reference in New Issue
Block a user