2 * DO NOT EDIT THIS FILE.
3 * See the following change record for more information,
4 * https://www.drupal.org/node/2815083
8 (function ($, Drupal) {
9 Drupal.behaviors.batch = {
10 attach: function attach(context, settings) {
11 var batch = settings.batch;
12 var $progress = $('[data-drupal-progress]').once('batch');
13 var progressBar = void 0;
15 function updateCallback(progress, status, pb) {
16 if (progress === '100') {
18 window.location = batch.uri + '&op=finished';
22 function errorCallback(pb) {
23 $progress.prepend($('<p class="error"></p>').html(batch.errorMessage));
27 if ($progress.length) {
28 progressBar = new Drupal.ProgressBar('updateprogress', updateCallback, 'POST', errorCallback);
29 progressBar.setProgress(-1, batch.initMessage);
30 progressBar.startMonitoring(batch.uri + '&op=do', 10);
34 $progress.append(progressBar.element);