Chart.min.js
7 months ago
bulk-conversion.js
7 months ago
bulk-optimization.js
7 months ago
calculate-attachments.js
1 year ago
index.php
3 years ago
meta-migrations.js
3 years ago
modals.js
7 months ago
notices.js
4 months ago
restore-backup.js
7 months ago
settings-premium.js
7 months ago
single-optimization.js
7 months ago
statistic.js
7 months ago
sweetalert2.js
3 years ago
wrio-license-manager.js
7 months ago
meta-migrations.js
53 lines
| 1 | jQuery(function($) { |
| 2 | $('#wbcr-wio-meta-migration-action').on('click', function() { |
| 3 | |
| 4 | var data = { |
| 5 | 'action': 'wrio_meta_migrations', |
| 6 | '_wpnonce': $(this).data('nonce'), |
| 7 | }; |
| 8 | |
| 9 | $(this).addClass('disabled').text('Please wait...'); |
| 10 | |
| 11 | send_request($(this), data); |
| 12 | }); |
| 13 | |
| 14 | function send_request(button, data) { |
| 15 | $.post(window.ajaxurl, data, function(response) { |
| 16 | |
| 17 | console.log(response); |
| 18 | |
| 19 | if( !response || !response.data ) { |
| 20 | console.log('An unknown server error has occurred.'); |
| 21 | console.log(response); |
| 22 | return false; |
| 23 | } |
| 24 | |
| 25 | if( !response.data.need_more_time ) { |
| 26 | if( button.closest('.notice').length ) { |
| 27 | button.closest('.notice').remove(); |
| 28 | } |
| 29 | if( button.closest('.alert').length ) { |
| 30 | button.closest('.alert').remove(); |
| 31 | } |
| 32 | |
| 33 | return false; |
| 34 | } |
| 35 | |
| 36 | button.text(response.data.message); |
| 37 | |
| 38 | send_request(button, data); |
| 39 | }).fail(function(xhr, status, error) { |
| 40 | console.log(xhr); |
| 41 | console.log(status); |
| 42 | console.log(error); |
| 43 | |
| 44 | data.limit = 5; |
| 45 | data.error = 1; |
| 46 | |
| 47 | setTimeout(function() { |
| 48 | send_request(button, data); |
| 49 | }, 2000); |
| 50 | }); |
| 51 | } |
| 52 | }); |
| 53 |