| @@ -1,40 +1,14 @@ | ||
| 1 | -document.addEventListener('DOMContentLoaded', function() { | |
| 1 | +import './autocomplete_steps' | |
| 2 | 2 | |
| 3 | - const pluginSplitClose = document.getElementById('plugin-split-close'); | |
| 3 | +(function ($) { | |
| 4 | 4 | |
| 5 | - if(pluginSplitClose) { | |
| 6 | - pluginSplitClose.addEventListener('click', function () { | |
| 7 | - let nonceElement = document.getElementById('hts_close_plugin_split_nonce'); | |
| 5 | + $(document).on('ready', function () { | |
| 6 | + const nonce = $('#hts_close_omnisend_nonce').val(); | |
| 7 | + $('.hts-omnisend .notice-dismiss').on('click', function() { | |
| 8 | + $.post(ajaxurl, { action: 'hostinger_dismiss_omnisend_notice', nonce: nonce }); | |
| 9 | + $('.hts-omnisend').remove(); | |
| 10 | + }); | |
| 8 | 11 | |
| 9 | - if (!nonceElement) { | |
| 10 | - console.error('Nonce element not found.'); | |
| 11 | - return; | |
| 12 | - } | |
| 12 | + }); | |
| 13 | 13 | |
| 14 | - let nonce = nonceElement.value; | |
| 15 | - | |
| 16 | - fetch(ajaxurl, { | |
| 17 | - method: 'POST', | |
| 18 | - headers: { | |
| 19 | - 'Content-Type': 'application/x-www-form-urlencoded', | |
| 20 | - }, | |
| 21 | - body: new URLSearchParams({ | |
| 22 | - 'action': 'hostinger_dismiss_plugin_split_notice', | |
| 23 | - 'nonce': nonce | |
| 24 | - }), | |
| 25 | - }) | |
| 26 | - .then(response => { | |
| 27 | - if (!response.ok) { | |
| 28 | - throw new Error('Network response was not ok ' + response.statusText); | |
| 29 | - } | |
| 30 | - return response.json(); | |
| 31 | - }) | |
| 32 | - .then(data => { | |
| 33 | - document.getElementById('hostinger-plugin-split-notice').style.display = 'none'; | |
| 34 | - }) | |
| 35 | - .catch(error => { | |
| 36 | - console.error('Error:', error); | |
| 37 | - }); | |
| 38 | - }); | |
| 39 | - } | |
| 40 | -}); | |
| 14 | +})(jQuery); | |