add button to password fields for toggling visibility

This commit is contained in:
Uwe Steinmann 2025-12-02 13:52:03 +01:00
parent 62145c2f4e
commit ac22269120
2 changed files with 17 additions and 1 deletions

View File

@ -1269,7 +1269,7 @@ background-image: linear-gradient(to bottom, #882222, #111111);;
break;
default:
if(!empty($value['addon']))
echo "<span class=\"input-append\">";
echo '<span class="input-append'.($value["type"]=='password' ? ' show-hide-password' : '').'">';
echo '<input'.
(!empty($value['type']) ? ' type="'.$value['type'].'"' : '').
(!empty($value['id']) ? ' id="'.$value['id'].'"' : '').

View File

@ -369,6 +369,22 @@ $(document).ready( function() {
$($(this).data("target")+' .modal-header h3').html($(this).data("modal-title"));
}); /* }}} */
$('body').on('click', 'span.show-hide-password span', function(ev) { /* {{{ */
ev.preventDefault();
div = $(this).closest('span.show-hide-password');
icon = $(this).children(":first");
input = div.children(":first");
if (input.attr("type") == "text") {
input.attr('type', 'password');
icon.addClass( "fa-eye-slash" );
icon.removeClass( "fa-eye" );
} else if (input.attr("type") == "password") {
input.attr('type', 'text');
icon.removeClass( "fa-eye-slash" );
icon.addClass( "fa-eye" );
}
}); /* }}} */
$('body').on('touchstart.dropdown', '.dropdown-menu', function (e) { e.stopPropagation(); });
initMost();