Dotclear


Ignore:
Timestamp:
07/06/18 16:37:54 (7 years ago)
Author:
franck <carnet.franck.paul@…>
Branch:
default
Message:

Switch from img to input for expanding/hiding various contents (posts, module details, …)

File:
1 edited

Legend:

Unmodified
Added
Removed
  • plugins/widgets/js/widgets.js

    r3709 r3768  
    1313  title.empty().append(order).append(link).append(tools).append(br); 
    1414 
    15   var img = document.createElement('img'); 
    16   img.src = dotclear.img_plus_src; 
    17   img.alt = dotclear.img_plus_alt; 
    18   img.className = 'expand'; 
    19   $(img).css('cursor', 'pointer'); 
    20   img.onclick = function() { 
     15  var b = document.createElement('input'); 
     16  b.setAttribute('type', 'submit'); 
     17  b.className = 'details-cmd'; 
     18  b.value = dotclear.img_plus_txt; 
     19  b.setAttribute('aria-label', dotclear.img_plus_alt); 
     20  b.onclick = function(e) { 
     21    e.preventDefault(); 
    2122    dotclear.viewPostContent($(this).parents('li')); 
    2223  }; 
     
    2526    dotclear.viewPostContent($(this).parents('li')); 
    2627  }); 
    27   title.prepend(img); 
     28  title.prepend(b); 
    2829}; 
    2930 
    3031dotclear.viewPostContent = function(line, action) { 
    3132  action = action || 'toogle'; 
    32   var img = line.find('.expand'); 
    33   var isopen = img.attr('alt') == dotclear.img_plus_alt; 
     33  var img = line.find('.details-cmd'); 
     34  var isopen = img.attr('aria-label') == dotclear.img_plus_alt; 
    3435 
    3536  if (action == 'close' || (action == 'toogle' && !isopen)) { 
    3637    line.find('.widgetSettings').hide(); 
    37     img.attr('src', dotclear.img_plus_src); 
    38     img.attr('alt', dotclear.img_plus_alt); 
     38    img.attr('value', dotclear.img_plus_txt); 
     39    img.attr('aria-label', dotclear.img_plus_alt); 
    3940  } else if (action == 'open' || (action == 'toogle' && isopen)) { 
    4041    line.find('.widgetSettings').show(); 
    41     img.attr('src', dotclear.img_minus_src); 
    42     img.attr('alt', dotclear.img_minus_alt); 
     42    img.attr('value', dotclear.img_minus_txt); 
     43    img.attr('aria-label', dotclear.img_minus_alt); 
    4344  } 
    4445 
Note: See TracChangeset for help on using the changeset viewer.

Sites map