Dotclear

Changeset 3843:f6a2d62807c6


Ignore:
Timestamp:
09/01/18 09:28:56 (7 years ago)
Author:
franck <carnet.franck.paul@…>
Branch:
2.14
source:
d2616cbea4808bdd0cbc686d6548ea61810e05dd
Message:

button(type="button") is better than input(type="submit") for show/hide, show/close js button as the input may catch the enter key in form and the button not

Location:
admin
Files:
5 edited

Legend:

Unmodified
Added
Removed
  • admin/js/common.js

    r3805 r3843  
    9595  var toggle = function(i, speed) { 
    9696    speed = speed || 0; 
     97    var b = $(i).get(0); 
    9798    if (p.hide) { 
    98       $(i).get(0).value = p.img_on_txt; 
    99       $(i).get(0).setAttribute('aria-label', p.img_on_alt); 
     99      b.firstChild.data = p.img_on_txt; 
     100      b.setAttribute('value', p.img_on_txt); 
     101      b.setAttribute('aria-label', p.img_on_alt); 
    100102      target.addClass('hide'); 
    101103    } else { 
    102       $(i).get(0).value = p.img_off_txt; 
    103       $(i).get(0).setAttribute('aria-label', p.img_off_alt); 
     104      b.firstChild.data = p.img_off_txt; 
     105      b.setAttribute('value', p.img_off_txt); 
     106      b.setAttribute('aria-label', p.img_off_alt); 
    104107      target.removeClass('hide'); 
    105108      if (p.fn) { 
     
    122125  }; 
    123126  return this.each(function() { 
    124     var b = document.createElement('input'); 
    125     b.setAttribute('type', 'submit'); 
     127    var b = document.createElement('button'); 
     128    b.setAttribute('type', 'button'); 
    126129    b.className = 'details-cmd'; 
    127130    b.value = p.img_on_txt; 
    128     b.setAttribute('aria-label', p.img_off_alt); 
     131    b.setAttribute('aria-label', p.img_on_alt); 
     132    var t = document.createTextNode(p.img_on_txt); 
     133    b.appendChild(t); 
    129134 
    130135    var ctarget = p.legend_click ? this : b; 
     
    177182  }; 
    178183  var singleExpander = function singleExpander(line) { 
    179     $('<input class="details-cmd" type="submit" value="' + dotclear.img_plus_txt + '" aria-label="' + dotclear.img_plus_alt + '"/>').click(function(e) { 
     184    $('<button type="button" class="details-cmd" aria-label="' + dotclear.img_plus_alt + '">' + dotclear.img_plus_txt + '</button>').click(function (e) { 
    180185      toggleArrow(this); 
    181186      $.expandContent.options.callback.call(this, line); 
     
    184189  }; 
    185190  var multipleExpander = function multipleExpander(line, lines) { 
    186     $('<input class="details-cmd" type="submit" value="' + dotclear.img_plus_txt + '" aria-label="' + dotclear.img_plus_alt + '"/>').click(function(e) { 
     191    $('<button type="button" class="details-cmd" aria-label="' + dotclear.img_plus_alt + '">' + dotclear.img_plus_txt + '</button>').click(function (e) { 
    187192      var that = this; 
    188193      var action = toggleArrow(this); 
     
    204209    } 
    205210    if (action == 'open') { 
    206       button.value = dotclear.img_minus_txt; 
     211      button.firstChild.data = dotclear.img_minus_txt; 
     212      button.setAttribute('value', dotclear.img_minus_txt); 
    207213      button.setAttribute('aria-label', dotclear.img_minus_alt); 
    208214    } else { 
    209       button.value = dotclear.img_plus_txt; 
     215      button.firstChild.data = dotclear.img_plus_txt; 
     216      button.setAttribute('value', dotclear.img_plus_txt); 
    210217      button.setAttribute('aria-label', dotclear.img_plus_alt); 
    211218    } 
     
    244251  }; 
    245252  var textToggler = function(o) { 
    246     var b = $('<input class="details-cmd" type="submit" value="' + p.img_on_txt + '" aria-label="' + p.img_on_alt + '"/>'); 
     253    var b = $('<button type="button" class="details-cmd" aria-label="' + p.img_on_alt + '">' + p.img_on_txt + '</button>'); 
    247254    o.css('cursor', 'pointer'); 
    248255    var hide = true; 
     
    258265      }); 
    259266      hide = !hide; 
    260       var img = $(this).find('input.details-cmd'); 
     267      var img = $(this).find('button.details-cmd'); 
    261268      if (!hide) { 
     269        img.html(p.img_off_txt); 
    262270        img.attr('value', p.img_off_txt); 
    263271        img.attr('aria-label', p.img_off_alt); 
    264272      } else { 
     273        img.html(p.img_on_txt); 
    265274        img.attr('value', p.img_on_txt); 
    266275        img.attr('aria-label', p.img_on_alt); 
     
    278287  var select = $(); 
    279288  img.click(function(e) { 
     289    e.preventDefault(); 
    280290    return toggle(); 
    281     e.preventDefault(); 
    282291  }); 
    283292  $('#content').append(img); 
  • admin/style/default-dark.css

    r3787 r3843  
    13351335  padding: 0; } 
    13361336 
    1337 input.details-cmd { 
     1337button.details-cmd { 
    13381338  font-size: 0.9em; 
    13391339  border: none; 
     
    13431343  color: currentColor; 
    13441344  background: transparent; } 
    1345   input.details-cmd:hover, input.details-cmd:focus { 
     1345  button.details-cmd:hover, button.details-cmd:focus { 
    13461346    background: transparent; 
    13471347    color: #bee74b; } 
     
    21012101    padding-bottom: 6px; 
    21022102    font-size: 1em; } 
    2103   #login-screen input.details-cmd { 
    2104     width: auto; 
    2105     margin: 0 5px 0 0; 
    2106     padding: 0; } 
    21072103  #login-screen #issue { 
    21082104    margin-left: 1.33em; 
  • admin/style/default.css

    r3787 r3843  
    13351335  padding: 0; } 
    13361336 
    1337 input.details-cmd { 
     1337button.details-cmd { 
    13381338  font-size: 0.9em; 
    13391339  border: none; 
     
    13431343  color: currentColor; 
    13441344  background: transparent; } 
    1345   input.details-cmd:hover, input.details-cmd:focus { 
     1345  button.details-cmd:hover, button.details-cmd:focus { 
    13461346    background: transparent; 
    13471347    color: #bee74b; } 
     
    21012101    padding-bottom: 6px; 
    21022102    font-size: 1em; } 
    2103   #login-screen input.details-cmd { 
    2104     width: auto; 
    2105     margin: 0 5px 0 0; 
    2106     padding: 0; } 
    21072103  #login-screen #issue { 
    21082104    margin-left: 1.33em; 
  • admin/style/scss/partials/_auth.scss

    r3770 r3842  
    5151          font-size: 1em; 
    5252     } 
    53   input.details-cmd { 
    54     width: auto; 
    55     margin: 0 5px 0 0; 
    56     padding: 0; 
    57   } 
    5853     #issue { 
    5954          margin-left: 1.33em; 
  • admin/style/scss/partials/_buttons.scss

    r3768 r3842  
    208208} 
    209209 
    210 input.details-cmd { 
     210button.details-cmd { 
    211211  font-size: 0.9em; 
    212212  border: none; 
Note: See TracChangeset for help on using the changeset viewer.

Sites map