jenkins-bot has submitted this change and it was merged.

Change subject: Add npm entry point
......................................................................


Add npm entry point

Change-Id: I74518323302926fbd235c3017e05c0664f5bbf7b
---
A .jshintignore
A .jshintrc
A Gruntfile.js
A package.json
M resources/contest.special.contest.js
M resources/contest.special.contests.js
M resources/contest.special.editcontest.js
M resources/contest.special.signup.js
M resources/contest.special.submission.js
M resources/contest.special.welcome.js
M resources/jquery.contestChallenges.js
M resources/jquery.contestEmail.js
M resources/jquery.contestSubmission.js
13 files changed, 101 insertions(+), 19 deletions(-)

Approvals:
  Hashar: Looks good to me, approved
  jenkins-bot: Verified



diff --git a/.jshintignore b/.jshintignore
new file mode 100644
index 0000000..45520ce
--- /dev/null
+++ b/.jshintignore
@@ -0,0 +1,3 @@
+node_modules
+resources/jquery.ui.timepicker.js
+resources/fancybox/**
diff --git a/.jshintrc b/.jshintrc
new file mode 100644
index 0000000..443efa5
--- /dev/null
+++ b/.jshintrc
@@ -0,0 +1,24 @@
+{
+       // Enforcing
+       "bitwise": true,
+       "eqeqeq": true,
+       "freeze": true,
+       "latedef": "nofunc",
+       "noarg": true,
+       "nonew": true,
+       "undef": true,
+       "unused": true,
+       "strict": false,
+
+       // Relaxing
+       "es5": false,
+
+       // Environment
+       "browser": true,
+       "jquery": true,
+
+       "globals": {
+               "mediaWiki": false,
+               "alert": true
+       }
+}
diff --git a/Gruntfile.js b/Gruntfile.js
new file mode 100644
index 0000000..b60f79e
--- /dev/null
+++ b/Gruntfile.js
@@ -0,0 +1,32 @@
+/*jshint node:true */
+module.exports = function ( grunt ) {
+       grunt.loadNpmTasks( 'grunt-contrib-jshint' );
+       grunt.loadNpmTasks( 'grunt-jsonlint' );
+       // grunt.loadNpmTasks( 'grunt-banana-checker' );
+
+       grunt.initConfig( {
+               jshint: {
+                       options: {
+                               jshintrc: true
+                       },
+                       all: [
+                               '**/*.js',
+                               '!node_modules/**',
+                               '!resources/jquery.ui.timepicker.js',
+                               '!resources/fancybox/**'
+                       ]
+               },
+               /* banana: {
+                       all: 'i18n/'
+               }, */
+               jsonlint: {
+                       all: [
+                               '**/*.json',
+                               '!node_modules/**'
+                       ]
+               }
+       } );
+
+       grunt.registerTask( 'test', [ 'jshint', 'jsonlint' /* 'banana' */ ] );
+       grunt.registerTask( 'default', 'test' );
+};
diff --git a/package.json b/package.json
new file mode 100644
index 0000000..a0b255c
--- /dev/null
+++ b/package.json
@@ -0,0 +1,11 @@
+{
+  "scripts": {
+    "test": "grunt test"
+  },
+  "devDependencies": {
+    "grunt": "0.4.5",
+    "grunt-cli": "0.1.13",
+    "grunt-contrib-jshint": "1.0.0",
+    "grunt-jsonlint": "1.0.7"
+  }
+}
diff --git a/resources/contest.special.contest.js 
b/resources/contest.special.contest.js
index 253f113..98b9b66 100644
--- a/resources/contest.special.contest.js
+++ b/resources/contest.special.contest.js
@@ -19,7 +19,7 @@
                };
 
                $.post(
-                       wgScriptPath + '/api.php',
+                       mw.config.get( 'wgScriptPath' ) + '/api.php',
                        requestArgs,
                        function( data ) {
                                callback( data );
@@ -89,4 +89,4 @@
        
        $( '#send-reminder' ).button().click( this.showReminderDialog );
 
-} ); })( window.jQuery, window.mediaWiki );
+} ); }( jQuery, mediaWiki ) );
diff --git a/resources/contest.special.contests.js 
b/resources/contest.special.contests.js
index 6442009..b623163 100644
--- a/resources/contest.special.contests.js
+++ b/resources/contest.special.contests.js
@@ -10,7 +10,7 @@
 
        function deleteContest( options, successCallback, failCallback ) {
                $.post(
-                       wgScriptPath + '/api.php',
+                       mw.config.get( 'wgScriptPath' ) + '/api.php',
                        {
                                'action': 'deletecontest',
                                'format': 'json',
@@ -28,7 +28,8 @@
        }
 
        $( '.contest-delete' ).click( function() {
-               $this = $( this );
+               var $this = $( this );
+               var confirm;
 
                if ( confirm( mw.msg( 'contest-special-confirm-delete' ) ) ) {
                        deleteContest(
@@ -54,4 +55,4 @@
                return false;
        } );
 
-} ); })( window.jQuery, window.mediaWiki );
+} ); }( jQuery, mediaWiki ) );
diff --git a/resources/contest.special.editcontest.js 
b/resources/contest.special.editcontest.js
index b23d21a..9eb8b2e 100644
--- a/resources/contest.special.editcontest.js
+++ b/resources/contest.special.editcontest.js
@@ -24,6 +24,7 @@
                var _this = this;
                var $this = $( this );
                this.options = options;
