From 6af5732fca6ddcbd00595f4e2b90b40a8cb885f7 Mon Sep 17 00:00:00 2001 From: Dan Stillman Date: Tue, 3 Dec 2019 15:33:31 -0700 Subject: [PATCH] Fix checkmark in libraries-to-sync window on Windows And switch to Unicode green checkmark and red prohibited characters on all platforms, which fixes #1675. The treecol checkmark stopped working on Windows in Fx60. --- .../zotero/preferences/librariesToSync.xul | 2 +- .../zotero/preferences/preferences_sync.js | 16 +++++++++++++--- 2 files changed, 14 insertions(+), 4 deletions(-) diff --git a/chrome/content/zotero/preferences/librariesToSync.xul b/chrome/content/zotero/preferences/librariesToSync.xul index e11d842c2d..20da833ccf 100644 --- a/chrome/content/zotero/preferences/librariesToSync.xul +++ b/chrome/content/zotero/preferences/librariesToSync.xul @@ -52,7 +52,7 @@ onclick="Zotero_Preferences.Sync.clickLibraryToSync(event)" onkeyup="if (event.keyCode == event.DOM_VK_SPACE) { Zotero_Preferences.Sync.toggleLibraryToSync(this.currentIndex); }"> - + diff --git a/chrome/content/zotero/preferences/preferences_sync.js b/chrome/content/zotero/preferences/preferences_sync.js index b1dcf9fcca..eb524ab3e2 100644 --- a/chrome/content/zotero/preferences/preferences_sync.js +++ b/chrome/content/zotero/preferences/preferences_sync.js @@ -29,6 +29,9 @@ Components.utils.import("resource://gre/modules/osfile.jsm"); Components.utils.import("resource://zotero/config.js"); Zotero_Preferences.Sync = { + checkmarkChar: '\u2705', + noChar: '\uD83D\uDEAB', + init: Zotero.Promise.coroutine(function* () { this.updateStorageSettingsUI(); this.updateStorageSettingsGroupsUI(); @@ -273,6 +276,8 @@ Zotero_Preferences.Sync = { Zotero.Prefs.set('sync.librariesToSkip', JSON.stringify(librariesToSkip)); var cell = row.firstChild.firstChild; + var spacing = Zotero.isMac ? ' ' : ' '; + cell.setAttribute('label', spacing + (indexOfId != -1 ? this.checkmarkChar : this.noChar)); cell.setAttribute('value', indexOfId != -1); }, @@ -284,7 +289,7 @@ Zotero_Preferences.Sync = { treechildren.removeChild(treechildren.firstChild); } - function addRow(libraryName, id, checked=false, editable=true) { + var addRow = function (libraryName, id, checked=false, editable=true) { var treeitem = document.createElement('treeitem'); var treerow = document.createElement('treerow'); var checkboxCell = document.createElement('treecell'); @@ -293,14 +298,19 @@ Zotero_Preferences.Sync = { nameCell.setAttribute('label', libraryName); nameCell.setAttribute('value', id); nameCell.setAttribute('editable', false); + var spacing = Zotero.isMac ? ' ' : ' '; + checkboxCell.setAttribute( + 'label', + id == 'loading' ? '' : (spacing + (checked ? this.checkmarkChar : this.noChar)) + ); checkboxCell.setAttribute('value', checked); - checkboxCell.setAttribute('editable', editable); + checkboxCell.setAttribute('editable', false); treerow.appendChild(checkboxCell); treerow.appendChild(nameCell); treeitem.appendChild(treerow); treechildren.appendChild(treeitem); - } + }.bind(this); // Add loading row while we're loading a group list var loadingLabel = Zotero.getString("zotero.preferences.sync.librariesToSync.loadingLibraries");