Ticket #33062: 33062.2.patch
File 33062.2.patch, 2.3 KB (added by , 6 years ago) |
---|
-
src/wp-admin/js/comment.js
4 4 postboxes.add_postbox_toggles('comment'); 5 5 6 6 var $timestampdiv = $('#timestampdiv'), 7 stamp = $('#timestamp').html(); 7 $timestamp = $( '#timestamp' ), 8 stamp = $timestamp.html(), 9 $timestampwrap = $timestampdiv.find( '.timestamp-wrap' ), 10 $edittimestamp = $timestampdiv.siblings( 'a.edit-timestamp' ); 8 11 9 $ timestampdiv.siblings('a.edit-timestamp').click( function( event ) {12 $edittimestamp.click( function( event ) { 10 13 if ( $timestampdiv.is( ':hidden' ) ) { 11 14 $timestampdiv.slideDown( 'fast', function() { 12 $( 'input, select', $timestamp div.find( '.timestamp-wrap' )).first().focus();15 $( 'input, select', $timestampwrap ).first().focus(); 13 16 } ); 14 17 $(this).hide(); 15 18 } … … 17 20 }); 18 21 19 22 $timestampdiv.find('.cancel-timestamp').click( function( event ) { 20 $timestampdiv.slideUp('fast').siblings('a.edit-timestamp').show().focus(); 23 // Move focus back to the Edit link. 24 $edittimestamp.show().focus(); 25 $timestampdiv.slideUp( 'fast' ); 21 26 $('#mm').val($('#hidden_mm').val()); 22 27 $('#jj').val($('#hidden_jj').val()); 23 28 $('#aa').val($('#hidden_aa').val()); 24 29 $('#hh').val($('#hidden_hh').val()); 25 30 $('#mn').val($('#hidden_mn').val()); 26 $ ('#timestamp').html(stamp);31 $timestamp.html( stamp ); 27 32 event.preventDefault(); 28 33 }); 29 34 … … 34 39 event.preventDefault(); 35 40 36 41 if ( newD.getFullYear() != aa || (1 + newD.getMonth()) != mm || newD.getDate() != jj || newD.getMinutes() != mn ) { 37 $timestamp div.find('.timestamp-wrap').addClass('form-invalid');42 $timestampwrap.addClass( 'form-invalid' ); 38 43 return; 39 44 } else { 40 $timestamp div.find('.timestamp-wrap').removeClass('form-invalid');45 $timestampwrap.removeClass( 'form-invalid' ); 41 46 } 42 47 43 $ ('#timestamp').html(48 $timestamp.html( 44 49 commentL10n.submittedOn + ' <b>' + 45 50 commentL10n.dateFormat 46 51 .replace( '%1$s', $( 'option[value="' + mm + '"]', '#mm' ).attr( 'data-text' ) ) … … 51 56 '</b> ' 52 57 ); 53 58 54 $timestampdiv.slideUp('fast'); 55 $timestampdiv.siblings('a.edit-timestamp').show(); 59 // Move focus back to the Edit link. 60 $edittimestamp.show().focus(); 61 $timestampdiv.slideUp( 'fast' ); 56 62 }); 57 63 });