(function( $, wp, _ ) { /** * Create and display a spinner next to an element * * @param element */ function createSpinner( element ) { var $spinner = $( '', { class: 'spinner' } ); $spinner.css( { 'display': 'inline-block', 'float': 'none', 'visibility': 'visible' } ); $spinner.insertAfter( element ); return $spinner; } $( document ).ready( function() { // Move the filesystem credential form below the last error notice var $lastNotice = $( '.as3cf-pro-installer-notice' ).last(); $( '.as3cfpro-installer-filesystem-creds' ).insertAfter( $lastNotice ); $( '.as3cfpro-installer-filesystem-creds form' ).on( 'submit', function( e ) { var $submitBtn = $( '#upgrade' ); if ( $submitBtn.hasClass( 'button-disabled' ) ) { return; } $submitBtn.addClass( 'button-disabled' ); $submitBtn.val( as3cfpro_installer.strings.installing + '...' ); createSpinner( $submitBtn ); } ); $( 'body' ).on( 'click', '.as3cf-pro-installer .install-plugins', function( e ) { e.preventDefault(); if ( $( this ).hasClass( 'button-disabled' ) ) { return; } $( this ).addClass( 'button-disabled' ); $( this ).text( as3cfpro_installer.strings.installing + '...' ); var $spinner = createSpinner( this ); /** * Render an error notice and remove the installer notice * * @param string errorMessage */ function installerError( errorMessage ) { var noticeText = as3cfpro_installer.strings.error_installing + ': ' + errorMessage; var noticeHtml = '
' + noticeText + '