jQuery( document ).ready( function( $ ) {
	if ( $( '.update-google-fonts' )[0] ) {
		$('.update-google-fonts').trigger('click');
	}

	if ( $( '.error' )[0] ) {
		$( '.error' ).find( 'a[href*="page=kadence-blocks-home"]' ).parents( 'p' ).remove();

		if ( $( '.error' ).is( ':empty' ) ) {
			$( '.error' ).remove();
		}
	}

	$( '<input type="submit" name="redux_save_exit" class="redux-save-exit button button-primary" value="Save & Exit">' ).insertBefore( 'input[name="redux_save"]' );

	$( document ).on( 'click', '.redux-save-exit', function( e ) {
		e.preventDefault();

		$.when( $( 'input[name="redux_save"]' ).trigger( 'click' ) )
		.done(function () {
			setTimeout( function() {
				window.location.replace( wpj_vars.admin_url );
			}, 100 );
		});
	});
});