From: Bryan Tong Minh Date: Sat, 5 Mar 2011 19:47:04 +0000 (+0000) Subject: Follow-up r83218: Added var declarations. Html escape the largefileserver message... X-Git-Tag: 1.31.0-rc.0~31618 X-Git-Url: http://git.cyclocoop.org/%24self?a=commitdiff_plain;h=f486de5ecb9add4229a5f7cd5ab11bf55f407a7e;p=lhc%2Fweb%2Fwiklou.git Follow-up r83218: Added var declarations. Html escape the largefileserver message. Introduced mediaWiki.Message.escaped() to bring the interface up to date with the PHP Message interface. --- diff --git a/resources/mediawiki.special/mediawiki.special.upload.js b/resources/mediawiki.special/mediawiki.special.upload.js index ee86ea9380..69b80e6636 100644 --- a/resources/mediawiki.special/mediawiki.special.upload.js +++ b/resources/mediawiki.special/mediawiki.special.upload.js @@ -196,7 +196,7 @@ jQuery( function( $ ) { */ function checkMaxUploadSize( file ) { function getMaxUploadSize( type ) { - sizes = mw.config.get( 'wgMaxUploadSize' ); + var sizes = mw.config.get( 'wgMaxUploadSize' ); if ( sizes[type] !== undefined ) { return sizes[type]; } @@ -204,10 +204,10 @@ jQuery( function( $ ) { } $( '.mw-upload-source-error' ).remove(); - maxSize = getMaxUploadSize( 'file' ); + var maxSize = getMaxUploadSize( 'file' ); if ( file.size > maxSize ) { - error = $( '

' + - mw.msg( 'largefileserver', file.size, maxSize ) + '

' ); + var error = $( '

' + + mw.message( 'largefileserver', file.size, maxSize ).escaped() + '

' ); $( '#wpUploadFile' ).after( error ); return false; } diff --git a/resources/mediawiki/mediawiki.js b/resources/mediawiki/mediawiki.js index 2e30aae0ac..b84a2c3d82 100644 --- a/resources/mediawiki/mediawiki.js +++ b/resources/mediawiki/mediawiki.js @@ -254,6 +254,16 @@ window.mediaWiki = new ( function( $ ) { var index = parseInt( match, 10 ) - 1; return index in parameters ? parameters[index] : '$' + match; } ); + + if ( this.format === 'plain' ) { + return text; + } + if ( this.format === 'escaped' ) { + // According to Message.php this needs {{-transformation, which is + // still todo + return mediaWiki.html.escape( text ); + } + /* This should be fixed up when we have a parser if ( this.format === 'parse' && 'language' in mediaWiki ) { text = mediaWiki.language.parse( text ); @@ -281,6 +291,16 @@ window.mediaWiki = new ( function( $ ) { this.format = 'plain'; return this.toString(); }; + + /** + * Changes the format to html escaped and converts message to string + * + * @return {string} String form of html escaped message + */ + Message.prototype.escaped = function() { + this.format = 'escaped'; + return this.toString(); + } /** * Checks if message exists