# convertkit/2.6.6/resources/backend/js/setup-wizard.js

Kit (formerly ConvertKit) – Email Newsletter, Email Marketing, Membership, Subscribers and Landing Pages, version 2.6.6. 63 lines.

- Page: https://pluginprobe.com/plugins/convertkit/2.6.6/code/resources/backend/js/setup-wizard.js
- Raw: https://pluginprobe.com/plugins/convertkit/2.6.6/raw/resources/backend/js/setup-wizard.js
- Modified: 2024-02-19T13:27:22+00:00

Line numbers below start at 1. Link to a line or a range by appending a fragment to the
page URL, for example `https://pluginprobe.com/plugins/convertkit/2.6.6/code/resources/backend/js/setup-wizard.js#L10-L20`.

```javascript
/**
 * Setup Wizard
 *
 * @package ConvertKit
 * @author ConvertKit
 */

/**
 * Conditionally shows and hides elements when a button or link is clicked, based on that
 * button/link's configuration.
 *
 * @since 	1.9.8.4
 */
document.addEventListener(
	'DOMContentLoaded',
	function () {

		// Redirect parent screen to a given URL after clicking a link that opens
		// the href URL in a new tab.
		document.querySelectorAll( 'a.convertkit-redirect' ).forEach(
			function ( element ) {

				element.addEventListener(
					'click',
					function ( e ) {

						// Delay the redirect, otherwise browsers will block opening the href attribute
						// thinking it's a popup.
						setTimeout(
							function () {
								// Redirect the parent screen to the link's data-convertkit-redirect-url property.
								window.location.href = element.dataset.convertkitRedirectUrl;
							},
							1000
						);

					}
				);

			}
		);

		// Show a confirmation dialog for specific links.
		document.querySelectorAll( 'a.convertkit-confirm' ).forEach(
			function ( element ) {

				element.addEventListener(
					'click',
					function ( e ) {

						if ( ! confirm( element.dataset.message ) ) {
							e.preventDefault();
						}

					}
				);

			}
		);

	}
);

```
