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/_post.js

    r3878 r3880  
    88  } 
    99 
    10   var commentId = $(line).attr('id').substr(1); 
    11   var tr = document.getElementById('ce' + commentId); 
    12   var spam = (e.metaKey || $(line).hasClass('sts-junk')); 
     10  const commentId = $(line).attr('id').substr(1); 
     11  const lineId = `ce${commentId}`; 
     12  let tr = document.getElementById(lineId); 
     13 
     14  // If meta key down or it's a spam then display content HTML code 
     15  const clean = (e.metaKey || $(line).hasClass('sts-junk')); 
    1316 
    1417  if (!tr) { 
     
    1821        // Content found 
    1922        tr = document.createElement('tr'); 
    20         tr.id = 'ce' + commentId; 
    21         var td = document.createElement('td'); 
     23        tr.id = lineId; 
     24        const td = document.createElement('td'); 
    2225        td.colSpan = $(line).children('td').length; 
    2326        td.className = 'expand'; 
     
    3235    }, { 
    3336      ip: false, 
    34       clean: spam 
     37      clean: clean 
    3538    }); 
    3639  } else { 
     
    4245$(function() { 
    4346  // Post preview 
    44   var $preview_url = $('#post-preview').attr('href'); 
     47  let $preview_url = $('#post-preview').attr('href'); 
    4548  if ($preview_url) { 
    4649 
    4750    // Make $preview_url absolute 
    48     var $a = document.createElement('a'); 
     51    let $a = document.createElement('a'); 
    4952    $a.href = $('#post-preview').attr('href'); 
    5053    $preview_url = $a.href; 
     
    7881 
    7982    // Add date picker 
    80     var post_dtPick = new datePicker($('#post_dt').get(0)); 
     83    const post_dtPick = new datePicker($('#post_dt').get(0)); 
    8184    post_dtPick.img_top = '1.5em'; 
    8285    post_dtPick.draw(); 
     
    140143    $('a.attachment-remove').click(function() { 
    141144      this.href = ''; 
    142       var m_name = $(this).parents('ul').find('li:first>a').attr('title'); 
     145      const m_name = $(this).parents('ul').find('li:first>a').attr('title'); 
    143146      if (window.confirm(dotclear.msg.confirm_remove_attachment.replace('%s', m_name))) { 
    144147        var f = $('#attachment-remove-hide').get(0); 
Note: See TracChangeset for help on using the changeset viewer.

Sites map