Dotclear


Ignore:
Timestamp:
02/18/18 18:16:29 (7 years ago)
Author:
franck <carnet.franck.paul@…>
Branch:
default
Message:

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

Location:
plugins/maintenance/js
Files:
2 edited

Legend:

Unmodified
Added
Removed
  • plugins/maintenance/js/dc.maintenance.js

    r2566 r3709  
    1 $(function(){ 
    2      $('.step-box').each(function(){ 
    3           var code = $('input[name=code]',this).val(); 
     1/*global $, dotclear */ 
     2'use strict'; 
    43 
    5           $('.step-submit',this).remove(); 
    6           $('.step-back',this).hide(); 
    7           $('.step-msg',this).after( 
    8                $('<p>').addClass('step-wait').text( 
    9                     dotclear.msg.wait 
    10                ) 
    11           ); 
     4$(function() { 
     5  $('.step-box').each(function() { 
     6    var code = $('input[name=code]', this).val(); 
    127 
    13           dcMaintenanceStep(this,code); 
     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    ); 
    1415 
    15           function dcMaintenanceStep(box,code) { 
    16                var params = { 
    17                     f: 'dcMaintenanceStep', 
    18                     xd_check: dotclear.nonce, 
    19                     task: $(box).attr('id'), 
    20                     code: code 
    21                } 
    22                $.post('services.php',params,function(data) { 
    23                     if ($('rsp[status=failed]',data).length > 0) { 
    24                          $('.step-msg',box).text( 
    25                               $('rsp',data).text() 
    26                          ); 
    27                          $('.step-wait',box).remove(); 
    28                          $('.step-back',box).show(); 
    29                     } else { 
    30                          $('.step-msg',box).text( 
    31                               $('rsp>step',data).attr('title') 
    32                          ); 
    33                          var code = $('rsp>step',data).attr('code'); 
    34                          if (code > 0){ 
    35                               dcMaintenanceStep(box,code); 
    36                          } else { 
    37                               $('#content h2').after($('<div/>').addClass('success').append($('.step-msg',box))); 
    38                               $('.step-wait',box).remove(); 
    39                               $('.step-back',box).show(); 
    40                          } 
    41                     } 
    42                }); 
    43           } 
    44      }); 
     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  }); 
    4548}); 
  • plugins/maintenance/js/settings.js

    r3182 r3709  
    1 $(function(){ 
    2      $('.recall-for-all').attr('disabled','disabled'); 
    3      $('#settings_recall_all').change(function(){ 
    4           if($(this).attr('selected')!='selected'){ 
    5                $('.recall-per-task').attr('disabled','disabled'); 
    6                $('.recall-for-all').removeAttr('disabled'); 
    7           } 
    8      }); 
    9      $('#settings_recall_separate').change(function(){ 
    10           if($(this).attr('selected')!='selected'){ 
    11                $('.recall-per-task').removeAttr('disabled'); 
    12                $('.recall-for-all').attr('disabled','disabled'); 
    13           } 
    14      }); 
    15      dotclear.condSubmit('#part-maintenance input[type="radio"]','#part-maintenance input[type="submit"]'); 
    16      dotclear.condSubmit('#part-backup input[type="radio"]','#part-backup input[type="submit"]'); 
    17      dotclear.condSubmit('#part-dev input[type="radio"]','#part-dev input[type="submit"]'); 
     1/*global $, dotclear */ 
     2'use strict'; 
     3 
     4$(function() { 
     5  $('.recall-for-all').attr('disabled', 'disabled'); 
     6  $('#settings_recall_all').change(function() { 
     7    if ($(this).attr('selected') != 'selected') { 
     8      $('.recall-per-task').attr('disabled', 'disabled'); 
     9      $('.recall-for-all').removeAttr('disabled'); 
     10    } 
     11  }); 
     12  $('#settings_recall_separate').change(function() { 
     13    if ($(this).attr('selected') != 'selected') { 
     14      $('.recall-per-task').removeAttr('disabled'); 
     15      $('.recall-for-all').attr('disabled', 'disabled'); 
     16    } 
     17  }); 
     18  dotclear.condSubmit('#part-maintenance input[type="radio"]', '#part-maintenance input[type="submit"]'); 
     19  dotclear.condSubmit('#part-backup input[type="radio"]', '#part-backup input[type="submit"]'); 
     20  dotclear.condSubmit('#part-dev input[type="radio"]', '#part-dev input[type="submit"]'); 
    1821}); 
Note: See TracChangeset for help on using the changeset viewer.

Sites map