stepper.js
1.66 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
jQuery(function () {
jQuery('#icl-migrate-start').one('click', function () {
iclStepper(jQuery(this).attr('href'), '&init=1', true);
return false;
});
});
function iclStepper(href, addUrl, init) {
init = typeof(init) != 'undefined' ? true : false;
jQuery.ajax({
type: "POST",
url: href+addUrl,
cache: false,
dataType: 'json',
success: function(data) {
if (data.stop == true) {
jQuery('#icl-migrate-progress .message').html('stopped');
} else if (data.error == false) {
if (init == true) {
jQuery('#icl-migrate-start').fadeOut(function(){
jQuery('#icl-migrate-progress').fadeIn().html(data.output).children('.message').html(data.message);
iclStepper(href, '&step='+data.step);
});
// jQuery('#icl-migrate-progress').html(data.output).children('.message').html(data.message);
} else {
jQuery('#icl-migrate-progress .message').html(data.message);
jQuery('#icl-migrate-progress .progress').animate({
width : data.barWidth+'%'
}, 100);
if (data.completed == true) {
jQuery('#icl-migrate').delay(3000).fadeOut();
} else {
iclStepper(href, '&step='+data.step);
}
}
} else {
alert('error');
jQuery('#icl-migrate-progress .message').html(data.error);
}
}
});
}