2 * JavaScript for signup form.
5 // When sending password by email, hide the password input fields.
6 function hidePasswordOnEmail() {
7 // Always required if checked, otherwise it depends, so we use the original
8 var $emailLabel
= $( 'label[for="wpEmail"]' ),
9 originalText
= $emailLabel
.text(),
10 requiredText
= mw
.message( 'createacct-emailrequired' ).text(),
11 $createByMailCheckbox
= $( '#wpCreateaccountMail' ),
12 $beforePwds
= $( '.mw-row-password:first' ).prev(),
15 function updateForCheckbox() {
16 var checked
= $createByMailCheckbox
.prop( 'checked' );
18 $pwds
= $( '.mw-row-password' ).detach();
19 $emailLabel
.text( requiredText
);
22 $beforePwds
.after( $pwds
);
25 $emailLabel
.text( originalText
);
29 $createByMailCheckbox
.on( 'change', updateForCheckbox
);
33 $( hidePasswordOnEmail
);
34 }( mediaWiki
, jQuery
) );