Index: trunk/phase3/resources/mediawiki.action/mediawiki.action.edit.js |
— | — | @@ -3,15 +3,14 @@ |
4 | 4 | */ |
5 | 5 | |
6 | 6 | //make sure edit summary does not exceed byte limit |
7 | | -$( '#wpSummary' ).attr( 'maxLength', 250 ).keypress( function (e) { |
8 | | - |
| 7 | +$( '#wpSummary' ).attr( 'maxLength', 250 ).keypress( function( e ) { |
9 | 8 | // first check to see if this is actually a character key |
10 | 9 | // being pressed. |
11 | 10 | // Based on key-event info from http://unixpapa.com/js/key.html |
12 | 11 | // JQuery should also normalize e.which to be consistent cross-browser, |
13 | 12 | // however the same check is still needed regardless of jQuery. |
14 | 13 | |
15 | | - if (e.which === 0 || e.charCode === 0 || e.ctrlKey || e.altKey || e.metaKey) { |
| 14 | + if ( e.which === 0 || e.charCode === 0 || e.ctrlKey || e.altKey || e.metaKey ) { |
16 | 15 | return true; //a special key (backspace, etc) so don't interfere. |
17 | 16 | } |
18 | 17 | |
— | — | @@ -21,9 +20,9 @@ |
22 | 21 | // and the actual character takes 4 bytes in UTF-8 (2*2=4). Might not work perfectly in edge cases |
23 | 22 | // such as illegal sequences, but that should never happen. |
24 | 23 | |
25 | | - len = this.value.replace(/[\u0080-\u07FF\uD800-\uDFFF]/g, '**').replace(/[\u0800-\uD7FF\uE000-\uFFFF]/g, '***').length; |
| 24 | + var len = this.value.replace( /[\u0080-\u07FF\uD800-\uDFFF]/g, '**' ).replace( /[\u0800-\uD7FF\uE000-\uFFFF]/g, '***' ).length; |
26 | 25 | //247 as this doesn't count character about to be inserted. |
27 | | - if (len > 247) { |
| 26 | + if ( len > 247 ) { |
28 | 27 | e.preventDefault(); |
29 | 28 | } |
30 | 29 | }); |