Make WordPress Core

Ticket #54886: 54886.diff

File 54886.diff, 1.5 KB (added by SergeyBiryukov, 4 years ago)
  • src/wp-admin/update-core.php

     
    206206                        'available' => false,
    207207                )
    208208        );
     209
    209210        if ( $dismissed ) {
    210 
    211211                $show_text = esc_js( __( 'Show hidden updates' ) );
    212212                $hide_text = esc_js( __( 'Hide hidden updates' ) );
    213213                ?>
    214         <script type="text/javascript">
    215                 jQuery(function( $ ) {
    216                         $( 'dismissed-updates' ).show();
    217                         $( '#show-dismissed' ).toggle( function() { $( this ).text( '<?php echo $hide_text; ?>' ).attr( 'aria-expanded', 'true' ); }, function() { $( this ).text( '<?php echo $show_text; ?>' ).attr( 'aria-expanded', 'false' ); } );
    218                         $( '#show-dismissed' ).click( function() { $( '#dismissed-updates' ).toggle( 'fast' ); } );
    219                 });
    220         </script>
     214                <script type="text/javascript">
     215                        jQuery( function( $ ) {
     216                                $( '#show-dismissed' ).on( 'click', function() {
     217                                        var isExpanded = ( 'true' === $( this ).attr( 'aria-expanded' ) );
     218
     219                                        if ( isExpanded ) {
     220                                                $( this ).text( '<?php echo $show_text; ?>' ).attr( 'aria-expanded', 'false' );
     221                                        } else {
     222                                                $( this ).text( '<?php echo $hide_text; ?>' ).attr( 'aria-expanded', 'true' );
     223                                        }
     224
     225                                        $( '#dismissed-updates' ).toggle( 'fast' );
     226                                });
     227                        });
     228                </script>
    221229                <?php
    222230                echo '<p class="hide-if-no-js"><button type="button" class="button" id="show-dismissed" aria-expanded="false">' . __( 'Show hidden updates' ) . '</button></p>';
    223231                echo '<ul id="dismissed-updates" class="core-updates dismissed">';