+               var $tr;
 
                this.titleInput = null;
                this.textInput = null;
@@ -84,6 +85,7 @@
                                this.deleteButton = $( '<button />' )
                                        .button( { 'label': mw.msg( 
'contest-edit-delete' ) } )
                                        .click( function() {
+                                               var confirm;
                                                if ( confirm( mw.msg( 
'contest-edit-confirm-delete' ) ) ) {
                                                        _this.remove();
                                                        return false;
@@ -108,6 +110,8 @@
        }
 
        function addChallenge( challenge ) {
+               var $tr;
+               var $challenge;
                $challenge = $( '<div />' ).attr( {
                        'class': 'contest-challenge-input',
                        'data-challenge-id': challenge.id,
@@ -128,6 +132,8 @@
        }
 
        $( document ).ready( function() {
+               
+               var $addNew;
 
                $( '#cancelEdit' ).click( function() {
                        window.location = $( this ).attr( 'target-url' );
@@ -156,7 +162,7 @@
                $table.append( '<tr><td colspan="2"><hr /></td></tr>' );
 
                $( '.contest-challenge' ).each( function( index, domElement ) {
-                       $this = $( domElement );
+                       var $this = $( domElement );
                        addChallenge( {
                                'id': $this.attr( 'data-challenge-id' ),
                                'title': $this.attr( 'data-challenge-title' ),
@@ -172,4 +178,4 @@
 
        } );
 
-})( window.jQuery, window.mediaWiki );
+}( jQuery, mediaWiki ) );
diff --git a/resources/contest.special.signup.js 
b/resources/contest.special.signup.js
index 459ccbe..ab42ab9 100644
--- a/resources/contest.special.signup.js
+++ b/resources/contest.special.signup.js
@@ -6,17 +6,23 @@
  * @author Jeroen De Dauw <jeroendedauw at gmail dot com>
  */
 
+/*jshint -W069 */
+
 (function( $, mw ) {
 
        $( document ).ready( function() {
-
-               var _this = this;
                
                this.contestConfig = mw.config.get( 'ContestConfig' );
 
                $( '.mw-htmlform-submit' ).button();
+               
+               var $rules;
+               
+               var $a;
 
                $rules = $( '#contest-rules' );
+               
+               var $div;
 
                $div = $( '<div />' ).attr( {
                        'style': 'display:none'
@@ -40,4 +46,4 @@
                
        } );
 
-})( window.jQuery, window.mediaWiki );
+}( jQuery, mediaWiki ) );
diff --git a/resources/contest.special.submission.js 
b/resources/contest.special.submission.js
index 98abed1..4816ad4 100644
--- a/resources/contest.special.submission.js
+++ b/resources/contest.special.submission.js
@@ -6,7 +6,7 @@
  * @author Jeroen De Dauw <jeroendedauw at gmail dot com>
  */
 
-(function( $, mw ) {
+(function( $ ) {
 
        $( document ).ready( function() {
 
@@ -18,4 +18,4 @@
                
        } );
 
-})( window.jQuery, window.mediaWiki );
+}( jQuery ) );
diff --git a/resources/contest.special.welcome.js 
b/resources/contest.special.welcome.js
index 994d37a..09dee52 100644
--- a/resources/contest.special.welcome.js
+++ b/resources/contest.special.welcome.js
@@ -16,4 +16,4 @@
                );
        } );
 
-})( window.jQuery, window.mediaWiki );
+}( jQuery, mediaWiki ) );
diff --git a/resources/jquery.contestChallenges.js 
b/resources/jquery.contestChallenges.js
index bf25bcd..c2d5d4c 100644
--- a/resources/jquery.contestChallenges.js
+++ b/resources/jquery.contestChallenges.js
@@ -11,7 +11,6 @@
        this.challenges = challenges;
        this.config = config;
 
