r80575 MediaWiki - Code Review archive

Repository:MediaWiki
Revision:r80574‎ | r80575 | r80576 >
Date:17:49, 19 January 2011
Author:catrope
Status:ok
Tags:
Comment:
Followup r80554: coding style, add var
Modified paths:
  • /trunk/phase3/resources/mediawiki.action/mediawiki.action.edit.js (modified) (history)

Diff [purge]

Index: trunk/phase3/resources/mediawiki.action/mediawiki.action.edit.js
@@ -3,15 +3,14 @@
44 */
55
66 //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 ) {
98 // first check to see if this is actually a character key
109 // being pressed.
1110 // Based on key-event info from http://unixpapa.com/js/key.html
1211 // JQuery should also normalize e.which to be consistent cross-browser,
1312 // however the same check is still needed regardless of jQuery.
1413
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 ) {
1615 return true; //a special key (backspace, etc) so don't interfere.
1716 }
1817
@@ -21,9 +20,9 @@
2221 // and the actual character takes 4 bytes in UTF-8 (2*2=4). Might not work perfectly in edge cases
2322 // such as illegal sequences, but that should never happen.
2423
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;
2625 //247 as this doesn't count character about to be inserted.
27 - if (len > 247) {
 26+ if ( len > 247 ) {
2827 e.preventDefault();
2928 }
3029 });

Follow-up revisions

RevisionCommit summaryAuthorDate
r80576Followup r80554, r80575: wrap in (function( $ ) { ... })(jQuery);catrope17:50, 19 January 2011
r806771.17: MFT r80109, r80113, r80223, r80475, r80554, r80575, r80620, r80621, r80...catrope03:12, 21 January 2011

Past revisions this follows-up on

RevisionCommit summaryAuthorDate
r80554(follow-up r66913) Per CR, make the editsummary length checker use jQuery/RL ...bawolff03:59, 19 January 2011

Status & tagging log