Skip to content
batch.js 939 B
Newer Older
 * Attaches the batch behavior to progress bars.
    $('#progress', context).once('batch', function () {
      // Success: redirect to the summary.
      var updateCallback = function (progress, status, pb) {
        if (progress == 100) {
          pb.stopMonitoring();
          window.location = settings.batch.uri + '&op=finished';
        holder.prepend($('<p class="error"></p>').html(settings.batch.errorMessage));
      var progress = new Drupal.progressBar('updateprogress', updateCallback, 'POST', errorCallback);
      progress.setProgress(-1, settings.batch.initMessage);
      holder.append(progress.element);
      progress.startMonitoring(settings.batch.uri + '&op=do', 10);