Dotclear

source: plugins/maintenance/js/dc.maintenance.js @ 3709:c88e69474c34

Revision 3709:c88e69474c34, 1.3 KB checked in by franck <carnet.franck.paul@…>, 7 years ago (diff)

use strict and no more linter warnings/errors as far as possible, switch from inline js to separate loaded file

Line 
1/*global $, dotclear */
2'use strict';
3
4$(function() {
5  $('.step-box').each(function() {
6    var code = $('input[name=code]', this).val();
7
8    $('.step-submit', this).remove();
9    $('.step-back', this).hide();
10    $('.step-msg', this).after(
11      $('<p>').addClass('step-wait').text(
12        dotclear.msg.wait
13      )
14    );
15
16    dcMaintenanceStep(this, code);
17
18    function dcMaintenanceStep(box, code) {
19      var params = {
20        f: 'dcMaintenanceStep',
21        xd_check: dotclear.nonce,
22        task: $(box).attr('id'),
23        code: code
24      };
25      $.post('services.php', params, function(data) {
26        if ($('rsp[status=failed]', data).length > 0) {
27          $('.step-msg', box).text(
28            $('rsp', data).text()
29          );
30          $('.step-wait', box).remove();
31          $('.step-back', box).show();
32        } else {
33          $('.step-msg', box).text(
34            $('rsp>step', data).attr('title')
35          );
36          var code = $('rsp>step', data).attr('code');
37          if (code > 0) {
38            dcMaintenanceStep(box, code);
39          } else {
40            $('#content h2').after($('<div/>').addClass('success').append($('.step-msg', box)));
41            $('.step-wait', box).remove();
42            $('.step-back', box).show();
43          }
44        }
45      });
46    }
47  });
48});
Note: See TracBrowser for help on using the repository browser.

Sites map