From db169cb9f0394b3c7ded3d252a3990d0391606fd Mon Sep 17 00:00:00 2001 From: George Raptis Date: Tue, 17 Sep 2019 17:30:04 +0300 Subject: [PATCH 1/3] Add password preview Co-authored-by: timvisee --- app/ui/archiveTile.js | 69 +++++++++++++++++++++++++++++++++++-------- assets/eye-off.svg | 1 + assets/eye.svg | 1 + 3 files changed, 58 insertions(+), 13 deletions(-) create mode 100644 assets/eye-off.svg create mode 100644 assets/eye.svg diff --git a/app/ui/archiveTile.js b/app/ui/archiveTile.js index 50c1e5bc..83382164 100644 --- a/app/ui/archiveTile.js +++ b/app/ui/archiveTile.js @@ -48,19 +48,37 @@ function password(state) { ${state.translate('addPassword')} - +
+ + +
-
+
-
@@ -89,19 +88,15 @@ function password(state) { function onPasswordPreviewButtonclicked(event) { event.preventDefault(); - const target = event.currentTarget; const input = document.getElementById('password-input'); - const eyeOn = target.querySelector('img:first-child'); - const eyeOff = target.querySelector('img:last-child'); + const eyeIcon = event.currentTarget.querySelector('img'); if (input.type === 'password') { input.type = 'text'; - eyeOn.classList.add('hidden'); - eyeOff.classList.remove('hidden'); + eyeIcon.src = assets.get('eye-off.svg'); } else { input.type = 'password'; - eyeOn.classList.remove('hidden'); - eyeOff.classList.add('hidden'); + eyeIcon.src = assets.get('eye.svg'); } input.focus();