فهرست منبع

Improve toggle-password

Add class "active" to button which reveals the password and remove it
when revealing is terminated
Marien Fressinaud 12 سال پیش
والد
کامیت
5ea82076fa
1فایلهای تغییر یافته به همراه7 افزوده شده و 1 حذف شده
  1. 7 1
      p/scripts/main.js

+ 7 - 1
p/scripts/main.js

@@ -1008,12 +1008,18 @@ function init_feed_observers() {
 
 
 function init_password_observers() {
 function init_password_observers() {
 	$('input[type="password"] + a.btn.toggle-password').on('click', function(e) {
 	$('input[type="password"] + a.btn.toggle-password').on('click', function(e) {
-		e.preventDefault();
+		var button = $(this);
 		var passwordField = $(this).siblings('input[type="password"]');
 		var passwordField = $(this).siblings('input[type="password"]');
+
 		passwordField.attr('type', 'text');
 		passwordField.attr('type', 'text');
+		button.addClass('active');
+
 		setTimeout(function() {
 		setTimeout(function() {
 			passwordField.attr('type', 'password');
 			passwordField.attr('type', 'password');
+			button.removeClass('active');
 		}, 2000);
 		}, 2000);
+
+		return false;
 	});
 	});
 }
 }