| @@ -1,8 +1,7 @@ | ||
| 1 | 1 | /** |
| 2 | 2 | * Setup Wizard |
| 3 | 3 | * |
| 4 | - * @package ConvertKit | |
| 5 | 4 | * @author ConvertKit |
| 6 | 5 | */ |
| 7 | 6 | |
| 8 | 7 | /** |
| @@ -10,42 +9,32 @@ | ||
| 10 | 9 | * button/link's configuration. |
| 11 | 10 | * |
| 12 | 11 | * @since 1.9.8.4 |
| 13 | 12 | */ |
| 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 | - | |
| 13 | +document.addEventListener('DOMContentLoaded', function () { | |
| 14 | + // Redirect parent screen to a given URL after clicking a link that opens | |
| 15 | + // the href URL in a new tab. | |
| 16 | + document | |
| 17 | + .querySelectorAll('a.convertkit-redirect') | |
| 18 | + .forEach(function (element) { | |
| 19 | + element.addEventListener('click', function () { | |
| 25 | 20 | // Delay the redirect, otherwise browsers will block opening the href attribute |
| 26 | 21 | // 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 | - ); | |
| 22 | + setTimeout(function () { | |
| 23 | + // Redirect the parent screen to the link's data-convertkit-redirect-url property. | |
| 24 | + window.location.href = | |
| 25 | + element.dataset.convertkitRedirectUrl; | |
| 26 | + }, 1000); | |
| 27 | + }); | |
| 28 | + }); | |
| 34 | 29 | |
| 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' ) ) ) { | |
| 30 | + // Show a confirmation dialog for specific links. | |
| 31 | + document | |
| 32 | + .querySelectorAll('a.convertkit-confirm') | |
| 33 | + .forEach(function (element) { | |
| 34 | + element.addEventListener('click', function (e) { | |
| 35 | + if (!confirm(element.dataset.message)) { | |
| 44 | 36 | e.preventDefault(); |
| 45 | 37 | } |
| 46 | - | |
| 47 | - } | |
| 48 | - ); | |
| 49 | - | |
| 50 | - } | |
| 51 | -); | |
| 38 | + }); | |
| 39 | + }); | |
| 40 | +}); | |