Index: trunk/phase3/resources/mediawiki.special/mediawiki.specials.preferences.js |
— | — | @@ -1,127 +0,0 @@ |
2 | | -/* |
3 | | - * JavaScript for Special:Preferences |
4 | | - */ |
5 | | - |
6 | | -$( '#prefsubmit' ).attr( 'id', 'prefcontrol' ); |
7 | | -$( '#preferences' ) |
8 | | - .addClass( 'jsprefs' ) |
9 | | - .before( $( '<ul id="preftoc"></ul>' ) ) |
10 | | - .children( 'fieldset' ) |
11 | | - .hide() |
12 | | - .addClass( 'prefsection' ) |
13 | | - .children( 'legend' ) |
14 | | - .addClass( 'mainLegend' ) |
15 | | - .each( function( i ) { |
16 | | - $(this).parent().attr( 'id', 'prefsection-' + i ); |
17 | | - if ( i === 0 ) { |
18 | | - $(this).parent().show(); |
19 | | - } |
20 | | - $( '#preftoc' ).append( |
21 | | - $( '<li></li>' ) |
22 | | - .addClass( i === 0 ? 'selected' : null ) |
23 | | - .append( |
24 | | - $( '<a></a>') |
25 | | - .text( $(this).text() ) |
26 | | - .attr( 'href', '#prefsection-' + i ) |
27 | | - .mousedown( function( e ) { |
28 | | - $(this).parent().parent().find( 'li' ).removeClass( 'selected' ); |
29 | | - $(this).parent().addClass( 'selected' ); |
30 | | - e.preventDefault(); |
31 | | - return false; |
32 | | - } ) |
33 | | - .click( function( e ) { |
34 | | - $( '#preferences > fieldset' ).hide(); |
35 | | - $( '#prefsection-' + i ).show(); |
36 | | - e.preventDefault(); |
37 | | - return false; |
38 | | - } ) |
39 | | - ) |
40 | | - ); |
41 | | - } ); |
42 | | - |
43 | | -// Lame tip to let user know if its email is valid. See bug 22449 |
44 | | -$( '#mw-input-emailaddress' ) |
45 | | - .keyup( function () { |
46 | | - if( $( "#mw-emailaddress-validity" ).length == 0 ) { |
47 | | - $(this).after( '<label for="mw-input-emailaddress" id="mw-emailaddress-validity"></label>' ); |
48 | | - } |
49 | | - var isValid = wfValidateEmail( $(this).val() ); |
50 | | - var class_to_add = isValid ? 'valid' : 'invalid'; |
51 | | - var class_to_remove = isValid ? 'invalid' : 'valid'; |
52 | | - $( '#mw-emailaddress-validity' ) |
53 | | - .text( isValid ? 'Looks valid' : 'Valid address required!' ) |
54 | | - .addClass( class_to_add ) |
55 | | - .removeClass( class_to_remove ); |
56 | | - } ); |
57 | | - |
58 | | -/** |
59 | | - * Validate a string as representing a valid e-mail address |
60 | | - * according to HTML5 specification. Please note the specification |
61 | | - * does not validate a domain with one character. |
62 | | - * |
63 | | - * FIXME: should be moved to a JavaScript validation module. |
64 | | - */ |
65 | | -wfValidateEmail = function( mailtxt ) { |
66 | | - if( mailtxt == '' ) { return null; } |
67 | | - |
68 | | - /** |
69 | | - * HTML 5 define a string as valid e-mail address if it matches |
70 | | - * the ABNF : |
71 | | - * 1 * ( atext / "." ) "@" ldh-str 1*( "." ldh-str ) |
72 | | - * With: |
73 | | - * - atext : defined in RFC 5322 section 3.2.3 |
74 | | - * - ldh-str : defined in RFC 1034 section 3.5 |
75 | | - * |
76 | | - * (see STD 68 / RFC 5234 http://tools.ietf.org/html/std68): |
77 | | - */ |
78 | | - |
79 | | - /** |
80 | | - * First, define the RFC 5322 'atext' which is pretty easy : |
81 | | - * atext = ALPHA / DIGIT / ; Printable US-ASCII |
82 | | - "!" / "#" / ; characters not including |
83 | | - "$" / "%" / ; specials. Used for atoms. |
84 | | - "&" / "'" / |
85 | | - "*" / "+" / |
86 | | - "-" / "/" / |
87 | | - "=" / "?" / |
88 | | - "^" / "_" / |
89 | | - "`" / "{" / |
90 | | - "|" / "}" / |
91 | | - "~" |
92 | | - */ |
93 | | - var rfc5322_atext = "a-z0-9!#$%&'*+-/=?^_`{|}—~" ; |
94 | | - |
95 | | - /** |
96 | | - * Next define the RFC 1034 'ldh-str' |
97 | | - * <domain> ::= <subdomain> | " " |
98 | | - * <subdomain> ::= <label> | <subdomain> "." <label> |
99 | | - * <label> ::= <letter> [ [ <ldh-str> ] <let-dig> ] |
100 | | - * <ldh-str> ::= <let-dig-hyp> | <let-dig-hyp> <ldh-str> |
101 | | - * <let-dig-hyp> ::= <let-dig> | "-" |
102 | | - * <let-dig> ::= <letter> | <digit> |
103 | | - */ |
104 | | - var rfc1034_ldh_str = "a-z0-9-" ; |
105 | | - |
106 | | - var HTML5_email_regexp = new RegExp( |
107 | | - // start of string |
108 | | - '^' |
109 | | - + |
110 | | - // User part which is liberal :p |
111 | | - '[' + rfc5322_atext + '\\.' + ']' + '+' |
112 | | - + |
113 | | - // "apostrophe" |
114 | | - '@' |
115 | | - + |
116 | | - // Domain first part |
117 | | - '[' + rfc1034_ldh_str + ']+' |
118 | | - + |
119 | | - // Second part and following are separated by a dot |
120 | | - '(\\.[' + rfc1034_ldh_str + ']+)+' |
121 | | - + |
122 | | - // End of string |
123 | | - '$', |
124 | | - // RegExp is case insensitive |
125 | | - 'i' |
126 | | - ); |
127 | | - return mailtxt.match( HTML5_email_regexp ); |
128 | | -}; |
Index: trunk/phase3/resources/mediawiki.special/mediawiki.specials.search.js |
— | — | @@ -1,8 +0,0 @@ |
2 | | -/* |
3 | | - * JavaScript for Specical:Search |
4 | | - */ |
5 | | - |
6 | | -// Emulate HTML5 autofocus behavior in non HTML5 compliant browsers |
7 | | -if ( !( 'autofocus' in document.createElement( 'input' ) ) ) { |
8 | | - $( 'input[autofocus]' ).focus(); |
9 | | -} |
Index: trunk/phase3/resources/mediawiki.special/mediawiki.specials.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.search.js |
— | — | @@ -0,0 +1,8 @@ |
| 2 | +/* |
| 3 | + * JavaScript for Specical:Search |
| 4 | + */ |
| 5 | + |
| 6 | +// Emulate HTML5 autofocus behavior in non HTML5 compliant browsers |
| 7 | +if ( !( 'autofocus' in document.createElement( 'input' ) ) ) { |
| 8 | + $( 'input[autofocus]' ).focus(); |
| 9 | +} |
Property changes on: trunk/phase3/resources/mediawiki.special/mediawiki.special.search.js |
___________________________________________________________________ |
Added: svn:eol-style |
1 | 10 | + native |
Index: trunk/phase3/resources/mediawiki.special/mediawiki.special.preferences.css |
— | — | @@ -0,0 +1,21 @@ |
| 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 | +} |
Property changes on: trunk/phase3/resources/mediawiki.special/mediawiki.special.preferences.css |
___________________________________________________________________ |
Added: svn:eol-style |
1 | 23 | + native |
Index: trunk/phase3/resources/mediawiki.special/mediawiki.special.preferences.js |
— | — | @@ -0,0 +1,127 @@ |
| 2 | +/* |
| 3 | + * JavaScript for Special:Preferences |
| 4 | + */ |
| 5 | + |
| 6 | +$( '#prefsubmit' ).attr( 'id', 'prefcontrol' ); |
| 7 | +$( '#preferences' ) |
| 8 | + .addClass( 'jsprefs' ) |
| 9 | + .before( $( '<ul id="preftoc"></ul>' ) ) |
| 10 | + .children( 'fieldset' ) |
| 11 | + .hide() |
| 12 | + .addClass( 'prefsection' ) |
| 13 | + .children( 'legend' ) |
| 14 | + .addClass( 'mainLegend' ) |
| 15 | + .each( function( i ) { |
| 16 | + $(this).parent().attr( 'id', 'prefsection-' + i ); |
| 17 | + if ( i === 0 ) { |
| 18 | + $(this).parent().show(); |
| 19 | + } |
| 20 | + $( '#preftoc' ).append( |
| 21 | + $( '<li></li>' ) |
| 22 | + .addClass( i === 0 ? 'selected' : null ) |
| 23 | + .append( |
| 24 | + $( '<a></a>') |
| 25 | + .text( $(this).text() ) |
| 26 | + .attr( 'href', '#prefsection-' + i ) |
| 27 | + .mousedown( function( e ) { |
| 28 | + $(this).parent().parent().find( 'li' ).removeClass( 'selected' ); |
| 29 | + $(this).parent().addClass( 'selected' ); |
| 30 | + e.preventDefault(); |
| 31 | + return false; |
| 32 | + } ) |
| 33 | + .click( function( e ) { |
| 34 | + $( '#preferences > fieldset' ).hide(); |
| 35 | + $( '#prefsection-' + i ).show(); |
| 36 | + e.preventDefault(); |
| 37 | + return false; |
| 38 | + } ) |
| 39 | + ) |
| 40 | + ); |
| 41 | + } ); |
| 42 | + |
| 43 | +// Lame tip to let user know if its email is valid. See bug 22449 |
| 44 | +$( '#mw-input-emailaddress' ) |
| 45 | + .keyup( function () { |
| 46 | + if( $( "#mw-emailaddress-validity" ).length == 0 ) { |
| 47 | + $(this).after( '<label for="mw-input-emailaddress" id="mw-emailaddress-validity"></label>' ); |
| 48 | + } |
| 49 | + var isValid = wfValidateEmail( $(this).val() ); |
| 50 | + var class_to_add = isValid ? 'valid' : 'invalid'; |
| 51 | + var class_to_remove = isValid ? 'invalid' : 'valid'; |
| 52 | + $( '#mw-emailaddress-validity' ) |
| 53 | + .text( isValid ? 'Looks valid' : 'Valid address required!' ) |
| 54 | + .addClass( class_to_add ) |
| 55 | + .removeClass( class_to_remove ); |
| 56 | + } ); |
| 57 | + |
| 58 | +/** |
| 59 | + * Validate a string as representing a valid e-mail address |
| 60 | + * according to HTML5 specification. Please note the specification |
| 61 | + * does not validate a domain with one character. |
| 62 | + * |
| 63 | + * FIXME: should be moved to a JavaScript validation module. |
| 64 | + */ |
| 65 | +wfValidateEmail = function( mailtxt ) { |
| 66 | + if( mailtxt == '' ) { return null; } |
| 67 | + |
| 68 | + /** |
| 69 | + * HTML 5 define a string as valid e-mail address if it matches |
| 70 | + * the ABNF : |
| 71 | + * 1 * ( atext / "." ) "@" ldh-str 1*( "." ldh-str ) |
| 72 | + * With: |
| 73 | + * - atext : defined in RFC 5322 section 3.2.3 |
| 74 | + * - ldh-str : defined in RFC 1034 section 3.5 |
| 75 | + * |
| 76 | + * (see STD 68 / RFC 5234 http://tools.ietf.org/html/std68): |
| 77 | + */ |
| 78 | + |
| 79 | + /** |
| 80 | + * First, define the RFC 5322 'atext' which is pretty easy : |
| 81 | + * atext = ALPHA / DIGIT / ; Printable US-ASCII |
| 82 | + "!" / "#" / ; characters not including |
| 83 | + "$" / "%" / ; specials. Used for atoms. |
| 84 | + "&" / "'" / |
| 85 | + "*" / "+" / |
| 86 | + "-" / "/" / |
| 87 | + "=" / "?" / |
| 88 | + "^" / "_" / |
| 89 | + "`" / "{" / |
| 90 | + "|" / "}" / |
| 91 | + "~" |
| 92 | + */ |
| 93 | + var rfc5322_atext = "a-z0-9!#$%&'*+-/=?^_`{|}—~" ; |
| 94 | + |
| 95 | + /** |
| 96 | + * Next define the RFC 1034 'ldh-str' |
| 97 | + * <domain> ::= <subdomain> | " " |
| 98 | + * <subdomain> ::= <label> | <subdomain> "." <label> |
| 99 | + * <label> ::= <letter> [ [ <ldh-str> ] <let-dig> ] |
| 100 | + * <ldh-str> ::= <let-dig-hyp> | <let-dig-hyp> <ldh-str> |
| 101 | + * <let-dig-hyp> ::= <let-dig> | "-" |
| 102 | + * <let-dig> ::= <letter> | <digit> |
| 103 | + */ |
| 104 | + var rfc1034_ldh_str = "a-z0-9-" ; |
| 105 | + |
| 106 | + var HTML5_email_regexp = new RegExp( |
| 107 | + // start of string |
| 108 | + '^' |
| 109 | + + |
| 110 | + // User part which is liberal :p |
| 111 | + '[' + rfc5322_atext + '\\.' + ']' + '+' |
| 112 | + + |
| 113 | + // "apostrophe" |
| 114 | + '@' |
| 115 | + + |
| 116 | + // Domain first part |
| 117 | + '[' + rfc1034_ldh_str + ']+' |
| 118 | + + |
| 119 | + // Second part and following are separated by a dot |
| 120 | + '(\\.[' + rfc1034_ldh_str + ']+)+' |
| 121 | + + |
| 122 | + // End of string |
| 123 | + '$', |
| 124 | + // RegExp is case insensitive |
| 125 | + 'i' |
| 126 | + ); |
| 127 | + return mailtxt.match( HTML5_email_regexp ); |
| 128 | +}; |
Property changes on: trunk/phase3/resources/mediawiki.special/mediawiki.special.preferences.js |
___________________________________________________________________ |
Added: svn:eol-style |
1 | 129 | + native |