Dotclear

Changeset 2526:a96260306d4e


Ignore:
Timestamp:
11/08/13 16:41:47 (12 years ago)
Author:
Nicolas <nikrou77@…>
Branch:
2.6
Message:

Add link around expand image for a11y; comments list. Addresses #1848
Fix toggle status (open or close) when clicking main arrow

Location:
admin/js
Files:
2 edited

Legend:

Unmodified
Added
Removed
  • admin/js/_comments.js

    r1049 r2526  
    11dotclear.commentExpander = function(line) { 
    2      var td = line.firstChild; 
    3       
    4      var img = document.createElement('img'); 
    5      img.src = dotclear.img_plus_src; 
    6      img.alt = dotclear.img_plus_alt; 
    7      img.className = 'expand'; 
    8      $(img).css('cursor','pointer'); 
    9      img.line = line; 
    10      img.onclick = function() { dotclear.viewCommentContent(this,this.line); }; 
    11       
    12      td.insertBefore(img,td.firstChild); 
     2     $('<a href="#"><img src="'+dotclear.img_plus_src+'" alt="'+dotclear.img_plus_alt+'"/></a>') 
     3          .click(function() { 
     4               dotclear.toggleArrow(this); 
     5               dotclear.viewCommentContent(line); 
     6          }) 
     7          .prependTo($(line).children().get(0)); // first td 
    138}; 
    149 
    1510dotclear.commentsExpander = function(line,lines) { 
    16      var td = line.firstChild; 
    17       
    18      var img = document.createElement('img'); 
    19      img.src = dotclear.img_plus_src; 
    20      img.alt = dotclear.img_plus_alt; 
    21      img.className = 'expand'; 
    22      $(img).css('cursor','pointer'); 
    23      img.lines = lines; 
    24      img.onclick = function() { dotclear.viewCommentsContent(this,this.lines); }; 
    25       
    26      td.insertBefore(img,td.firstChild); 
     11     $('<a href="#"><img src="'+dotclear.img_plus_src+'" alt="'+dotclear.img_plus_alt+'"/></a>') 
     12          .click(function() { 
     13               dotclear.toggleArrow(this); 
     14               lines.each(function() { 
     15                    var action = dotclear.toggleArrow(this.firstChild.firstChild); 
     16                    dotclear.viewCommentContent(this,action); 
     17               }); 
     18          }) 
     19          .prependTo($(line).children().get(0)); // first td 
    2720}; 
    2821 
    29 dotclear.viewCommentsContent = function(img,lines) { 
    30      lines.each(function() { 
    31           var td = this.firstChild; 
    32           td.firstChild.click(); 
    33      }); 
     22dotclear.toggleArrow = function(link,action) { 
     23     action = action || ''; 
     24     var img = $(link).children().get(0); 
     25     if (action=='') { 
     26          if (img.alt==dotclear.img_plus_alt) { 
     27               action = 'open'; 
     28          } else { 
     29               action = 'close'; 
     30          } 
     31     } 
    3432 
    35      if (img.alt == dotclear.img_plus_alt) { 
     33     if (action=='open') { 
    3634          img.src = dotclear.img_minus_src; 
    3735          img.alt = dotclear.img_minus_alt; 
     
    4038          img.alt = dotclear.img_plus_alt; 
    4139     } 
    42 }; 
    4340 
    44 dotclear.viewCommentContent = function(img,line) { 
    45      var commentId = line.id.substr(1); 
    46       
     41     return action; 
     42} 
     43 
     44dotclear.viewCommentContent = function(line,action) { 
     45     var commentId = $(line).attr('id').substr(1);      
    4746     var tr = document.getElementById('ce'+commentId); 
    4847      
     
    5453          td.className = 'expand'; 
    5554          tr.appendChild(td); 
    56            
    57           img.src = dotclear.img_minus_src; 
    58           img.alt = dotclear.img_minus_alt; 
    5955           
    6056          // Get comment content 
     
    9187          $(tr).toggle(); 
    9288          $(line).toggleClass('expand'); 
    93           img.src = dotclear.img_minus_src; 
    94           img.alt = dotclear.img_minus_alt; 
    9589     } 
    9690     else 
     
    9892          $(tr).toggle(); 
    9993          $(line).toggleClass('expand'); 
    100           img.src = dotclear.img_plus_src; 
    101           img.alt = dotclear.img_plus_alt; 
    10294     } 
    10395}; 
  • admin/js/_posts_list.js

    r2525 r2526  
    1111     $('<a href="#"><img src="'+dotclear.img_plus_src+'" alt="'+dotclear.img_plus_alt+'"/></a>') 
    1212          .click(function() { 
    13                var action = dotclear.toggleArrow(this); 
     13               dotclear.toggleArrow(this); 
    1414               lines.each(function() { 
    15                     dotclear.toggleArrow(this.firstChild.firstChild,action); 
     15                    var action = dotclear.toggleArrow(this.firstChild.firstChild); 
    1616                    dotclear.viewPostContent(this,action); 
    1717               }); 
Note: See TracChangeset for help on using the changeset viewer.

Sites map