bindSubmit() {
			const submitButton = this.onboardingModal.querySelector(
				'button[type="submit"]'
			);
			const self = this;

			if ( submitButton ) {
				submitButton.addEventListener( 'click', function( e ) {
					e.preventDefault();

					// Because we are not rendering the template, we need to update the last element value.
					const input = self.onboardingModal.querySelector(
						'input[type="checkbox"]'
					);
					if ( input ) {
						self.selection[ input.id ] = input.checked;
					}

					const _nonce = document.getElementById(
						'smush_quick_setup_nonce'
					);

					const xhr = new XMLHttpRequest();
					xhr.open( 'POST', ajaxurl + '?action=smush_setup', true );
					xhr.setRequestHeader(
						'Content-type',
						'application/x-www-form-urlencoded'
					);
					xhr.onload = () => {
						if ( 200 === xhr.status ) {
							WP_Smush.onboarding.showScanDialog();
						} else {
							window.console.log(
								'Request failed.  Returned status of ' +
									xhr.status
							);
						}
					};
					xhr.send(
						'smush_settings=' +
							JSON.stringify( self.selection ) +
							'&_ajax_nonce=' +
							_nonce.value
					);
				} );
			}
		}
/**
		 * Catch "Finish setup wizard" button click.
		 */
Catch "Finish setup wizard" button click.
Catch " Finish setup wizard " button click .
bindSubmit() {
			const submitButton = this.onboardingModal.querySelector(
				'button[type="submit"]'
			);
			const self = this;
			if ( submitButton ) {
				submitButton.addEventListener( 'click', function( e ) {
					e.preventDefault();
					const input = self.onboardingModal.querySelector(
						'input[type="checkbox"]'
					);
					if ( input ) {
						self.selection[ input.id ] = input.checked;
					}
					const _nonce = document.getElementById(
						'smush_quick_setup_nonce'
					);
					const xhr = new XMLHttpRequest();
					xhr.open( 'POST', ajaxurl + '?action=smush_setup', true );
					xhr.setRequestHeader(
						'Content-type',
						'application/x-www-form-urlencoded'
					);
					xhr.onload = () => {
						if ( 200 === xhr.status ) {
							WP_Smush.onboarding.showScanDialog();
						} else {
							window.console.log(
								'Request failed.  Returned status of ' +
									xhr.status
							);
						}
					};
					xhr.send(
						'smush_settings=' +
							JSON.stringify( self.selection ) +
							'&_ajax_nonce=' +
							_nonce.value
					);
				} );
			}
		}
bindSubmit ( ) { const submitButton = this . onboardingModal . querySelector ( 'button[type="submit"]' ) ; const self = this ; if ( submitButton ) { submitButton . addEventListener ( 'click' , function ( e ) { e . preventDefault ( ) ; const input = self . onboardingModal . querySelector ( 'input[type="checkbox"]' ) ; if ( input ) { self . selection [ input . id ] = input . checked ; } const _nonce = document . getElementById ( 'smush_quick_setup_nonce' ) ; const xhr = new XMLHttpRequest ( ) ; xhr . open ( 'POST' , ajaxurl + '?action=smush_setup' , true ) ; xhr . setRequestHeader ( 'Content-type' , 'application/x-www-form-urlencoded' ) ; xhr . onload = ( ) => { if ( 200 === xhr . status ) { WP_Smush . onboarding . showScanDialog ( ) ; } else { window . console . log ( 'Request failed.  Returned status of ' + xhr . status ) ; } } ; xhr . send ( 'smush_settings=' + JSON . stringify ( self . selection ) + '&_ajax_nonce=' + _nonce . value ) ; } ) ; } }
Catch "Finish setup wizard" button click.
Catch " Finish setup wizard " button click .
// Because we are not rendering the template, we need to update the last element value.