Skip to content

Commit

Permalink
Also hide the cancel button
Browse files Browse the repository at this point in the history
  • Loading branch information
tyxla committed Sep 30, 2019
1 parent 20ef8f2 commit 22063d8
Showing 1 changed file with 10 additions and 8 deletions.
18 changes: 10 additions & 8 deletions _inc/connect-button.js
Original file line number Diff line number Diff line change
Expand Up @@ -4,13 +4,15 @@ jQuery( document ).ready( function( $ ) {
var connectButton = $( '.jp-connect-button, .jp-banner__alt-connect-button' ).eq( 0 );
var tosText = $( '.jp-connect-full__tos-blurb' );
var jetpackConnectIframe = $( '<iframe class="jp-jetpack-connect__iframe" />' );
var connectionCards = $( '#jetpack-connection-cards' );
var connectionHelpSections = $(
'#jetpack-connection-cards, .jp-connect-full__dismiss-paragraph'
);

connectButton.on( 'click', function( event ) {
event.preventDefault();

if ( connectionCards.length ) {
connectionCards.fadeOut( 600 );
if ( connectionHelpSections.length ) {
connectionHelpSections.fadeOut( 600 );
}

jetpackConnectButton.selectAndStartConnectionFlow();
Expand All @@ -20,9 +22,9 @@ jQuery( document ).ready( function( $ ) {
isRegistering: false,
isPaidPlan: false,
selectAndStartConnectionFlow: function() {
var connectionCards = $( '#jetpack-connection-cards' );
if ( connectionCards.length ) {
connectionCards.fadeOut( 600 );
var connectionHelpSections = $( '#jetpack-connection-cards' );
if ( connectionHelpSections.length ) {
connectionHelpSections.fadeOut( 600 );
}

if ( ! jetpackConnectButton.isRegistering ) {
Expand Down Expand Up @@ -160,8 +162,8 @@ jQuery( document ).ready( function( $ ) {
// When we visit /wp-admin/admin.php?page=jetpack#/setup, immediately start the connection flow.
var hash = location.hash.replace( /#\//, '' );
if ( 'setup' === hash ) {
if ( connectionCards.length ) {
connectionCards.hide();
if ( connectionHelpSections.length ) {
connectionHelpSections.hide();
}

jetpackConnectButton.selectAndStartConnectionFlow();
Expand Down

0 comments on commit 22063d8

Please sign in to comment.