Merge "resources: Strip '$' and 'mw' from file closures"
[lhc/web/wiklou.git] / resources / src / mediawiki.special.preferences / personalEmail.js
1 /*!
2 * JavaScript for Special:Preferences: Email preferences better UX
3 */
4 ( function () {
5 $( function () {
6 var allowEmail, allowEmailFromNewUsers;
7
8 allowEmail = $( '#wpAllowEmail' );
9 allowEmailFromNewUsers = $( '#wpAllowEmailFromNewUsers' );
10
11 function toggleDisabled() {
12 if ( allowEmail.is( ':checked' ) && allowEmail.is( ':enabled' ) ) {
13 allowEmailFromNewUsers.prop( 'disabled', false );
14 } else {
15 allowEmailFromNewUsers.prop( 'disabled', true );
16 }
17 }
18
19 if ( allowEmail ) {
20 allowEmail.on( 'change', toggleDisabled );
21 toggleDisabled();
22 }
23 } );
24 }() );