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

Change subject: Code order, whitespace, variable fixes
......................................................................


Code order, whitespace, variable fixes

Move functions to the top to make them more obvious, fix some
whitespaces and remove a variable that's only used twice.

Change-Id: I1eaeaf3949210604142895021b9426f2b061e20e
---
M modules/ext.MassMessage.create.js
1 file changed, 42 insertions(+), 43 deletions(-)

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



diff --git a/modules/ext.MassMessage.create.js 
b/modules/ext.MassMessage.create.js
index c8fcdd3..c8f6427 100644
--- a/modules/ext.MassMessage.create.js
+++ b/modules/ext.MassMessage.create.js
@@ -3,52 +3,10 @@
                /*global setTimeout, clearTimeout*/
                'use strict';
 
-               var $formImport = $( '#mw-input-wpcontent-import'),
-                       $formSource = $( '#mw-input-wpsource'),
+               var $formSource = $( '#mw-input-wpsource' ),
                        $formSourceTr = $formSource.parent().parent(),
                        checkSourceTimeout = -1,
                        checkSource, pageIsValidSource, showCreateError, 
removeCreateError;
-
-               // Set the correct field state on load.
-               if ( !$formImport.is( ':checked' ) ) {
-                       $formSourceTr.hide(); // Progressive disclosure
-               }
-
-               $( '#mw-input-wpcontent-new' ).click( function () {
-                       $formSourceTr.hide();
-                       removeCreateError( 'massmessage-create-invalidsource' );
-               } );
-
-               $formImport.click( function () {
-                       $formSourceTr.show();
-               } );
-
-               // Warn if page title is already in use
-               $( '#mw-input-wptitle' ).blur( function () {
-                       ( new mw.Api() ).get( {
-                               action: 'query',
-                               prop: 'info',
-                               titles: $( this ).val()
-                       } ).done( function ( data ) {
-                               if ( data && data.query ) {
-                                       if ( !data.query.pages['-1'] ) {
-                                               // Page with title already 
exists
-                                               showCreateError( 
'massmessage-create-exists' );
-                                       } else {
-                                               removeCreateError( 
'massmessage-create-exists' );
-                                       }
-                               }
-                       } );
-               } );
-
-               // Warn if delivery list source is invalid
-               $formSource.on( 'input autocompleteselect', function () {
-                       // debouncing - don't want to make an API call per 
request, nor give an error
-                       // when the user starts typing
-                       removeCreateError( 'massmessage-create-invalidsource' );
-                       clearTimeout(checkSourceTimeout);
-                       checkSourceTimeout = setTimeout(checkSource, 300);
-               } );
 
                checkSource = function () {
                        ( new mw.Api() ).get( {
@@ -98,6 +56,47 @@
                        $( 'div.error[data-key=\'' + msgKey + '\']' ).remove();
                };
 
+               // Set the correct field state on load.
+               if ( !$( '#mw-input-wpcontent-import' ).is( ':checked' ) ) {
+                       $formSourceTr.hide(); // Progressive disclosure
+               }
+
+               $( '#mw-input-wpcontent-new' ).click( function () {
+                       $formSourceTr.hide();
+                       removeCreateError( 'massmessage-create-invalidsource' );
+               } );
+
+               $( '#mw-input-wpcontent-import' ).click( function () {
+                       $formSourceTr.show();
+               } );
+
+               // Warn if page title is already in use
+               $( '#mw-input-wptitle' ).blur( function () {
+                       ( new mw.Api() ).get( {
+                               action: 'query',
+                               prop: 'info',
+                               titles: $( this ).val()
+                       } ).done( function ( data ) {
+                               if ( data && data.query ) {
+                                       if ( !data.query.pages['-1'] ) {
+                                               // Page with title already 
exists
+                                               showCreateError( 
'massmessage-create-exists' );
+                                       } else {
+                                               removeCreateError( 
'massmessage-create-exists' );
+                                       }
+                               }
+                       } );
+               } );
+
+               // Warn if delivery list source is invalid
+               $formSource.on( 'input autocompleteselect', function () {
+                       // debouncing - don't want to make an API call per 
request, nor give an error
+                       // when the user starts typing
+                       removeCreateError( 'massmessage-create-invalidsource' );
+                       clearTimeout( checkSourceTimeout );
+                       checkSourceTimeout = setTimeout( checkSource, 300 );
+               } );
+
                mw.massmessage.enableTitleComplete( $formSource );
        } );
 }( mediaWiki, jQuery ) );

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

Gerrit-MessageType: merged
Gerrit-Change-Id: I1eaeaf3949210604142895021b9426f2b061e20e
Gerrit-PatchSet: 2
Gerrit-Project: mediawiki/extensions/MassMessage
Gerrit-Branch: master
Gerrit-Owner: Wctaiwan <[email protected]>
Gerrit-Reviewer: Legoktm <[email protected]>
Gerrit-Reviewer: Wctaiwan <[email protected]>
Gerrit-Reviewer: jenkins-bot <>

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

Reply via email to