2015-06-05 19:26:11 +00:00
|
|
|
jQuery(document).ready(function($) {
|
2015-06-10 09:51:19 +00:00
|
|
|
var batch_progress = function ( data ) {
|
|
|
|
$( '.batch-progress-message' ).html( data['progress_message'] );
|
|
|
|
$( '.batch-percent' ).html( data['percent'] + "%" );
|
|
|
|
$( '.batch-progress > span' ).animate({ width: data['percent'] + "%" }, 500);
|
2015-06-05 19:26:11 +00:00
|
|
|
};
|
|
|
|
|
2015-06-10 09:51:19 +00:00
|
|
|
function batch_process() {
|
2015-06-05 19:26:11 +00:00
|
|
|
$.post(
|
|
|
|
ajaxurl+'?action=batch_operations&id='+batch_id,
|
|
|
|
function(data){
|
|
|
|
if (data['do']=='finish')
|
|
|
|
{
|
2015-06-10 09:51:19 +00:00
|
|
|
batch_progress( data );
|
2015-06-05 19:26:11 +00:00
|
|
|
$('.batch-message').html(data['message']).delay(1500).queue(function () {
|
|
|
|
$(location).attr('href',successful_page);
|
|
|
|
$(this).dequeue();
|
|
|
|
}
|
|
|
|
);
|
|
|
|
}
|
|
|
|
else
|
|
|
|
{
|
|
|
|
$('.batch-message').html(data['message']);
|
2015-06-10 09:51:19 +00:00
|
|
|
batch_progress( data );
|
2015-06-05 19:26:11 +00:00
|
|
|
batch_process()
|
|
|
|
}
|
|
|
|
}
|
|
|
|
);
|
|
|
|
}
|
|
|
|
|
|
|
|
batch_process();
|
|
|
|
|
|
|
|
});
|