Krinkle has uploaded a new change for review.

  https://gerrit.wikimedia.org/r/59783


Change subject: notifytranslators.js: Fix broken closure
......................................................................

notifytranslators.js: Fix broken closure

This was doing the following:

    jQuery( document ).ready(
            function ( $, mw ) { .. }( jQuery, mediaWiki )
    );

Which does just this:

    ( function ( $, mw ) { .. }( jQuery, mediaWiki ) );

    jQuery( document ).ready( undefined );

Rendering the docucument-ready call useless.

It mangled a closure with a plain jQuery document-ready callback
(which never take "mediaWiki" as argument, obviously).

It worked fine in most cases since this module is loaded from
the bottom so the document is mostly ready.

Fixing. Ignore whitespace since block level was changed for most
of this file.

Change-Id: Ifffafd75799cc60c4f09792cb993ff54b2f875ad
---
M resources/ext.translationnotifications.notifytranslators.js
1 file changed, 82 insertions(+), 80 deletions(-)


  git pull 
ssh://gerrit.wikimedia.org:29418/mediawiki/extensions/TranslationNotifications 
refs/changes/83/59783/1

diff --git a/resources/ext.translationnotifications.notifytranslators.js 
b/resources/ext.translationnotifications.notifytranslators.js
index 9855608..fd28da1 100644
--- a/resources/ext.translationnotifications.notifytranslators.js
+++ b/resources/ext.translationnotifications.notifytranslators.js
@@ -6,98 +6,100 @@
  * @copyright Copyright © 2012 Amir E. Aharoni
  * @license http://www.gnu.org/copyleft/gpl.html GNU General Public License 
2.0 or later
  */
