From d252a09cd37c193e6ceb20f01136a43b55c4fd96 Mon Sep 17 00:00:00 2001 From: Dan Stillman Date: Thu, 27 Jul 2017 02:29:50 -0400 Subject: [PATCH] Update Quick Copy menu options based on current settings and URL Show "Copy Citation" and "Copy Bibliography" when a bib format is selected and "Copy as BibTeX", etc., when an export is selected. If a site-specific setting is in effect from the last active URL, use that instead. If no regular items are selected in bib mode, the menu options are disabled. This also now filters non-regular items out when in bib mode -- before if you selected a combination it would include a bunch of 'n.d.' lines. Closes #1155, Disable Copy Citation menu option when a translator is selected for Quick Copy --- .../content/zotero/standalone/standalone.js | 30 +++++++++ .../content/zotero/standalone/standalone.xul | 27 ++++++-- chrome/content/zotero/zoteroPane.js | 63 ++++++++++++------- chrome/content/zotero/zoteroPane.xul | 8 ++- chrome/locale/en-US/zotero/zotero.properties | 2 + 5 files changed, 102 insertions(+), 28 deletions(-) diff --git a/chrome/content/zotero/standalone/standalone.js b/chrome/content/zotero/standalone/standalone.js index b90787928e..4a2ebc2535 100644 --- a/chrome/content/zotero/standalone/standalone.js +++ b/chrome/content/zotero/standalone/standalone.js @@ -52,6 +52,11 @@ const ZoteroStandalone = new function() { document.getElementById('menu_errorConsole').hidden = false; } + document.getElementById('key_copyCitation') + .setAttribute('key', Zotero.Keys.getKeyForCommand('copySelectedItemCitationsToClipboard')); + document.getElementById('key_copyBibliography') + .setAttribute('key', Zotero.Keys.getKeyForCommand('copySelectedItemsToClipboard')); + ZoteroStandalone.DebugOutput.init(); Zotero.hideZoteroPaneOverlays(); @@ -132,6 +137,31 @@ const ZoteroStandalone = new function() { } } + + this.updateQuickCopyOptions = function () { + var format = Zotero.QuickCopy.getFormatFromURL(Zotero.QuickCopy.lastActiveURL); + format = Zotero.QuickCopy.unserializeSetting(format); + + var copyCitation = document.getElementById('menu_copyCitation'); + var copyBibliography = document.getElementById('menu_copyBibliography'); + var copyExport = document.getElementById('menu_copyExport'); + + copyCitation.hidden = format.mode != 'bibliography'; + copyBibliography.hidden = format.mode != 'bibliography'; + copyExport.hidden = format.mode != 'export'; + if (format.mode == 'export') { + try { + let obj = Zotero.Translators.get(format.id); + copyExport.label = Zotero.getString('quickCopy.copyAs', obj.label); + } + catch (e) { + Zotero.logError(e); + copyExport.hidden = true; + } + } + }; + + this.updateAddonsPane = function (doc) { // Hide unsigned add-on verification warnings // diff --git a/chrome/content/zotero/standalone/standalone.xul b/chrome/content/zotero/standalone/standalone.xul index 648b44dc1f..54731528e9 100644 --- a/chrome/content/zotero/standalone/standalone.xul +++ b/chrome/content/zotero/standalone/standalone.xul @@ -73,6 +73,12 @@ key="&importCmd.key;" command="cmd_zotero_importFromClipboard" modifiers="accel shift alt"/> + + @@ -136,17 +142,28 @@ - + - - +