From 3ff92e2795fcae2c6e6f2ec3f9eb88f5d22e7736 Mon Sep 17 00:00:00 2001 From: Dan Stillman Date: Thu, 25 Feb 2021 16:08:54 -0500 Subject: [PATCH] Add "More Information" button to invalid-data sync error --- .../content/zotero/xpcom/sync/syncRunner.js | 20 ++++++++++++++++++- 1 file changed, 19 insertions(+), 1 deletion(-) diff --git a/chrome/content/zotero/xpcom/sync/syncRunner.js b/chrome/content/zotero/xpcom/sync/syncRunner.js index 6d30dadca4..61d97e85b6 100644 --- a/chrome/content/zotero/xpcom/sync/syncRunner.js +++ b/chrome/content/zotero/xpcom/sync/syncRunner.js @@ -1289,6 +1289,10 @@ Zotero.Sync.Runner_Module = function (options = {}) { e.dialogButtonCallback = () => { Zotero.openCheckForUpdatesWindow(); }; + e.dialogButton2Text = Zotero.getString('general.moreInformation'); + e.dialogButton2Callback = () => { + Zotero.launchURL('https://www.zotero.org/support/kb/unknown_data_error'); + }; } // Otherwise just show in sync button tooltip else { @@ -1501,13 +1505,27 @@ Zotero.Sync.Runner_Module = function (options = {}) { var buttonCallback = e.dialogButtonCallback; } - var button = doc.createElement('button'); + let button = doc.createElement('button'); button.setAttribute('label', buttonText); button.onclick = function () { buttonCallback(); panel.hidePopup(); }; buttons.appendChild(button); + + // Second button + if (e.dialogButton2Text) { + buttonText = e.dialogButton2Text; + buttonCallback = e.dialogButton2Callback; + + let button2 = doc.createElement('button'); + button2.setAttribute('label', buttonText); + button2.onclick = () => { + buttonCallback(); + panel.hidePopup(); + }; + buttons.insertBefore(button2, button); + } } panel.appendChild(box)