www

Unnamed repository; edit this file 'description' to name the repository.
Log | Files | Refs | Submodules | README | LICENSE

commit 352eff2f0472be16cf8fd6d1114e6ef9e362233a
parent fa541106c2fc5daa787e37aaeeed2db668527976
Author: Dan Stillman <dstillman@zotero.org>
Date:   Sat, 23 Apr 2016 03:19:16 -0400

Allow typing of usernames with spaces in the middle

Diffstat:
Mchrome/content/zotero/preferences/preferences_sync.js | 18+++++++++++++++---
Mchrome/content/zotero/preferences/preferences_sync.xul | 1+
2 files changed, 16 insertions(+), 3 deletions(-)

diff --git a/chrome/content/zotero/preferences/preferences_sync.js b/chrome/content/zotero/preferences/preferences_sync.js @@ -85,7 +85,6 @@ Zotero_Preferences.Sync = { credentialsKeyPress: function (event) { var username = document.getElementById('sync-username-textbox'); - username.value = username.value.trim(); var password = document.getElementById('sync-password'); var syncAuthButton = document.getElementById('sync-auth-button'); @@ -103,9 +102,22 @@ Zotero_Preferences.Sync = { Zotero_Preferences.Sync.linkAccount(event); } }, - - + + + trimUsername: function () { + var tb = document.getElementById('sync-username-textbox'); + var username = tb.value; + var trimmed = username.trim(); + if (username != trimmed) { + tb.value = trimmed; + // Setting .value alone doesn't seem to cause the pref to sync, so set it manually + Zotero.Prefs.set('sync.server.username', trimmed); + } + }, + + linkAccount: Zotero.Promise.coroutine(function* (event) { + this.trimUsername(); var username = document.getElementById('sync-username-textbox').value; var password = document.getElementById('sync-password').value; diff --git a/chrome/content/zotero/preferences/preferences_sync.xul b/chrome/content/zotero/preferences/preferences_sync.xul @@ -67,6 +67,7 @@ <label value="&zotero.preferences.sync.username;"/> <textbox id="sync-username-textbox" preference="pref-sync-username" + onblur="Zotero_Preferences.Sync.trimUsername()" onkeypress="Zotero_Preferences.Sync.credentialsKeyPress(event);"/> </row> <row>