Various clean up

Files:
* Consistently have one (1) new line at EOF
  (.gitignore, *.css, *.sh)

JSHint:
* Separate the common (general Wikimedia code conventions) from
  the local more stricter rules (nice work!).

Maintenance:
* Use simplified $IP definition where getenv is only called once.
  Based on http://git.io/ve-mw-36fc3b59-makeStaticLoader

JavaScript:
* Use the same closure in all files:
  - No need for "undefined".
  - One linebreak between license header and start of closure
    (sometimes there were 1 or 2 empty lines).
  - ext.uls.ime.js: No need for "document" (redundant in general,
    but especially as it wasn't used anywhere in this file).
  - Use "$, mw" for all ext.* modules (one of them used "mw, $").

Change-Id: Iba5dab14bbc3fbfc9f8fe96dd2d95529587a69aa
This commit is contained in:
Timo Tijhof
2014-02-07 22:02:36 -08:00
parent 4081163aa5
commit c6d71015ff
19 changed files with 23 additions and 32 deletions

1
.gitignore vendored
View File

@@ -4,4 +4,3 @@
.*.swp .*.swp
.idea .idea
.bundle/ .bundle/

View File

@@ -1,4 +1,5 @@
{ {
"camelcase": true, "camelcase": true,
"curly": true, "curly": true,
"eqeqeq": true, "eqeqeq": true,
@@ -12,7 +13,7 @@
"trailing": true, "trailing": true,
"undef": true, "undef": true,
"unused": true, "unused": true,
"onevar": true,
"bitwise": true, "bitwise": true,
"forin": false, "forin": false,
"regexp": false, "regexp": false,
@@ -21,6 +22,8 @@
"smarttabs": true, "smarttabs": true,
"multistr": true, "multistr": true,
"browser": true, "browser": true,
"onevar": true,
"predef": [ "predef": [
"mediaWiki", "mediaWiki",
"jQuery", "jQuery",

View File

@@ -18,19 +18,16 @@
* @licence MIT License * @licence MIT License
*/ */
// Standard boilerplate to define $IP
if ( getenv( 'MW_INSTALL_PATH' ) !== false ) {
$IP = getenv( 'MW_INSTALL_PATH' ); $IP = getenv( 'MW_INSTALL_PATH' );
} else { if ( $IP === false ) {
$dir = __DIR__; $IP = __DIR__ . '/../../..';
$IP = "$dir/../../..";
} }
require_once "$IP/maintenance/Maintenance.php"; require_once "$IP/maintenance/Maintenance.php";
class LanguageNameIndexer extends Maintenance { class LanguageNameIndexer extends Maintenance {
public function __construct() { public function __construct() {
parent::__construct(); parent::__construct();
$this->addDescription( "Script to create language names index." ); $this->addDescription( 'Script to create language names index.' );
} }
public function execute() { public function execute() {

View File

@@ -16,8 +16,7 @@
* @licence GNU General Public Licence 2.0 or later * @licence GNU General Public Licence 2.0 or later
* @licence MIT License * @licence MIT License
*/ */
( function ( $, mw ) {
( function ( $, mw, undefined ) {
'use strict'; 'use strict';
var template = '<div class="uls-display-settings">' var template = '<div class="uls-display-settings">'

View File

@@ -16,7 +16,6 @@
* @licence GNU General Public Licence 2.0 or later * @licence GNU General Public Licence 2.0 or later
* @licence MIT License * @licence MIT License
*/ */
( function ( $, mw ) { ( function ( $, mw ) {
'use strict'; 'use strict';

View File

@@ -16,8 +16,7 @@
* @licence GNU General Public Licence 2.0 or later * @licence GNU General Public Licence 2.0 or later
* @licence MIT License * @licence MIT License
*/ */
( function ( $, mw ) {
( function ( mw, $ ) {
'use strict'; 'use strict';
mw.uls = mw.uls || {}; mw.uls = mw.uls || {};
@@ -45,4 +44,4 @@
} }
} }
}( mediaWiki, jQuery ) ); }( jQuery, mediaWiki ) );

View File

@@ -16,7 +16,6 @@
* @licence GNU General Public Licence 2.0 or later * @licence GNU General Public Licence 2.0 or later
* @licence MIT License * @licence MIT License
*/ */
( function ( $, mw ) { ( function ( $, mw ) {
'use strict'; 'use strict';

View File

@@ -16,7 +16,7 @@
* @licence GNU General Public Licence 2.0 or later * @licence GNU General Public Licence 2.0 or later
* @licence MIT License * @licence MIT License
*/ */
( function ( $, mw, document, undefined ) { ( function ( $, mw ) {
'use strict'; 'use strict';
var mwImeRulesPath, inputSelector, inputPreferences, ulsIMEPreferences, customHelpLink; var mwImeRulesPath, inputSelector, inputPreferences, ulsIMEPreferences, customHelpLink;
@@ -324,4 +324,4 @@
mw.notify( $notification.i18n() ); mw.notify( $notification.i18n() );
} }
}( jQuery, mediaWiki, document ) ); }( jQuery, mediaWiki ) );

View File

@@ -16,8 +16,7 @@
* @licence GNU General Public Licence 2.0 or later * @licence GNU General Public Licence 2.0 or later
* @licence MIT License * @licence MIT License
*/ */
( function ( $, mw ) {
( function ( $, mw, undefined ) {
'use strict'; 'use strict';
// FIXME: Remove when ULS minimum MW version is 1.22 // FIXME: Remove when ULS minimum MW version is 1.22

View File

@@ -16,8 +16,7 @@
* @licence GNU General Public Licence 2.0 or later * @licence GNU General Public Licence 2.0 or later
* @licence MIT License * @licence MIT License
*/ */
( function ( $, mw ) {
( function ( $, mw, undefined ) {
'use strict'; 'use strict';
var template = '<div class="uls-input-settings">' var template = '<div class="uls-input-settings">'

View File

@@ -16,7 +16,6 @@
* @licence GNU General Public Licence 2.0 or later * @licence GNU General Public Licence 2.0 or later
* @licence MIT License * @licence MIT License
*/ */
( function ( $, mw ) { ( function ( $, mw ) {
'use strict'; 'use strict';

View File

@@ -16,7 +16,6 @@
* @licence GNU General Public Licence 2.0 or later * @licence GNU General Public Licence 2.0 or later
* @licence MIT License * @licence MIT License
*/ */
( function ( $, mw ) { ( function ( $, mw ) {
'use strict'; 'use strict';

View File

@@ -17,8 +17,7 @@
* @licence GNU General Public Licence 2.0 or later * @licence GNU General Public Licence 2.0 or later
* @licence MIT License * @licence MIT License
*/ */
( function ( $, mw ) {
( function ( $, mw, undefined ) {
'use strict'; 'use strict';
var ULSPreferences, var ULSPreferences,

View File

@@ -16,8 +16,9 @@
* @licence GNU General Public Licence 2.0 or later * @licence GNU General Public Licence 2.0 or later
* @licence MIT License * @licence MIT License
*/ */
( function ( $, mw, undefined ) { ( function ( $, mw ) {
'use strict'; 'use strict';
var mediawikiFontRepository, ulsPreferences, var mediawikiFontRepository, ulsPreferences,
// Text to prepend the sample text. 0D00 is an unassigned unicode point. // Text to prepend the sample text. 0D00 is an unassigned unicode point.
tofuSalt = '\u0D00', tofuSalt = '\u0D00',