Make WordPress Core

Ticket #35577: 35577.5.diff

File 35577.5.diff, 4.0 KB (added by afercia, 8 years ago)
  • src/wp-admin/css/nav-menus.css

     
    693693}
    694694
    695695.add-menu-item-pagelinks {
    696         margin: .5em auto;
     696        margin: .5em -10px;
    697697        text-align: center;
    698698}
    699699
     700.add-menu-item-pagelinks .page-numbers {
     701        display: inline-block;
     702        min-width: 20px;
     703}
     704
     705.add-menu-item-pagelinks .page-numbers.dots {
     706        min-width: 0;
     707}
     708
    700709.link-to-original {
    701710        display: block;
    702711        margin: 0 0 15px;
  • src/wp-admin/includes/nav-menu.php

     
    358358                        )
    359359                ),
    360360                'format' => '',
    361                 'prev_text' => __('«'),
    362                 'next_text' => __('»'),
    363                 'total' => $num_pages,
     361                'prev_text'          => '<span aria-label="' . esc_attr__( 'Previous page' ) . '">' . __( '&laquo;' ) . '</span>',
     362                'next_text'          => '<span aria-label="' . esc_attr__( 'Next page' ) . '">' . __( '&raquo;' ) . '</span>',
     363                'before_page_number' => '<span class="screen-reader-text">' . __( 'Page' ) . '</span> ',
     364                'total'   => $num_pages,
    364365                'current' => $pagenum
    365366        ));
    366367
     
    642643                        )
    643644                ),
    644645                'format' => '',
    645                 'prev_text' => __('&laquo;'),
    646                 'next_text' => __('&raquo;'),
    647                 'total' => $num_pages,
     646                'prev_text'          => '<span aria-label="' . esc_attr__( 'Previous page' ) . '">' . __( '&laquo;' ) . '</span>',
     647                'next_text'          => '<span aria-label="' . esc_attr__( 'Next page' ) . '">' . __( '&raquo;' ) . '</span>',
     648                'before_page_number' => '<span class="screen-reader-text">' . __( 'Page' ) . '</span> ',
     649                'total'   => $num_pages,
    648650                'current' => $pagenum
    649651        ));
    650652
  • src/wp-admin/js/nav-menu.js

     
    10891089                                        else if ( e.target.id && -1 != e.target.id.indexOf('submit-') )
    10901090                                                $('#' + e.target.id.replace(/submit-/, '')).addSelectedToMenu( api.addMenuItemToBottom );
    10911091                                        return false;
    1092                                 } else if ( target.hasClass('page-numbers') ) {
    1093                                         $.post( ajaxurl, e.target.href.replace(/.*\?/, '').replace(/action=([^&]*)/, '') + '&action=menu-get-metabox',
    1094                                                 function( resp ) {
    1095                                                         if ( -1 == resp.indexOf('replace-id') )
    1096                                                                 return;
     1092                                }
     1093                        });
    10971094
    1098                                                         var metaBoxData = $.parseJSON(resp),
    1099                                                         toReplace = document.getElementById(metaBoxData['replace-id']),
    1100                                                         placeholder = document.createElement('div'),
    1101                                                         wrap = document.createElement('div');
     1095                        /*
     1096                         * Delegate the `click` event and attach it just to the pagination
     1097                         * links thus excluding the current page `<span>`. See ticket #35577.
     1098                         */
     1099                        $( '#nav-menu-meta' ).on( 'click', 'a.page-numbers', function() {
     1100                                var $container = $( this ).closest( '.inside' );
    11021101
    1103                                                         if ( ! metaBoxData.markup || ! toReplace )
    1104                                                                 return;
     1102                                $.post( ajaxurl, this.href.replace( /.*\?/, '' ).replace( /action=([^&]*)/, '' ) + '&action=menu-get-metabox',
     1103                                        function( resp ) {
     1104                                                var metaBoxData = $.parseJSON( resp ),
     1105                                                        toReplace;
    11051106
    1106                                                         wrap.innerHTML = metaBoxData.markup ? metaBoxData.markup : '';
     1107                                                if ( -1 === resp.indexOf( 'replace-id' ) ) {
     1108                                                        return;
     1109                                                }
    11071110
    1108                                                         toReplace.parentNode.insertBefore( placeholder, toReplace );
    1109                                                         placeholder.parentNode.removeChild( toReplace );
     1111                                                // Get the post type menu meta box to update.
     1112                                                toReplace = document.getElementById( metaBoxData['replace-id'] );
    11101113
    1111                                                         placeholder.parentNode.insertBefore( wrap, placeholder );
     1114                                                if ( ! metaBoxData.markup || ! toReplace ) {
     1115                                                        return;
     1116                                                }
    11121117
    1113                                                         placeholder.parentNode.removeChild( placeholder );
     1118                                                // Update the post type menu meta box with new content from the response.
     1119                                                $container.html( metaBoxData.markup );
     1120                                        }
     1121                                );
    11141122
    1115                                                 }
    1116                                         );
    1117 
    1118                                         return false;
    1119                                 }
     1123                                return false;
    11201124                        });
    11211125                },
    11221126