customize.js
34 lines
| 1 | (function ($) { |
| 2 | $(document).on('click', '.analyst-notice-dismiss', function () { |
| 3 | var id = $(this).attr('analyst-notice-id'); |
| 4 | var self = this; |
| 5 | |
| 6 | $.post(ajaxurl, { |
| 7 | action: 'analyst_notification_dismiss', |
| 8 | id: id, |
| 9 | nonce: analyst_opt_localize.nonce |
| 10 | }).done(function () { |
| 11 | $(self).parent().fadeOut() |
| 12 | }) |
| 13 | }) |
| 14 | |
| 15 | var url = new URL(window.location.href) |
| 16 | |
| 17 | if (url.searchParams.has('verify')) { |
| 18 | var pluginId = url.searchParams.get('plugin_id') |
| 19 | |
| 20 | $.ajax({ |
| 21 | url: ajaxurl, |
| 22 | method: 'POST', |
| 23 | data: { |
| 24 | action: 'analyst_install_verified_' + pluginId, |
| 25 | nonce: analyst_opt_localize.nonce |
| 26 | }, |
| 27 | success: function () { |
| 28 | // Refresh page without query params |
| 29 | window.location.href = window.location.origin + window.location.pathname |
| 30 | } |
| 31 | }) |
| 32 | } |
| 33 | })(jQuery) |
| 34 |