Dotclear


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

Fix a11y when expanding content in lists views (entries, comments, pages)
Closes #1848
Need refactoring and tests !

File:
1 edited

Legend:

Unmodified
Added
Removed
  • admin/js/_post.js

    r2109 r2527  
    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(e) { 
     4               dotclear.toggleArrow(this); 
     5               dotclear.viewCommentContent(line); 
     6               e.preventDefault(); 
     7          }) 
     8          .prependTo($(line).children().get(0)); // first td 
    139}; 
    1410 
    15 dotclear.viewCommentContent = function(img,line) { 
    16      var commentId = line.id.substr(1); 
    17  
     11dotclear.toggleArrow = function(link,action) { 
     12     action = action || ''; 
     13     var img = $(link).children().get(0); 
     14     if (action=='') { 
     15          if (img.alt==dotclear.img_plus_alt) { 
     16               action = 'open'; 
     17          } else { 
     18               action = 'close'; 
     19          } 
     20     } 
     21 
     22     if (action=='open') { 
     23          img.src = dotclear.img_minus_src; 
     24          img.alt = dotclear.img_minus_alt; 
     25     } else { 
     26          img.src = dotclear.img_plus_src; 
     27          img.alt = dotclear.img_plus_alt; 
     28     } 
     29 
     30     return action; 
     31} 
     32 
     33dotclear.viewCommentContent = function(line,action) { 
     34     var commentId = $(line).attr('id').substr(1); 
    1835     var tr = document.getElementById('ce'+commentId); 
    1936 
     
    2542          td.className = 'expand'; 
    2643          tr.appendChild(td); 
    27  
    28           img.src = dotclear.img_minus_src; 
    29           img.alt = dotclear.img_minus_alt; 
    3044 
    3145          // Get comment content 
     
    6074          $(tr).toggle(); 
    6175          $(line).toggleClass('expand'); 
    62           img.src = dotclear.img_minus_src; 
    63           img.alt = dotclear.img_minus_alt; 
    6476     } 
    6577     else 
     
    6779          $(tr).toggle(); 
    6880          $(line).toggleClass('expand'); 
    69           img.src = dotclear.img_plus_src; 
    70           img.alt = dotclear.img_plus_alt; 
    7181     } 
    7282}; 
Note: See TracChangeset for help on using the changeset viewer.

Sites map