| 1 |
/** |
| 2 |
* Setup Wizard |
| 3 |
* |
| 4 |
* @package ConvertKit |
| 5 |
* @author ConvertKit |
| 6 |
*/ |
| 7 |
|
| 8 |
/** |
| 9 |
* Conditionally shows and hides elements when a button or link is clicked, based on that |
| 10 |
* button/link's configuration. |
| 11 |
* |
| 12 |
* @since 1.9.8.4 |
| 13 |
*/ |
| 14 |
jQuery( document ).ready( |
| 15 |
function( $ ) { |
| 16 |
|
| 17 |
// Redirect parent screen to a given URL after clicking a link that opens |
| 18 |
// the href URL in a new tab. |
| 19 |
$( 'a.convertkit-redirect' ).on( |
| 20 |
'click', |
| 21 |
function( e ) { |
| 22 |
|
| 23 |
var link = this; |
| 24 |
|
| 25 |
// Delay the redirect, otherwise browsers will block opening the href attribute |
| 26 |
// thinking it's a popup. |
| 27 |
setTimeout( |
| 28 |
function() { |
| 29 |
// Redirect the parent screen to the link's data-convertkit-redirect-url property. |
| 30 |
window.location.href = $( link ).data( 'convertkit-redirect-url' ); |
| 31 |
}, |
| 32 |
1000 |
| 33 |
); |
| 34 |
|
| 35 |
} |
| 36 |
); |
| 37 |
|
| 38 |
// Show a confirmation dialog for specific links. |
| 39 |
$( 'a.convertkit-confirm' ).on( |
| 40 |
'click', |
| 41 |
function( e ) { |
| 42 |
|
| 43 |
if ( ! confirm( $( this ).data( 'message' ) ) ) { |
| 44 |
e.preventDefault(); |
| 45 |
} |
| 46 |
|
| 47 |
} |
| 48 |
); |
| 49 |
|
| 50 |
} |
| 51 |
); |
| 52 |
|