-       var _this = this;
        var $this = $( this );
 
        this.challengesList = null;
@@ -96,4 +95,4 @@
 
        return this;
 
-}; } )( window.jQuery, window.mediaWiki );
+}; }( jQuery, mediaWiki ) );
diff --git a/resources/jquery.contestEmail.js b/resources/jquery.contestEmail.js
index 58bb1d7..79c6b94 100644
--- a/resources/jquery.contestEmail.js
+++ b/resources/jquery.contestEmail.js
@@ -25,4 +25,4 @@
                return this;
        };
 
-})( window.jQuery, window.mediaWiki );
+}( jQuery, mediaWiki ) );
diff --git a/resources/jquery.contestSubmission.js 
b/resources/jquery.contestSubmission.js
index 7f46f6f..e3c072d 100644
--- a/resources/jquery.contestSubmission.js
+++ b/resources/jquery.contestSubmission.js
@@ -6,6 +6,8 @@
  * @author Jeroen De Dauw <jeroendedauw at gmail dot com>
  */
 
+/*jshint -W059 */
+
 (function( $, mw ) {
 
        /**
@@ -77,8 +79,6 @@
                                domainLinks.push( $( '<div />' ).html( link 
).html() );
                        }
 
-                       var links = $( '<span />' ).html( '' );
-
                        this.label = $( '<label style="display:block" />' 
).attr( {
                                'for': this.config.name
                        } ).text( mw.msg( message ) ).append(
@@ -116,4 +116,4 @@
                return this;
        };
 
-})( window.jQuery, window.mediaWiki );
+}( jQuery, mediaWiki ) );

-- 
To view, visit https://gerrit.wikimedia.org/r/278590
To unsubscribe, visit https://gerrit.wikimedia.org/r/settings

Gerrit-MessageType: merged
Gerrit-Change-Id: I74518323302926fbd235c3017e05c0664f5bbf7b
Gerrit-PatchSet: 6
Gerrit-Project: mediawiki/extensions/Contest
Gerrit-Branch: master
Gerrit-Owner: Paladox <[email protected]>
Gerrit-Reviewer: Hashar <[email protected]>
Gerrit-Reviewer: Jforrester <[email protected]>
Gerrit-Reviewer: Legoktm <[email protected]>
Gerrit-Reviewer: Paladox <[email protected]>
Gerrit-Reviewer: jenkins-bot <>

_______________________________________________
MediaWiki-commits mailing list
[email protected]
https://lists.wikimedia.org/mailman/listinfo/mediawiki-commits

Reply via email to