Index: trunk/phase3/includes/specials/SpecialChangeEmail.php |
— | — | @@ -67,6 +67,7 @@ |
68 | 68 | |
69 | 69 | $out = $this->getOutput(); |
70 | 70 | $out->disallowUserJs(); |
| 71 | + $out->addModules( 'mediawiki.special.changeemail' ); |
71 | 72 | |
72 | 73 | $this->mPassword = $request->getVal( 'wpPassword' ); |
73 | 74 | $this->mNewEmail = $request->getVal( 'wpNewEmail' ); |
Index: trunk/phase3/resources/Resources.php |
— | — | @@ -720,6 +720,11 @@ |
721 | 721 | 'mediawiki.special.block' => array( |
722 | 722 | 'scripts' => 'resources/mediawiki.special/mediawiki.special.block.js', |
723 | 723 | ), |
| 724 | + 'mediawiki.special.changeemail' => array( |
| 725 | + 'scripts' => 'resources/mediawiki.special/mediawiki.special.changeemail.js', |
| 726 | + 'styles' => 'resources/mediawiki.special/mediawiki.special.changeemail.css', |
| 727 | + 'messages' => array( 'email-address-validity-valid', 'email-address-validity-invalid' ), |
| 728 | + ), |
724 | 729 | 'mediawiki.special.changeslist' => array( |
725 | 730 | 'styles' => 'resources/mediawiki.special/mediawiki.special.changeslist.css', |
726 | 731 | 'dependencies' => array( 'jquery.makeCollapsible' ), |
— | — | @@ -730,8 +735,6 @@ |
731 | 736 | ), |
732 | 737 | 'mediawiki.special.preferences' => array( |
733 | 738 | 'scripts' => 'resources/mediawiki.special/mediawiki.special.preferences.js', |
734 | | - 'styles' => 'resources/mediawiki.special/mediawiki.special.preferences.css', |
735 | | - 'messages' => array( 'email-address-validity-valid', 'email-address-validity-invalid' ), |
736 | 739 | ), |
737 | 740 | 'mediawiki.special.recentchanges' => array( |
738 | 741 | 'scripts' => 'resources/mediawiki.special/mediawiki.special.recentchanges.js', |
Index: trunk/phase3/resources/mediawiki.special/mediawiki.special.preferences.css |
— | — | @@ -1,21 +0,0 @@ |
2 | | -#mw-emailaddress-validity { |
3 | | - padding: 2px 1em; |
4 | | -} |
5 | | -body.ltr #mw-emailaddress-validity { |
6 | | - border-bottom-right-radius: 0.8em; |
7 | | - border-top-right-radius: 0.8em; |
8 | | -} |
9 | | -body.rtl #mw-emailaddress-validity { |
10 | | - border-bottom-left-radius: 0.8em; |
11 | | - border-top-left-radius: 0.8em; |
12 | | -} |
13 | | -#mw-emailaddress-validity.valid { |
14 | | - border: 1px solid #80FF80; |
15 | | - background-color: #C0FFC0; |
16 | | - color: black; |
17 | | -} |
18 | | -#mw-emailaddress-validity.invalid { |
19 | | - border: 1px solid #FF8080; |
20 | | - background-color: #FFC0C0; |
21 | | - color: black; |
22 | | -} |
Index: trunk/phase3/resources/mediawiki.special/mediawiki.special.changeemail.css |
— | — | @@ -0,0 +1,17 @@ |
| 2 | +#mw-emailaddress-validity { |
| 3 | + padding: 2px 1em; |
| 4 | +} |
| 5 | +#mw-emailaddress-validity { |
| 6 | + border-bottom-right-radius: 0.8em; |
| 7 | + border-top-right-radius: 0.8em; |
| 8 | +} |
| 9 | +#mw-emailaddress-validity.valid { |
| 10 | + border: 1px solid #80FF80; |
| 11 | + background-color: #C0FFC0; |
| 12 | + color: black; |
| 13 | +} |
| 14 | +#mw-emailaddress-validity.invalid { |
| 15 | + border: 1px solid #FF8080; |
| 16 | + background-color: #FFC0C0; |
| 17 | + color: black; |
| 18 | +} |
Property changes on: trunk/phase3/resources/mediawiki.special/mediawiki.special.changeemail.css |
___________________________________________________________________ |
Added: svn:eol-style |
1 | 19 | + native |
Index: trunk/phase3/resources/mediawiki.special/mediawiki.special.changeemail.js |
— | — | @@ -0,0 +1,38 @@ |
| 2 | +/* |
| 3 | + * JavaScript for Special:ChangeEmail |
| 4 | + */ |
| 5 | +( function( $, mw ) { |
| 6 | +/** |
| 7 | + * Given an email validity status (true, false, null) update the label CSS class |
| 8 | + */ |
| 9 | +var updateMailValidityLabel = function( mail ) { |
| 10 | + var isValid = mw.util.validateEmail( mail ), |
| 11 | + $label = $( '#mw-emailaddress-validity' ); |
| 12 | + |
| 13 | + // We allow empty address |
| 14 | + if( isValid === null ) { |
| 15 | + $label.text( '' ).removeClass( 'valid invalid' ); |
| 16 | + |
| 17 | + // Valid |
| 18 | + } else if ( isValid ) { |
| 19 | + $label.text( mw.msg( 'email-address-validity-valid' ) ).addClass( 'valid' ).removeClass( 'invalid' ); |
| 20 | + |
| 21 | + // Not valid |
| 22 | + } else { |
| 23 | + $label.text( mw.msg( 'email-address-validity-invalid' ) ).addClass( 'invalid' ).removeClass( 'valid' ); |
| 24 | + } |
| 25 | +}; |
| 26 | + |
| 27 | +// Lame tip to let user know if its email is valid. See bug 22449 |
| 28 | +// Only bind once for 'blur' so that the user can fill it in without errors |
| 29 | +// After that look at every keypress for direct feedback if it was invalid onblur |
| 30 | +$( '#wpNewEmail' ).one( 'blur', function() { |
| 31 | + if ( $( '#mw-emailaddress-validity' ).length === 0 ) { |
| 32 | + $(this).after( '<label for="wpNewEmail" id="mw-emailaddress-validity"></label>' ); |
| 33 | + } |
| 34 | + updateMailValidityLabel( $(this).val() ); |
| 35 | + $(this).keyup( function() { |
| 36 | + updateMailValidityLabel( $(this).val() ); |
| 37 | + } ); |
| 38 | +} ); |
| 39 | +} )( jQuery, mediaWiki ); |
\ No newline at end of file |
Property changes on: trunk/phase3/resources/mediawiki.special/mediawiki.special.changeemail.js |
___________________________________________________________________ |
Added: svn:eol-style |
1 | 40 | + native |
Index: trunk/phase3/resources/mediawiki.special/mediawiki.special.preferences.js |
— | — | @@ -58,42 +58,7 @@ |
59 | 59 | } |
60 | 60 | } ); |
61 | 61 | |
62 | | -/** |
63 | | - * Given an email validity status (true, false, null) update the label CSS class |
64 | | - */ |
65 | | -var updateMailValidityLabel = function( mail ) { |
66 | | - var isValid = mw.util.validateEmail( mail ), |
67 | | - $label = $( '#mw-emailaddress-validity' ); |
68 | 62 | |
69 | | - // We allow empty address |
70 | | - if( isValid === null ) { |
71 | | - $label.text( '' ).removeClass( 'valid invalid' ); |
72 | | - |
73 | | - // Valid |
74 | | - } else if ( isValid ) { |
75 | | - $label.text( mw.msg( 'email-address-validity-valid' ) ).addClass( 'valid' ).removeClass( 'invalid' ); |
76 | | - |
77 | | - // Not valid |
78 | | - } else { |
79 | | - $label.text( mw.msg( 'email-address-validity-invalid' ) ).addClass( 'invalid' ).removeClass( 'valid' ); |
80 | | - } |
81 | | -}; |
82 | | - |
83 | | -// Lame tip to let user know if its email is valid. See bug 22449 |
84 | | -// Only bind once for 'blur' so that the user can fill it in without errors |
85 | | -// After that look at every keypress for direct feedback if it was invalid onblur |
86 | | -$( '#mw-input-wpemailaddress' ).one( 'blur', function() { |
87 | | - if ( $( '#mw-emailaddress-validity' ).length === 0 ) { |
88 | | - $(this).after( '<label for="mw-input-wpemailaddress" id="mw-emailaddress-validity"></label>' ); |
89 | | - } |
90 | | - updateMailValidityLabel( $(this).val() ); |
91 | | - $(this).keyup( function() { |
92 | | - updateMailValidityLabel( $(this).val() ); |
93 | | - } ); |
94 | | -} ); |
95 | | - |
96 | | - |
97 | | - |
98 | 63 | /** |
99 | 64 | * Timezone functions. |
100 | 65 | * Guesses Timezone from browser and updates fields onchange |