From b5865f00e96391a80fcf6166611e5e6ffaa8a5c8 Mon Sep 17 00:00:00 2001 From: George Raptis Date: Wed, 18 Sep 2019 10:34:24 +0300 Subject: [PATCH] toggle preview image src instead of havingtwo images Co-authored-by: timvisee --- app/ui/archiveTile.js | 21 ++++++++------------- 1 file changed, 8 insertions(+), 13 deletions(-) diff --git a/app/ui/archiveTile.js b/app/ui/archiveTile.js index 83382164..2028a980 100644 --- a/app/ui/archiveTile.js +++ b/app/ui/archiveTile.js @@ -48,12 +48,12 @@ 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();