Этот коммит содержится в:
Igor V Belousov 2015-06-10 17:13:55 +03:00
родитель e4cc72e437
Коммит 54b6791395
2 изменённых файлов: 15 добавлений и 11 удалений

Просмотреть файл

@ -1,26 +1,30 @@
jQuery(document).ready(function($) { jQuery( document ).ready( function($) {
var batch_progress = function ( data ) { var batch_progress = function ( data ) {
$( '.batch-progress-message' ).html( data['progress_message'] ); $( '.batch-progress-message' ).html( data['progress_message'] );
$( '.batch-percent' ).html( data['percent'] + "%" ); var percent = 0;
$( '.batch-progress > span' ).animate({ width: data['percent'] + "%" }, 500); if ( 'undefined' != typeof data['percent'] ) {
percent = data['percent'];
}
$( '.batch-percent' ).html( percent + "%" );
$( '.batch-progress > span' ).animate({ width: percent + "%" }, 500);
}; };
function batch_process() { function batch_process() {
$.post( $.post(
ajaxurl+'?action=batch_operations&id='+batch_id, ajaxurl + '?action=batch_operations&id=' + batch_id,
function(data){ function( data ) {
if (data['do']=='finish') if ( 'finish' == data['do'] )
{ {
batch_progress( data ); batch_progress( data );
$('.batch-message').html(data['message']).delay(1500).queue(function () { $( '.batch-message' ).html( data['message'] ).delay( 1500 ).queue( function () {
$(location).attr('href',successful_page); $( location ).attr( 'href', successful_page );
$(this).dequeue(); $( this ).dequeue();
} }
); );
} }
else else
{ {
$('.batch-message').html(data['message']); $( '.batch-message' ).html( data['message'] );
batch_progress( data ); batch_progress( data );
batch_process() batch_process()
} }

2
js/batch.min.js поставляемый
Просмотреть файл

@ -1 +1 @@
jQuery(document).ready(function(a){function b(){a.post(ajaxurl+"?action=batch_operations&id="+batch_id,function(d){"finish"==d["do"]?(c(d),a(".batch-message").html(d.message).delay(1500).queue(function(){a(location).attr("href",successful_page),a(this).dequeue()})):(a(".batch-message").html(d.message),c(d),b())})}var c=function(b){a(".batch-progress-message").html(b.progress_message),a(".batch-percent").html(b.percent+"%"),a(".batch-progress > span").animate({width:b.percent+"%"},500)};b()}); jQuery(document).ready(function(a){function b(){a.post(ajaxurl+"?action=batch_operations&id="+batch_id,function(d){"finish"==d["do"]?(c(d),a(".batch-message").html(d.message).delay(1500).queue(function(){a(location).attr("href",successful_page),a(this).dequeue()})):(a(".batch-message").html(d.message),c(d),b())})}var c=function(b){a(".batch-progress-message").html(b.progress_message);var c=0;"undefined"!=typeof b.percent&&(c=b.percent),a(".batch-percent").html(c+"%"),a(".batch-progress > span").animate({width:c+"%"},500)};b()});