WordPress.org

Make WordPress Core

Ticket #31233: 31233.diff

File 31233.diff, 1.6 KB (added by helen, 6 years ago)
  • src/wp-admin/js/common.js

     
    373373        $firstHeading.nextAll( 'div.updated, div.error, div.notice' ).addClass( 'below-h2' );
    374374        $( 'div.updated, div.error, div.notice' ).not( '.below-h2, .inline' ).insertAfter( $firstHeading );
    375375
     376        // Make notices dismissable
     377        $( 'div.updated, div.error, div.notice' ).each(function(){
     378                var $this = $(this),
     379                        text = commonL10n.dismiss || '',
     380                        $dismiss = $('<a href="#" class="dismiss"></a>');
     381
     382                // Ensure plain text
     383                $dismiss.text( text );
     384
     385                $this.append( $dismiss ).on('click', function(e){
     386                        e.preventDefault();
     387                        $this.remove();
     388                });
     389        });
     390
    376391        // Init screen meta
    377392        screenMeta.init();
    378393
  • src/wp-includes/script-loader.php

     
    7979
    8080        $scripts->add( 'common', "/wp-admin/js/common$suffix.js", array('jquery', 'hoverIntent', 'utils'), false, 1 );
    8181        did_action( 'init' ) && $scripts->localize( 'common', 'commonL10n', array(
    82                 'warnDelete' => __("You are about to permanently delete the selected items.\n  'Cancel' to stop, 'OK' to delete.")
     82                'warnDelete' => __("You are about to permanently delete the selected items.\n  'Cancel' to stop, 'OK' to delete."),
     83                'dismiss' => __( 'Dismiss' ),
    8384        ) );
    8485
    8586        $scripts->add( 'sack', "/wp-includes/js/tw-sack$suffix.js", array(), '1.6.1', 1 );