| 1 |
jQuery(document).ready(($) => { |
| 2 |
|
| 3 |
let process_posts = () => { |
| 4 |
let data = { |
| 5 |
action : 'substack_progress' |
| 6 |
}; |
| 7 |
|
| 8 |
$.post(ajaxurl, data, (response) => { |
| 9 |
let progress = (response.processed / response.total) * 100; |
| 10 |
$('#substack-progress .progress-bar-fill').css('width', progress + '%'); |
| 11 |
if(response.status === 'processing') { |
| 12 |
process_posts(); |
| 13 |
} else { |
| 14 |
window.location = $('#substack-progress').data('pre-import-url'); |
| 15 |
} |
| 16 |
}); |
| 17 |
}; |
| 18 |
|
| 19 |
if( $('div#substack-progress').length ) { |
| 20 |
process_posts(); |
| 21 |
} |
| 22 |
|
| 23 |
}); |
| 24 |
|
| 25 |
|