r87060 MediaWiki - Code Review archive

Repository:MediaWiki
Revision:r87059‎ | r87060 | r87061 >
Date:00:18, 28 April 2011
Author:brion
Status:ok
Tags:
Comment:
Declare some local vars/funcs as local so they don't stomp on JS global namespaces weirdly
Modified paths:
  • /trunk/phase3/resources/mediawiki.action/mediawiki.action.history.js (modified) (history)
  • /trunk/phase3/resources/mediawiki.special/mediawiki.special.preferences.js (modified) (history)
  • /trunk/phase3/resources/mediawiki.special/mediawiki.special.upload.js (modified) (history)
  • /trunk/phase3/resources/mediawiki.util/mediawiki.util.test.js (modified) (history)
  • /trunk/phase3/resources/mediawiki/mediawiki.js (modified) (history)

Diff [purge]

Index: trunk/phase3/resources/mediawiki.action/mediawiki.action.history.js
@@ -68,7 +68,7 @@
6969 $histForm.append( $compareLink.clone() );
7070 }
7171
72 - function updateCompare() {
 72+ var updateCompare = function() {
7373 var $radio = $histForm.find( 'input[type=radio]:checked' );
7474 var genLink = mw.config.get( 'wgScript' )
7575 + '?title=' + mw.util.wikiUrlencode( mw.config.get( 'wgPageName' ) )
Index: trunk/phase3/resources/mediawiki.util/mediawiki.util.test.js
@@ -50,7 +50,7 @@
5151 if ( !title ) {
5252 return false;
5353 }
54 - escapedtitle = mw.html.escape( title ).replace( / /g, '  ' );
 54+ var escapedtitle = mw.html.escape( title ).replace( / /g, '  ' );
5555 this.addedTests.push( [ 'HEADER', escapedtitle, mw.test.numberOfHeader++ ] );
5656 this.$table.append( '<tr class="mw-mwutiltest-head" id="mw-mwutiltest-head'+mw.test.numberOfHeader+'"><th colspan="4">' + escapedtitle + '</th></tr>' );
5757 return true;
@@ -403,14 +403,14 @@
404404 }
405405
406406 exec = item[0];
407 - shouldreturn = item[1];
408 - shouldcontain = item[2];
 407+ var shouldreturn = item[1];
 408+ var shouldcontain = item[2];
409409
410410 numberOfTests++;
411411 headNumberOfTests++;
412 - doesReturn = eval( exec );
 412+ var doesReturn = eval( exec );
413413 doesReturn = doesReturn + ' (' + typeof doesReturn + ')';
414 - $thisrow = $testrows.eq( i - numberOfHeaders ); // since headers are rows as well
 414+ var $thisrow = $testrows.eq( i - numberOfHeaders ); // since headers are rows as well
415415 $thisrow.find( '> td' ).eq(2).html( mw.html.escape( doesReturn ).replace(/ /g, '&nbsp;&nbsp;' ) );
416416
417417 if ( doesReturn.indexOf( shouldcontain ) !== -1 ) {
Index: trunk/phase3/resources/mediawiki.special/mediawiki.special.upload.js
@@ -83,6 +83,7 @@
8484 }
8585
8686 img.onload = function() {
 87+ var width, height, x, y, dx, dy;
8788 // Fit the image within the previewSizexpreviewSize box
8889 if ( img.width > img.height ) {
8990 width = previewSize;
Index: trunk/phase3/resources/mediawiki.special/mediawiki.special.preferences.js
@@ -106,7 +106,8 @@
107107 var hoursToMinutes = function( hour ) {
108108 var arr = hour.split( ':' );
109109 arr[0] = parseInt( arr[0], 10 );
110 -
 110+
 111+ var minutes;
111112 if ( arr.length == 1 ) {
112113 // Specification is of the form [-]XX
113114 minutes = arr[0] * 60;
Index: trunk/phase3/resources/mediawiki/mediawiki.js
@@ -1191,7 +1191,7 @@
11921192
11931193 /** HTML construction helper functions */
11941194 this.html = new ( function () {
1195 - function escapeCallback( s ) {
 1195+ var escapeCallback = function( s ) {
11961196 switch ( s ) {
11971197 case "'":
11981198 return '&#039;';

Status & tagging log