Просмотр исходного кода

Ticket #5521 - Show/Hide password doesn't work when Lucide iconset is enabled.

AntonLV 4 месяцев назад
Родитель
Сommit
c29f9763ed
2 измененных файлов с 6 добавлено и 7 удалено
  1. 5 6
      inc/js/jquery.webForms.js
  2. 1 1
      template/form_field_password.html

+ 5 - 6
inc/js/jquery.webForms.js

@@ -147,19 +147,18 @@
             });
 
             $(this).find("a").on("click", function () {
-                var oIcon = $(this).find("i");
-                var oLink = oIcon.parents("a:first");
-                var oFld = $(this).parents(".bx-form-input-wrapper-password:first").find("input");
-                if (oIcon.hasClass("eye")) {
-                    oIcon.removeClass("eye").addClass("eye-slash");
+                var oLink = $(this);
+                var oFld = oLink.parents(".bx-form-input-wrapper-password:first").find("input");
+                if (oLink.hasClass('password-show')) {
                     oLink.attr('title', _t('_sys_form_input_password_hide'));
                     oFld.attr("type", "text");
                 }
                 else {
-                    oIcon.addClass("eye").removeClass("eye-slash");
                     oLink.attr('title', _t('_sys_form_input_password_show'));
                     oFld.attr("type", "password");
                 }
+                oLink.toggleClass('password-show password-hide');
+                oLink.find('i').toggleClass('eye eye-slash');
             });
 
             $(this).addClass(sClassInited);

+ 1 - 1
template/form_field_password.html

@@ -1,2 +1,2 @@
 __input__
-<a href="javascript:void(0)" title="<bx_text_attribute:_sys_form_input_password_show />"><i class="sys-icon eye"></i></a>
+<a class="password-show" href="javascript:void(0)" title="<bx_text_attribute:_sys_form_input_password_show />"><i class="sys-icon eye"></i></a>