From 5ea82076faddbdf6b34d20332507779de3c71ae3 Mon Sep 17 00:00:00 2001 From: Marien Fressinaud Date: Thu, 5 Jun 2014 21:56:58 +0200 Subject: Improve toggle-password Add class "active" to button which reveals the password and remove it when revealing is terminated --- p/scripts/main.js | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) (limited to 'p/scripts') diff --git a/p/scripts/main.js b/p/scripts/main.js index e1a19d6ac..f1dd7117c 100644 --- a/p/scripts/main.js +++ b/p/scripts/main.js @@ -1008,12 +1008,18 @@ function init_feed_observers() { function init_password_observers() { $('input[type="password"] + a.btn.toggle-password').on('click', function(e) { - e.preventDefault(); + var button = $(this); var passwordField = $(this).siblings('input[type="password"]'); + passwordField.attr('type', 'text'); + button.addClass('active'); + setTimeout(function() { passwordField.attr('type', 'password'); + button.removeClass('active'); }, 2000); + + return false; }); } -- cgit v1.2.3