jenkins-bot has submitted this change and it was merged. ( 
https://gerrit.wikimedia.org/r/345873 )

Change subject: Admin UI: delay setup until document ready in campaignManager.js
......................................................................


Admin UI: delay setup until document ready in campaignManager.js

Bug: T144453
Change-Id: I3101cbd223ffb7d4f7769ae2bb7c00219a6be770
---
M resources/infrastructure/campaignManager.js
1 file changed, 30 insertions(+), 28 deletions(-)

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



diff --git a/resources/infrastructure/campaignManager.js 
b/resources/infrastructure/campaignManager.js
index 69a5e15..1a75453 100644
--- a/resources/infrastructure/campaignManager.js
+++ b/resources/infrastructure/campaignManager.js
@@ -27,22 +27,7 @@
                        'ext.centralNotice.adminUi.campaignManager',
                        'campaignMixinParamControls.mustache'
                ),
-               $mixinCheckboxes = $( 'input.noticeMixinCheck' ),
-               $submitBtn = $( '#noticeDetailSubmit' );
-
-       $( '#centralnotice-throttle-amount' ).slider( {
-               range: 'min',
-               min: 0,
-               max: 100,
-               value: $( '#centralnotice-throttle-cur' ).val(),
-               step: stepSize,
-               slide: function ( event, element ) {
-                       var val = Number( element.value ),
-                               rounded = Math.round( val * 10 ) / 10;
-                       $( '#centralnotice-throttle-echo' ).text( String( 
rounded ) + '%' );
-                       $( '#centralnotice-throttle-cur' ).val( val );
-               }
-       } );
+               $mixinCheckboxes, $submitBtn;
 
        function updateThrottle() {
                if ( $( '#throttle-enabled' ).prop( 'checked' ) ) {
@@ -52,8 +37,6 @@
                }
        }
 
-       $( '#throttle-enabled' ).click( updateThrottle );
-
        function updateWeightColumn() {
                if ( $( '#balanced' ).prop( 'checked' ) ) {
                        $( '.cn-weight' ).hide();
@@ -61,8 +44,6 @@
                        $( '.cn-weight' ).show();
                }
        }
-
-       $( '#balanced' ).click( updateWeightColumn );
 
        function updateBuckets() {
                var numBuckets = getNumBuckets(),
@@ -99,8 +80,6 @@
        function getNumBuckets() {
                return parseInt( $( 'select#buckets :selected' ).val(), 10 );
        }
-
-       $( 'select#buckets' ).change( updateBuckets );
 
        /**
         * Hide or display campaign mixin parameter controls based on checkbox 
state.
@@ -296,14 +275,37 @@
                }
        }
 
-       $mixinCheckboxes.each( showOrHideCampaignMixinControls );
-       $mixinCheckboxes.change( showOrHideCampaignMixinControls );
-
-       updateThrottle();
-       updateWeightColumn();
-
+       // Execute code that requires document ready: setup slider, set 
handlers, set variables
+       // for jQuery elements
        $( function () {
+
+               $( '#centralnotice-throttle-amount' ).slider( {
+                       range: 'min',
+                       min: 0,
+                       max: 100,
+                       value: $( '#centralnotice-throttle-cur' ).val(),
+                       step: stepSize,
+                       slide: function ( event, element ) {
+                               var val = Number( element.value ),
+                                       rounded = Math.round( val * 10 ) / 10;
+                               $( '#centralnotice-throttle-echo' ).text( 
String( rounded ) + '%' );
+                               $( '#centralnotice-throttle-cur' ).val( val );
+                       }
+               } );
+
+               $submitBtn = $( '#noticeDetailSubmit' );
+
+               updateThrottle();
+               updateWeightColumn();
                updateBuckets();
+
+               $( '#throttle-enabled' ).click( updateThrottle );
+               $( '#balanced' ).click( updateWeightColumn );
+               $( 'select#buckets' ).change( updateBuckets );
+
+               $mixinCheckboxes = $( 'input.noticeMixinCheck' );
+               $mixinCheckboxes.each( showOrHideCampaignMixinControls );
+               $mixinCheckboxes.change( showOrHideCampaignMixinControls );
        } );
 
 }( jQuery, mediaWiki ) );

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

Gerrit-MessageType: merged
Gerrit-Change-Id: I3101cbd223ffb7d4f7769ae2bb7c00219a6be770
Gerrit-PatchSet: 3
Gerrit-Project: mediawiki/extensions/CentralNotice
Gerrit-Branch: master
Gerrit-Owner: AndyRussG <[email protected]>
Gerrit-Reviewer: Awight <[email protected]>
Gerrit-Reviewer: Cdentinger <[email protected]>
Gerrit-Reviewer: Ejegg <[email protected]>
Gerrit-Reviewer: Ssmith <[email protected]>
Gerrit-Reviewer: XenoRyet <[email protected]>
Gerrit-Reviewer: jenkins-bot <>

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

Reply via email to