diff --git a/chrome/content/zotero/integration/addCitationDialog.js b/chrome/content/zotero/integration/addCitationDialog.js index 0ac77fb511..526347f952 100644 --- a/chrome/content/zotero/integration/addCitationDialog.js +++ b/chrome/content/zotero/integration/addCitationDialog.js @@ -607,7 +607,8 @@ var Zotero_Citation_Dialog = new function () { if (Zotero.Retractions.isRetracted({id: parseInt(item.id)})) { var ps = Services.prompt; var buttonFlags = ps.BUTTON_POS_0 * ps.BUTTON_TITLE_IS_STRING - + (ps.BUTTON_POS_1) * (ps.BUTTON_TITLE_CANCEL); + + ps.BUTTON_POS_1 * ps.BUTTON_TITLE_CANCEL + + ps.BUTTON_POS_2 * ps.BUTTON_TITLE_IS_STRING; var result = ps.confirmEx(null, Zotero.getString('general.warning'), Zotero.getString('retraction.citeWarning.text1') + '\n\n' @@ -615,8 +616,12 @@ var Zotero_Citation_Dialog = new function () { buttonFlags, Zotero.getString('general.continue'), null, - null, null, {}); - if (result != 0) { + Zotero.getString('pane.items.showItemInLibrary'), + null, {}); + if (result > 0) { + if (result == 2) { + _showItemInLibrary(parseInt(item.id)); + } return false; } break; @@ -824,4 +829,25 @@ var Zotero_Citation_Dialog = new function () { function _clearCitationList() { while(_citationList.firstChild) _citationList.removeChild(_citationList.firstChild); } + + async function _showItemInLibrary(id) { + var pane = Zotero.getActiveZoteroPane(); + // Open main window if it's not open (Mac) + if (!pane) { + let win = Zotero.openMainWindow(); + await new Zotero.Promise((resolve) => { + let onOpen = function () { + win.removeEventListener('load', onOpen); + resolve(); + }; + win.addEventListener('load', onOpen); + }); + pane = win.ZoteroPane; + } + pane.show(); + pane.selectItem(id); + + // Pull window to foreground + Zotero.Utilities.Internal.activate(pane.document.defaultView); + } } diff --git a/chrome/content/zotero/integration/quickFormat.js b/chrome/content/zotero/integration/quickFormat.js index 2cab51d52b..f012662dcb 100644 --- a/chrome/content/zotero/integration/quickFormat.js +++ b/chrome/content/zotero/integration/quickFormat.js @@ -725,7 +725,8 @@ var Zotero_QuickFormat = new function () { referencePanel.hidden = true; var ps = Services.prompt; var buttonFlags = ps.BUTTON_POS_0 * ps.BUTTON_TITLE_IS_STRING - + (ps.BUTTON_POS_1) * (ps.BUTTON_TITLE_CANCEL); + + ps.BUTTON_POS_1 * ps.BUTTON_TITLE_CANCEL + + ps.BUTTON_POS_2 * ps.BUTTON_TITLE_IS_STRING; var result = ps.confirmEx(null, Zotero.getString('general.warning'), Zotero.getString('retraction.citeWarning.text1') + '\n\n' @@ -733,9 +734,13 @@ var Zotero_QuickFormat = new function () { buttonFlags, Zotero.getString('general.continue'), null, - null, null, {}); + Zotero.getString('pane.items.showItemInLibrary'), + null, {}); referencePanel.hidden = false; - if (result != 0) { + if (result > 0) { + if (result == 2) { + Zotero_QuickFormat.showInLibrary(parseInt(citationItem.id)); + } return false; } } @@ -1333,8 +1338,8 @@ var Zotero_QuickFormat = new function () { /** * Show an item in the library it came from */ - this.showInLibrary = async function() { - var id = panelRefersToBubble.citationItem.id; + this.showInLibrary = async function (itemID) { + var id = itemID || parseInt(panelRefersToBubble.citationItem.id); var pane = Zotero.getActiveZoteroPane(); // Open main window if it's not open (Mac) if (!pane) {