Make WordPress Core

Ticket #40453: 40453.diff

File 40453.diff, 2.7 KB (added by afercia, 7 years ago)
  • src/wp-admin/includes/class-bulk-upgrader-skin.php

     
    4343                /* translators: 1: Title of an update */
    4444                $this->upgrader->strings['skin_update_failed'] = __('The update of %1$s failed.');
    4545                /* translators: 1: Title of an update */
    46                 $this->upgrader->strings['skin_update_successful'] = __( '%1$s updated successfully.' ) . ' <a onclick="%2$s" href="#" class="hide-if-no-js"><span>' . __( 'Show Details' ) . '</span><span class="hidden">' . __( 'Hide Details' ) . '</span></a>';
     46                $this->upgrader->strings['skin_update_successful'] = __( '%1$s updated successfully.' );
    4747                $this->upgrader->strings['skin_upgrade_end'] = __('All updates have been completed.');
    4848        }
    4949
     
    148148                        echo '<script type="text/javascript">jQuery(\'#progress-' . esc_js($this->upgrader->update_current) . '\').show();</script>';
    149149                }
    150150                if ( $this->result && ! is_wp_error( $this->result ) ) {
    151                         if ( ! $this->error )
    152                                 echo '<div class="updated"><p>' . sprintf($this->upgrader->strings['skin_update_successful'], $title, 'jQuery(\'#progress-' . esc_js($this->upgrader->update_current) . '\').toggle();jQuery(\'span\', this).toggle(); return false;') . '</p></div>';
     151                        if ( ! $this->error ) {
     152                                echo '<div class="updated" data-update-details="progress-' . esc_attr( $this->upgrader->update_current ) . '">' .
     153                                        '<p>' . sprintf( $this->upgrader->strings['skin_update_successful'], $title ) .
     154                                        ' <button type="button" class="hide-if-no-js button-link update-details-toggle" aria-expanded="false">' .
     155                                        '<span>' . __( 'Show details.' ) . '</span>' .
     156                                        '</button></p></div>';
     157                        }
     158
    153159                        echo '<script type="text/javascript">jQuery(\'.waiting-' . esc_js($this->upgrader->update_current) . '\').hide();</script>';
    154160                }
    155161
  • src/wp-admin/js/common.js

     
    978978
    979979        // Set initial focus on a specific element.
    980980        $( '.wp-initial-focus' ).focus();
     981
     982        // Toggle update details on update-core.php.
     983        $body.on( 'click', '.update-details-toggle', function() {
     984                var $updateNotice = $( this ).closest( '.updated' ),
     985                        $progressDiv = $( '#' + $updateNotice.data( 'update-details' ) );
     986
     987                if ( ! $progressDiv.hasClass( 'update-details-moved' ) ) {
     988                        $progressDiv.insertAfter( $updateNotice ).addClass( 'update-details-moved' );
     989                }
     990
     991                $progressDiv.toggle();
     992                $( this ).attr( 'aria-expanded', $progressDiv.is( ':visible' ) )
     993        })
    981994});
    982995
    983996// Fire a custom jQuery event at the end of window resize