From c65322d0a45a424d962aacf56738db3f71ee8d2f Mon Sep 17 00:00:00 2001 From: Dan Stillman Date: Sat, 23 May 2020 03:17:34 -0400 Subject: [PATCH] Clarify warnings about data removal when switching accounts And improve styling of hardConfirmationDialog.xul Closes #1359 --- .../content/zotero/hardConfirmationDialog.js | 36 +++++++++++++------ .../content/zotero/hardConfirmationDialog.xul | 7 +++- chrome/content/zotero/xpcom/sync/syncLocal.js | 21 ++++++++--- chrome/locale/en-US/zotero/zotero.properties | 5 +-- .../default/zotero/hardConfirmationDialog.css | 11 ++++++ test/tests/syncLocalTest.js | 11 +++--- 6 files changed, 68 insertions(+), 23 deletions(-) create mode 100644 chrome/skin/default/zotero/hardConfirmationDialog.css diff --git a/chrome/content/zotero/hardConfirmationDialog.js b/chrome/content/zotero/hardConfirmationDialog.js index 5b03998102..44809c77b6 100644 --- a/chrome/content/zotero/hardConfirmationDialog.js +++ b/chrome/content/zotero/hardConfirmationDialog.js @@ -25,16 +25,24 @@ Zotero.HardConfirmationDialog = { init: function() { - var label, content; this.io = window.arguments[0]; + Zotero.setFontSize(document.getElementById('zotero-hardConfirmationDialog')); + var vbox = document.getElementById('infoContainer'); var sep = vbox.firstChild; - for (let text of this.io.text) { - label = document.createElement('label'); - content = document.createTextNode(text); - label.appendChild(content); - vbox.insertBefore(label, sep); + + document.getElementById('infoBody').textContent = this.io.text; + + if (this.io.title) { + document.documentElement.setAttribute('title', this.io.title); + + if (Zotero.isMac) { + let elem = document.getElementById('infoTitle'); + elem.textContent = this.io.title; + elem.style.marginBottom = '12px'; + elem.hidden = false; + } } if (this.io.checkboxLabel) { var checkbox = document.getElementById('zotero-hardConfirmationDialog-checkbox'); @@ -47,14 +55,17 @@ Zotero.HardConfirmationDialog = { this.onKeyUp(); } + if (this.io.acceptLabel) { + document.documentElement.getButton('accept').label = this.io.acceptLabel + } if (this.io.extra1Label) { document.documentElement.buttons = document.documentElement.buttons + ',extra1'; document.documentElement.getButton('extra1').label = this.io.extra1Label - } if (this.io.acceptLabel) { - document.documentElement.getButton('accept').label = this.io.acceptLabel } - - document.documentElement.setAttribute('title', this.io.title); + if (this.io.extra2Label) { + document.documentElement.buttons = document.documentElement.buttons + ',extra2'; + document.documentElement.getButton('extra2').label = this.io.extra2Label + } }, onCheckbox: function(event) { @@ -74,5 +85,10 @@ Zotero.HardConfirmationDialog = { onExtra1: function() { this.io.extra1 = true; document.documentElement.cancelDialog(); + }, + + onExtra2: function() { + this.io.extra2 = true; + document.documentElement.cancelDialog(); } }; diff --git a/chrome/content/zotero/hardConfirmationDialog.xul b/chrome/content/zotero/hardConfirmationDialog.xul index c3c6d5f6a0..771f1e64a6 100644 --- a/chrome/content/zotero/hardConfirmationDialog.xul +++ b/chrome/content/zotero/hardConfirmationDialog.xul @@ -28,6 +28,7 @@ + %zoteroDTD; ]> @@ -36,7 +37,8 @@ id="zotero-hardConfirmationDialog" onload="Zotero.HardConfirmationDialog.init(); sizeToContent();" ondialogaccept="Zotero.HardConfirmationDialog.onAccept();" - ondialogextra1="Zotero.HardConfirmationDialog.onExtra1();"> + ondialogextra1="Zotero.HardConfirmationDialog.onExtra1();" + ondialogextra2="Zotero.HardConfirmationDialog.onExtra2();">