r78105 MediaWiki - Code Review archive

Repository:MediaWiki
Revision:r78104‎ | r78105 | r78106 >
Date:23:33, 8 December 2010
Author:reedy
Status:ok (Comments)
Tags:
Comment:
Remove unneeded semicolons

Remove unneeded return

Simplify some if's (invert to save negation)
Modified paths:
  • /trunk/phase3/resources/mediawiki/mediawiki.js (modified) (history)
  • /trunk/phase3/skins/common/ajax.js (modified) (history)
  • /trunk/phase3/skins/common/ajaxwatch.js (modified) (history)
  • /trunk/phase3/skins/common/changepassword.js (modified) (history)
  • /trunk/phase3/skins/common/htmlform.js (modified) (history)
  • /trunk/phase3/skins/common/upload.js (modified) (history)
  • /trunk/phase3/skins/common/wikibits.js (modified) (history)

Diff [purge]

Index: trunk/phase3/skins/common/changepassword.js
@@ -1,11 +1,11 @@
22
33 window.onNameChange = function() {
4 - if ( wgUserName != document.getElementById('wpName').value ) {
 4+ if ( wgUserName == document.getElementById('wpName').value ) {
 5+ document.getElementById('wpPassword').disabled = false;
 6+ document.getElementById('wpComment').disabled = true;
 7+ } else {
58 document.getElementById('wpPassword').disabled = true;
69 document.getElementById('wpComment').disabled = false;
7 - } else {
8 - document.getElementById('wpPassword').disabled = false;
9 - document.getElementById('wpComment').disabled = true;
1010 }
1111 };
1212
Index: trunk/phase3/skins/common/ajaxwatch.js
@@ -112,7 +112,7 @@
113113 // update the link text with the new message
114114 $link.text( mediaWiki.msg( otheraction ) );
115115 }
116 - };
 116+ }
117117 return false;
118118 });
119119
Index: trunk/phase3/skins/common/ajax.js
@@ -154,8 +154,6 @@
155155 } else {
156156 alert( 'bad target for sajax_do_call: not a function or object: ' + target );
157157 }
158 -
159 - return;
160158 };
161159
162160 sajax_debug( func_name + ' uri = ' + uri + ' / post = ' + post_data );
Index: trunk/phase3/skins/common/upload.js
@@ -289,11 +289,7 @@
290290 if(!document.getElementById) return;
291291 var upfield = document.getElementById('wpUploadFile');
292292 var destName = document.getElementById('wpDestFile').value;
293 - if (destName=='' || destName==' ') {
294 - wgUploadAutoFill = true;
295 - } else {
296 - wgUploadAutoFill = false;
297 - }
 293+ wgUploadAutoFill = ( destName == '' || destName == ' ' );
298294 };
299295
300296 window.wgUploadLicenseObj = {
Index: trunk/phase3/skins/common/wikibits.js
@@ -866,7 +866,7 @@
867867 }
868868 return date.substr( 7, 4 ) + month + date.substr( 0, 2 );
869869 } else if ( date.length == 10 ) {
870 - if ( ts_europeandate == false ) {
 870+ if ( !ts_europeandate ) {
871871 return date.substr( 6, 4 ) + date.substr( 0, 2 ) + date.substr( 3, 2 );
872872 } else {
873873 return date.substr( 6, 4 ) + date.substr( 3, 2 ) + date.substr( 0, 2 );
@@ -878,7 +878,7 @@
879879 } else {
880880 yr = '19' + yr;
881881 }
882 - if ( ts_europeandate == true ) {
 882+ if ( ts_europeandate ) {
883883 return yr + date.substr( 3, 2 ) + date.substr( 0, 2 );
884884 } else {
885885 return yr + date.substr( 0, 2 ) + date.substr( 3, 2 );
Index: trunk/phase3/skins/common/htmlform.js
@@ -30,11 +30,7 @@
3131 var id = select.id;
3232 var textbox = document.getElementById( id + '-other' );
3333
34 - if ( select.value == 'other' ) {
35 - textbox.disabled = false;
36 - } else {
37 - textbox.disabled = true;
38 - }
 34+ textbox.disabled = ( select.value != 'other' );
3935 }
4036 };
4137
Index: trunk/phase3/resources/mediawiki/mediawiki.js
@@ -81,7 +81,7 @@
8282 */
8383 function Map( global ) {
8484 this.values = ( global === true ) ? window : {};
85 - };
 85+ }
8686
8787 /**
8888 * Gets the value of a key, or a list of key/value pairs for an array of keys.
@@ -154,7 +154,7 @@
155155 this.map = map;
156156 this.key = key;
157157 this.parameters = typeof parameters === 'undefined' ? [] : $.makeArray( parameters );
158 - };
 158+ }
159159
160160 /**
161161 * Appends parameters for replacement
@@ -396,7 +396,7 @@
397397 }
398398 }
399399 return true;
400 - };
 400+ }
401401
402402 /**
403403 * Generates an ISO8601 "basic" string from a UNIX timestamp
@@ -472,7 +472,7 @@
473473 return resolved;
474474 }
475475 throw new Error( 'Invalid module argument: ' + module );
476 - };
 476+ }
477477
478478 /**
479479 * Narrows a list of module names down to those matching a specific

Comments

#Comment by Reedy (talk | contribs)   01:14, 9 December 2010

OMGTEST

Status & tagging log