From: Roan Kattouw Date: Wed, 19 Jan 2011 17:49:05 +0000 (+0000) Subject: Followup r80554: coding style, add var X-Git-Tag: 1.31.0-rc.0~32473 X-Git-Url: http://git.cyclocoop.org/%24self?a=commitdiff_plain;h=4bfbd84446c65344b0ada2054bec0747e09f60c3;p=lhc%2Fweb%2Fwiklou.git Followup r80554: coding style, add var --- diff --git a/resources/mediawiki.action/mediawiki.action.edit.js b/resources/mediawiki.action/mediawiki.action.edit.js index ebfc942ec5..032dc64745 100644 --- a/resources/mediawiki.action/mediawiki.action.edit.js +++ b/resources/mediawiki.action/mediawiki.action.edit.js @@ -3,15 +3,14 @@ */ //make sure edit summary does not exceed byte limit -$( '#wpSummary' ).attr( 'maxLength', 250 ).keypress( function (e) { - +$( '#wpSummary' ).attr( 'maxLength', 250 ).keypress( function( e ) { // first check to see if this is actually a character key // being pressed. // Based on key-event info from http://unixpapa.com/js/key.html // JQuery should also normalize e.which to be consistent cross-browser, // however the same check is still needed regardless of jQuery. - if (e.which === 0 || e.charCode === 0 || e.ctrlKey || e.altKey || e.metaKey) { + if ( e.which === 0 || e.charCode === 0 || e.ctrlKey || e.altKey || e.metaKey ) { return true; //a special key (backspace, etc) so don't interfere. } @@ -21,9 +20,9 @@ $( '#wpSummary' ).attr( 'maxLength', 250 ).keypress( function (e) { // and the actual character takes 4 bytes in UTF-8 (2*2=4). Might not work perfectly in edge cases // such as illegal sequences, but that should never happen. - len = this.value.replace(/[\u0080-\u07FF\uD800-\uDFFF]/g, '**').replace(/[\u0800-\uD7FF\uE000-\uFFFF]/g, '***').length; + var len = this.value.replace( /[\u0080-\u07FF\uD800-\uDFFF]/g, '**' ).replace( /[\u0800-\uD7FF\uE000-\uFFFF]/g, '***' ).length; //247 as this doesn't count character about to be inserted. - if (len > 247) { + if ( len > 247 ) { e.preventDefault(); } });