Make WordPress Core

Ticket #33063: 33063.3.patch

File 33063.3.patch, 3.5 KB (added by iseulde, 10 years ago)
  • src/wp-admin/js/comment.js

     
    33
    44        postboxes.add_postbox_toggles('comment');
    55
    6         var stamp = $('#timestamp').html();
    7         $('.edit-timestamp').click(function () {
    8                 if ($('#timestampdiv').is(':hidden')) {
    9                         $('#timestampdiv').slideDown('normal');
    10                         $('.edit-timestamp').hide();
     6        var $timestampdiv = $('#timestampdiv'),
     7                stamp = $('#timestamp').html();
     8
     9        $timestampdiv.siblings('a.edit-timestamp').click( function( event ) {
     10                if ( $timestampdiv.is( ':hidden' ) ) {
     11                        $timestampdiv.slideDown('fast');
     12                        $('#mm').focus();
     13                        $(this).hide();
    1114                }
    12                 return false;
     15                event.preventDefault();
    1316        });
    1417
    15         $('.cancel-timestamp').click(function() {
    16                 $('#timestampdiv').slideUp('normal');
     18        $timestampdiv.find('.cancel-timestamp').click( function( event ) {
     19                $timestampdiv.slideUp('fast').siblings('a.edit-timestamp').show().focus();
    1720                $('#mm').val($('#hidden_mm').val());
    1821                $('#jj').val($('#hidden_jj').val());
    1922                $('#aa').val($('#hidden_aa').val());
    2023                $('#hh').val($('#hidden_hh').val());
    2124                $('#mn').val($('#hidden_mn').val());
    2225                $('#timestamp').html(stamp);
    23                 $('.edit-timestamp').show();
    24                 return false;
     26                event.preventDefault();
    2527        });
    2628
    27         $('.save-timestamp').click(function () { // crazyhorse - multiple ok cancels
     29        $timestampdiv.find('.save-timestamp').click( function( event ) { // crazyhorse - multiple ok cancels
    2830                var aa = $('#aa').val(), mm = $('#mm').val(), jj = $('#jj').val(), hh = $('#hh').val(), mn = $('#mn').val(),
    2931                        newD = new Date( aa, mm - 1, jj, hh, mn );
    3032
     33                event.preventDefault();
     34
    3135                if ( newD.getFullYear() != aa || (1 + newD.getMonth()) != mm || newD.getDate() != jj || newD.getMinutes() != mn ) {
    32                         $('.timestamp-wrap', '#timestampdiv').addClass('form-invalid');
    33                         return false;
     36                        $timestampdiv.find('.timestamp-wrap').addClass('form-invalid');
     37                        return;
    3438                } else {
    35                         $('.timestamp-wrap', '#timestampdiv').removeClass('form-invalid');
     39                        $timestampdiv.find('.timestamp-wrap').removeClass('form-invalid');
    3640                }
    3741
    38                 $('#timestampdiv').slideUp('normal');
    39                 $('.edit-timestamp').show();
    4042                $('#timestamp').html(
    4143                        commentL10n.submittedOn + ' <b>' +
    42                         $( '#mm option[value="' + mm + '"]' ).text() + ' ' +
    43                         jj + ', ' +
    44                         aa + ' @ ' +
    45                         hh + ':' +
    46                         mn + '</b> '
     44                        commentL10n.dateFormat
     45                                .replace( '%1$s', $( 'option[value="' + mm + '"]', '#mm' ).attr( 'data-text' ) )
     46                                .replace( '%2$s', parseInt( jj, 10 ) )
     47                                .replace( '%3$s', aa )
     48                                .replace( '%4$s', ( '00' + hh ).slice( -2 ) )
     49                                .replace( '%5$s', ( '00' + mn ).slice( -2 ) ) +
     50                                '</b> '
    4751                );
    48                 return false;
     52
     53                $timestampdiv.slideUp('fast');
     54                $timestampdiv.siblings('a.edit-timestamp').show();
    4955        });
    5056});
  • src/wp-includes/script-loader.php

     
    523523                $scripts->add( 'comment', "/wp-admin/js/comment$suffix.js", array( 'jquery', 'postbox' ) );
    524524                $scripts->add_data( 'comment', 'group', 1 );
    525525                did_action( 'init' ) && $scripts->localize( 'comment', 'commentL10n', array(
    526                         'submittedOn' => __('Submitted on:')
     526                        'submittedOn' => __( 'Submitted on:' ),
     527                        /* translators: 1: month, 2: day, 3: year, 4: hour, 5: minute */
     528                        'dateFormat' => __( '%1$s %2$s, %3$s @ %4$s:%5$s' )
    527529                ) );
    528530
    529531                $scripts->add( 'admin-gallery', "/wp-admin/js/gallery$suffix.js", array( 'jquery-ui-sortable' ) );