Dotclear


Ignore:
Timestamp:
09/18/18 20:22:10 (7 years ago)
Author:
franck <carnet.franck.paul@…>
Branch:
default
Message:

Use let and const rather than var (ES2015/ES6), use template string where is more efficient

File:
1 edited

Legend:

Unmodified
Added
Removed
  • admin/js/_blog_theme.js

    r3768 r3880  
    55  // expend theme info 
    66  $('.module-sshot').not('.current-theme .module-sshot').each(function() { 
    7     var bar = $('<div>').addClass('bloc-toggler'); 
     7    const bar = $('<div>').addClass('bloc-toggler'); 
    88    $(this).after( 
    99      $(bar).toggleWithLegend($(this).parent().children('.toggle-bloc'), { 
     
    2222  // dirty short search blocker 
    2323  $('div.modules-search form input[type=submit]').click(function() { 
    24     var mlen = $('input[name=m_search]', $(this).parent()).val(); 
     24    const mlen = $('input[name=m_search]', $(this).parent()).val(); 
    2525    if (mlen.length > 2) { 
    2626      return true; 
     
    3737  // actions tests 
    3838  $('.modules-form-actions').each(function() { 
    39     var rxActionType = /^[^\[]+/; 
    40     var rxActionValue = /([^\[]+)\]$/; 
    41     var checkboxes = $(this).find('input[type=checkbox]'); 
     39    const rxActionType = /^[^\[]+/; 
     40    const rxActionValue = /([^\[]+)\]$/; 
     41    const checkboxes = $(this).find('input[type=checkbox]'); 
    4242 
    4343    // check if submit is a global action or one line action 
    4444    $('input[type=submit]', this).click(function() { 
    45       var keyword = $(this).attr('name'); 
     45      const keyword = $(this).attr('name'); 
    4646      if (!keyword) { 
    4747        return true; 
    4848      } 
    49       var maction = keyword.match(rxActionType); 
    50       var action = maction[0]; 
    51       var mvalues = keyword.match(rxActionValue); 
     49      const maction = keyword.match(rxActionType); 
     50      const action = maction[0]; 
     51      const mvalues = keyword.match(rxActionValue); 
    5252 
    5353      // action on multiple modules 
    5454      if (!mvalues) { 
    55         var checked = false; 
     55        let checked = false; 
    5656 
    5757        // check if there is checkboxes in form 
     
    7676        // action on one module 
    7777      } else { 
    78         var module = mvalues[1]; 
     78        const module = mvalues[1]; 
    7979 
    8080        // confirm delete 
Note: See TracChangeset for help on using the changeset viewer.

Sites map