1(function($) { 2 __ = wp.i18n.__; 3 4 function resetToggle( $button, show ) { 5 $button 6 .attr({ 7 'aria-label': show ? __( 'Show password' ) : __( 'Hide password' ) 8 }) 9 .find( '.text' ) 10 .text( show ? __( 'Show' ) : __( 'Hide' ) ) 11 .end() 12 .find( '.dashicons' ) 13 .removeClass( show ? 'dashicons-hidden' : 'dashicons-visibility' ) 14 .addClass( show ? 'dashicons-visibility' : 'dashicons-hidden' ); 15 } 16 17 $(document).ready( function() { 18 $('body').on('click', 'button.mp-hide-pw', function () { 19 var $button = $(this), 20 $pass = $button.siblings('#user_pass'); 21 22 // Detect alternative password field if the default one is not found. 23 if( ! $pass.length ){ 24 $pass = $button.parent('div.mp-hide-pw').find('input'); 25 } 26 27 // Bailout if the password field is not found. 28 if( ! $pass.length ){ 29 return; 30 } 31 32 if ( 'password' === $pass.attr( 'type' ) ) { 33 $pass.attr( 'type', 'text' ); 34 resetToggle( $button, false ); 35 } else { 36 $pass.attr( 'type', 'password' ); 37 resetToggle( $button, true ); 38 } 39 }); 40 41 // Pro Template 42 if( $('#mepro-login-hero').length ){ 43 if( $('#mepr_loginform').length ){ 44 $("#user_login, #user_pass").on("input", function(){ 45 if ( $('#user_login').val().length > 0 && $('#user_pass').val().length > 0) { 46 $('#wp-submit').removeClass('disabled'); 47 } 48 }) 49 } 50 } 51 52 // Handle form labels 53 const $usernameInput = $('#user_login'); 54 const $passwordInput = $('#user_pass'); 55 const $usernameLabel = $usernameInput.closest('.mp-form-row').find('label'); 56 const $passwordLabel = $passwordInput.closest('.mp-form-row').find('label'); 57 58 handleFormLabels(null, $usernameInput, $usernameLabel); 59 handleFormLabels(null, $passwordInput, $passwordLabel); 60 61 $usernameInput.on('keyup', function(event) { 62 handleFormLabels(event, $usernameInput, $usernameLabel); 63 }); 64 $passwordInput.on('keyup', function(event) { 65 handleFormLabels(event, $passwordInput, $passwordLabel); 66 }); 67 68 function handleFormLabels(event, input, label) { 69 if (input.val() === '') { 70 label.removeClass('active'); 71 } else { 72 label.addClass('active'); 73 } 74 } 75 // End Pro Template 76 }); 77})(jQuery);
Line numbers count LF bytes from the start of the resource, as the search results do. Vendor segments are library code the classifier recognised; they are stored but not indexed. Bytes are shown as Latin1 characters, one per byte.