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
  • plugins/blowupConfig/js/config.js

    r3768 r3880  
    3939 
    4040  // Predefined styles 
    41   var styles_combo = document.createElement('select'); 
     41  const styles_combo = document.createElement('select'); 
    4242  $(styles_combo).append('<option value="">&nbsp;</option>'); 
    4343  $(styles_combo).append('<option value="none">none</option>'); 
    4444  $(styles_combo).attr('title', dotclear.msg.predefined_style_title); 
    4545 
    46   for (var style in dotclear.blowup_styles) { 
    47     var styles_option = document.createElement('option'); 
     46  for (let style in dotclear.blowup_styles) { 
     47    const styles_option = document.createElement('option'); 
    4848    styles_option.value = dotclear.blowup_styles[style]; 
    4949    $(styles_option).append(style); 
     
    6868 
    6969  // Code import 
    70   var e = $('#bu_export_content'); 
     70  const e = $('#bu_export_content'); 
    7171 
    72   $('#bu_export').toggleWithLegend($(e),{ 
    73       legend_click: true 
    74   }) 
     72  $('#bu_export').toggleWithLegend($(e), { 
     73    legend_click: true 
     74  }); 
    7575 
    76   var a = document.createElement('a'); 
     76  const a = document.createElement('a'); 
    7777  a.href = '#'; 
    7878  $(a).text(dotclear.msg.apply_code); 
     
    8181 
    8282  $(a).click(function() { 
    83     var code = e.find('#export_code'); 
     83    const code = e.find('#export_code'); 
    8484    if (code.size() == 0) { 
    8585      return false; 
     
    100100  function applyBlowupValues(code) { 
    101101    code = code.replace('\n', ''); 
    102     var re = /(^| )([a-zA-Z0-9_]+):"([^"]*?)"(;|$)/g; 
    103     var reg = /^(.+):"([^"]*)"(;?)\s*$/; 
    104     var s = code.match(re); 
     102    const re = /(^| )([a-zA-Z0-9_]+):"([^"]*?)"(;|$)/g; 
     103    const reg = /^(.+):"([^"]*)"(;?)\s*$/; 
     104    const s = code.match(re); 
    105105 
    106106    if (typeof(s) == 'object' && s.length > 0) { 
    107       var member, target, value; 
    108       for (var i = 0, s_length = s.length; i < s_length; i++) { 
     107      let member; 
     108      let target; 
     109      let value; 
     110      for (let i = 0, s_length = s.length; i < s_length; i++) { 
    109111        member = reg.exec(s[i]); 
    110112        target = member[1].replace(' ', ''); 
     
    126128 
    127129  function getColorLum(color) { 
    128     var rgb = [parseInt('0x' + color.substring(1, 3)) / 255, 
     130    const rgb = [parseInt('0x' + color.substring(1, 3)) / 255, 
    129131      parseInt('0x' + color.substring(3, 5)) / 255, 
    130132      parseInt('0x' + color.substring(5, 7)) / 255 
Note: See TracChangeset for help on using the changeset viewer.

Sites map