From a124b70326c0da41200fc0e27b6e885cc4747fc8 Mon Sep 17 00:00:00 2001 From: Sam Reed Date: Wed, 8 Dec 2010 23:33:33 +0000 Subject: [PATCH] Remove unneeded semicolons Remove unneeded return Simplify some if's (invert to save negation) --- resources/mediawiki/mediawiki.js | 8 ++++---- skins/common/ajax.js | 2 -- skins/common/ajaxwatch.js | 2 +- skins/common/changepassword.js | 8 ++++---- skins/common/htmlform.js | 6 +----- skins/common/upload.js | 6 +----- skins/common/wikibits.js | 4 ++-- 7 files changed, 13 insertions(+), 23 deletions(-) diff --git a/resources/mediawiki/mediawiki.js b/resources/mediawiki/mediawiki.js index 5974357fef..115304569d 100644 --- a/resources/mediawiki/mediawiki.js +++ b/resources/mediawiki/mediawiki.js @@ -81,7 +81,7 @@ window.mediaWiki = new ( function( $ ) { */ function Map( global ) { this.values = ( global === true ) ? window : {}; - }; + } /** * Gets the value of a key, or a list of key/value pairs for an array of keys. @@ -154,7 +154,7 @@ window.mediaWiki = new ( function( $ ) { this.map = map; this.key = key; this.parameters = typeof parameters === 'undefined' ? [] : $.makeArray( parameters ); - }; + } /** * Appends parameters for replacement @@ -396,7 +396,7 @@ window.mediaWiki = new ( function( $ ) { } } return true; - }; + } /** * Generates an ISO8601 "basic" string from a UNIX timestamp @@ -472,7 +472,7 @@ window.mediaWiki = new ( function( $ ) { return resolved; } throw new Error( 'Invalid module argument: ' + module ); - }; + } /** * Narrows a list of module names down to those matching a specific diff --git a/skins/common/ajax.js b/skins/common/ajax.js index 1cad75edc7..2a93373f6a 100644 --- a/skins/common/ajax.js +++ b/skins/common/ajax.js @@ -154,8 +154,6 @@ window.sajax_do_call = function(func_name, args, target) { } else { alert( 'bad target for sajax_do_call: not a function or object: ' + target ); } - - return; }; sajax_debug( func_name + ' uri = ' + uri + ' / post = ' + post_data ); diff --git a/skins/common/ajaxwatch.js b/skins/common/ajaxwatch.js index aaf6360cef..958db0ad6c 100644 --- a/skins/common/ajaxwatch.js +++ b/skins/common/ajaxwatch.js @@ -112,7 +112,7 @@ $( document ).ready( function() { // update the link text with the new message $link.text( mediaWiki.msg( otheraction ) ); } - }; + } return false; }); diff --git a/skins/common/changepassword.js b/skins/common/changepassword.js index 7b777c916c..c8408cc0ea 100644 --- a/skins/common/changepassword.js +++ b/skins/common/changepassword.js @@ -1,11 +1,11 @@ window.onNameChange = function() { - if ( wgUserName != document.getElementById('wpName').value ) { - document.getElementById('wpPassword').disabled = true; - document.getElementById('wpComment').disabled = false; - } else { + if ( wgUserName == document.getElementById('wpName').value ) { document.getElementById('wpPassword').disabled = false; document.getElementById('wpComment').disabled = true; + } else { + document.getElementById('wpPassword').disabled = true; + document.getElementById('wpComment').disabled = false; } }; diff --git a/skins/common/htmlform.js b/skins/common/htmlform.js index 900b16603e..9e91017ea0 100644 --- a/skins/common/htmlform.js +++ b/skins/common/htmlform.js @@ -30,11 +30,7 @@ window.htmlforms = { var id = select.id; var textbox = document.getElementById( id + '-other' ); - if ( select.value == 'other' ) { - textbox.disabled = false; - } else { - textbox.disabled = true; - } + textbox.disabled = ( select.value != 'other' ); } }; diff --git a/skins/common/upload.js b/skins/common/upload.js index 962e5c4234..c91482b60d 100644 --- a/skins/common/upload.js +++ b/skins/common/upload.js @@ -289,11 +289,7 @@ window.toggleFilenameFiller = function() { if(!document.getElementById) return; var upfield = document.getElementById('wpUploadFile'); var destName = document.getElementById('wpDestFile').value; - if (destName=='' || destName==' ') { - wgUploadAutoFill = true; - } else { - wgUploadAutoFill = false; - } + wgUploadAutoFill = ( destName == '' || destName == ' ' ); }; window.wgUploadLicenseObj = { diff --git a/skins/common/wikibits.js b/skins/common/wikibits.js index 7b97830afd..01103bc899 100644 --- a/skins/common/wikibits.js +++ b/skins/common/wikibits.js @@ -866,7 +866,7 @@ window.ts_dateToSortKey = function( date ) { } return date.substr( 7, 4 ) + month + date.substr( 0, 2 ); } else if ( date.length == 10 ) { - if ( ts_europeandate == false ) { + if ( !ts_europeandate ) { return date.substr( 6, 4 ) + date.substr( 0, 2 ) + date.substr( 3, 2 ); } else { return date.substr( 6, 4 ) + date.substr( 3, 2 ) + date.substr( 0, 2 ); @@ -878,7 +878,7 @@ window.ts_dateToSortKey = function( date ) { } else { yr = '19' + yr; } - if ( ts_europeandate == true ) { + if ( ts_europeandate ) { return yr + date.substr( 3, 2 ) + date.substr( 0, 2 ); } else { return yr + date.substr( 0, 2 ) + date.substr( 3, 2 ); -- 2.20.1