Security update to Drupal 8.4.6
[yaffs-website] / web / core / misc / batch.js
1 /**
2 * DO NOT EDIT THIS FILE.
3 * See the following change record for more information,
4 * https://www.drupal.org/node/2815083
5 * @preserve
6 **/
7
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;
14
15       function updateCallback(progress, status, pb) {
16         if (progress === '100') {
17           pb.stopMonitoring();
18           window.location = batch.uri + '&op=finished';
19         }
20       }
21
22       function errorCallback(pb) {
23         $progress.prepend($('<p class="error"></p>').html(batch.errorMessage));
24         $('#wait').hide();
25       }
26
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);
31
32         $progress.empty();
33
34         $progress.append(progressBar.element);
35       }
36     }
37   };
38 })(jQuery, Drupal);