-
-jQuery( document ).ready( function( $, mw ) {
+( function ( $, mw ) {
        'use strict';
 
        var previewId = 'translation-notification-preview',
                sendId = 'translationnotifications-send-notification-button';
 
-       // Show a datepicker.
-       // Based on UploadWizard.
-       $( '#mw-input-wpDeadlineDate' ).datepicker( {
-               dateFormat: 'yy-mm-dd',
-               constrainInput: false,
-               showOn: 'focus',
-               changeMonth: true,
-               changeYear: true,
-               showAnim: false,
-               showButtonPanel: true,
-               minDate: new Date()
-       } )
-       .data( 'open', 0 )
-       .click( function() {
-               var $this = $( this );
-               if ( $this.data( 'open' ) === 0 ) {
-                       $this.data( 'open', 1 ).datepicker( 'show' );
-               } else {
-                       $this.data( 'open', 0 ).datepicker( 'hide' );
-               }
-       } );
+       $( document ).ready( function () {
+               // Show a datepicker.
+               // Based on UploadWizard.
+               $( '#mw-input-wpDeadlineDate' ).datepicker( {
+                       dateFormat: 'yy-mm-dd',
+                       constrainInput: false,
+                       showOn: 'focus',
+                       changeMonth: true,
+                       changeYear: true,
+                       showAnim: false,
+                       showButtonPanel: true,
+                       minDate: new Date()
+               } )
+               .data( 'open', 0 )
+               .click( function() {
+                       var $this = $( this );
+                       if ( $this.data( 'open' ) === 0 ) {
+                               $this.data( 'open', 1 ).datepicker( 'show' );
+                       } else {
+                               $this.data( 'open', 0 ).datepicker( 'hide' );
+                       }
+               } );
 
-       // Attach the language autocomplete widget.
-       $( '#wpUserLanguage' ).multiselectautocomplete( { inputbox : 
'#mw-input-wpLanguagesToNotify' } );
+               // Attach the language autocomplete widget.
+               $( '#wpUserLanguage' ).multiselectautocomplete( { inputbox : 
'#mw-input-wpLanguagesToNotify' } );
 
-       /**
-        * Notification preview
-        */
-       // Initially disable the send button to force at least one preview
-       $( '#' + sendId )
-               .prop( 'disabled', true );
+               /**
+                * Notification preview
+                */
+               // Initially disable the send button to force at least one 
preview
+               $( '#' + sendId )
+                       .prop( 'disabled', true );
 
-       // Add the preview button
-       $( '#notifytranslators-form' ).after(
-               $( '<button>' )
-                       .text( mw.msg( 
'translationnotifications-preview-notification-button' ) )
-                       .click( function () {
-                               var fullText,
-                                       uri = new mw.Uri(),
-                                       priority = '',
-                                       deadline = '',
-                                       translatablePage = $( 
'#mw-input-wpTranslatablePage :selected' ).text(),
-                                       userName = mw.user.getName(),
-                                       $priority = $( '#mw-input-wpPriority 
:selected' ),
-                                       deadlineDate = $( 
'#mw-input-wpDeadlineDate' ).val();
+               // Add the preview button
+               $( '#notifytranslators-form' ).after(
+                       $( '<button>' )
+                               .text( mw.msg( 
'translationnotifications-preview-notification-button' ) )
+                               .click( function () {
+                                       var fullText,
+                                               uri = new mw.Uri(),
+                                               priority = '',
+                                               deadline = '',
+                                               translatablePage = $( 
'#mw-input-wpTranslatablePage :selected' ).text(),
+                                               userName = mw.user.getName(),
+                                               $priority = $( 
'#mw-input-wpPriority :selected' ),
+                                               deadlineDate = $( 
'#mw-input-wpDeadlineDate' ).val();
 
-                               // Enable the send button after the first 
preview
-                               $( '#' + sendId )
-                                       .prop( 'disabled', false );
+                                       // Enable the send button after the 
first preview
+                                       $( '#' + sendId )
+                                               .prop( 'disabled', false );
 
-                               uri.path = mw.config.get( 'wgScript' );
-                               uri.query = {
-                                       title: 'Special:Translate',
-                                       group: 'page-' + translatablePage
-                               };
+                                       uri.path = mw.config.get( 'wgScript' );
+                                       uri.query = {
+                                               title: 'Special:Translate',
+                                               group: 'page-' + 
translatablePage
+                                       };
 
-                               if ( $priority.val() !== 'unset' ) {
-                                       priority = mw.msg( 
'translationnotifications-email-priority', $priority.text() );
-                               }
+                                       if ( $priority.val() !== 'unset' ) {
+                                               priority = mw.msg( 
'translationnotifications-email-priority', $priority.text() );
+                                       }
 
-                               if ( deadlineDate !== '' ) {
-                                       deadline = mw.msg( 
'translationnotifications-email-deadline', deadlineDate );
-                               }
+                                       if ( deadlineDate !== '' ) {
+                                               deadline = mw.msg( 
'translationnotifications-email-deadline', deadlineDate );
+                                       }
 
-                               fullText = mw.message( 
'translationnotifications-talkpage-body',
-                                       userName,
-                                       userName,
-                                       mw.msg( 
'translationnotifications-generic-languages' ),
-                                       translatablePage,
-                                       '[' + uri.toString() + ' ' + 
translatablePage + ']',
-                                       priority,
-                                       deadline,
-                                       $( '#mw-input-wpNotificationText' 
).val(),
-                                       1 // it's just an example, so provide 
one language
-                               );
+                                       fullText = mw.message( 
'translationnotifications-talkpage-body',
+                                               userName,
+                                               userName,
+                                               mw.msg( 
'translationnotifications-generic-languages' ),
+                                               translatablePage,
+                                               '[' + uri.toString() + ' ' + 
translatablePage + ']',
+                                               priority,
+                                               deadline,
+                                               $( 
'#mw-input-wpNotificationText' ).val(),
+                                               1 // it's just an example, so 
provide one language
+                                       );
 
-                               new mw.Api().parse( fullText.escaped().replace( 
/\n{3,}/g, '\n\n' ) )
-                                       .done( function ( parsedNotification ) {
-                                               $( '#' + previewId )
-                                                       .html( 
parsedNotification )
-                                                       .show();
-                                       } );
-                       } ),
-               $( '<div>' )
-                       .hide()
-                       .attr( { id: previewId } )
-       );
+                                       new mw.Api().parse( 
fullText.escaped().replace( /\n{3,}/g, '\n\n' ) )
+                                               .done( function ( 
parsedNotification ) {
+                                                       $( '#' + previewId )
+                                                               .html( 
parsedNotification )
+                                                               .show();
+                                               } );
+                               } ),
+                       $( '<div>' )
+                               .hide()
+                               .attr( { id: previewId } )
+               );
+
+       });
 }( jQuery, mediaWiki ) );

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

Gerrit-MessageType: newchange
Gerrit-Change-Id: Ifffafd75799cc60c4f09792cb993ff54b2f875ad
Gerrit-PatchSet: 1
Gerrit-Project: mediawiki/extensions/TranslationNotifications
Gerrit-Branch: master
Gerrit-Owner: Krinkle <[email protected]>

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

Reply via email to