Upgrade/Install: Make sure the "Show hidden updates" button is visible and works as expected.

The [https://api.jquery.com/toggle-event/ .toggle( handler, handler )] method signature was deprecated in jQuery 1.8 and removed in jQuery 1.9. 

This commit updates the click handler function to work with jQuery 1.9+.

Follow-up to [9441], [9543], [42785], [48323].

Props malinevskiy, Boniu91, SergeyBiryukov.
Merges [52644] to the 5.9 branch.
Fixes #54886.
Built from https://develop.svn.wordpress.org/branches/5.9@52713


git-svn-id: http://core.svn.wordpress.org/branches/5.9@52302 1a063a9b-81f0-0310-95a4-ce76da25c4cd
This commit is contained in:
Sergey Biryukov 2022-02-11 22:11:02 +00:00
parent 493585345f
commit cf52bed1f4
2 changed files with 17 additions and 9 deletions

View File

@ -206,18 +206,26 @@ function dismissed_updates() {
'available' => false,
)
);
if ( $dismissed ) {
if ( $dismissed ) {
$show_text = esc_js( __( 'Show hidden updates' ) );
$hide_text = esc_js( __( 'Hide hidden updates' ) );
?>
<script type="text/javascript">
jQuery(function( $ ) {
$( 'dismissed-updates' ).show();
$( '#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' ); } );
$( '#show-dismissed' ).click( function() { $( '#dismissed-updates' ).toggle( 'fast' ); } );
});
</script>
<script type="text/javascript">
jQuery( function( $ ) {
$( '#show-dismissed' ).on( 'click', function() {
var isExpanded = ( 'true' === $( this ).attr( 'aria-expanded' ) );
if ( isExpanded ) {
$( this ).text( '<?php echo $show_text; ?>' ).attr( 'aria-expanded', 'false' );
} else {
$( this ).text( '<?php echo $hide_text; ?>' ).attr( 'aria-expanded', 'true' );
}
$( '#dismissed-updates' ).toggle( 'fast' );
});
});
</script>
<?php
echo '<p class="hide-if-no-js"><button type="button" class="button" id="show-dismissed" aria-expanded="false">' . __( 'Show hidden updates' ) . '</button></p>';
echo '<ul id="dismissed-updates" class="core-updates dismissed">';

View File

@ -16,7 +16,7 @@
*
* @global string $wp_version
*/
$wp_version = '5.9.1-alpha-52712';
$wp_version = '5.9.1-alpha-52713';
/**
* Holds the WordPress DB revision, increments when changes are made to the WordPress DB schema.