Make WordPress Core

Ticket #31575: 31575.patch

File 31575.patch, 6.7 KB (added by afercia, 11 years ago)
  • src/wp-admin/css/press-this.css

     
    854854
    855855.add-cat-toggle {
    856856        float: right;
    857         margin-top: -33px;
     857        margin-top: -45px;
     858        line-height: 20px;
     859        padding: 12px 10px 8px;
    858860}
    859861
     862.add-cat-toggle.is-toggled {
     863          padding: 10px;
     864}
     865
    860866.add-cat-toggle:focus {
    861867        text-decoration: none;
    862868        color: #2ea2cc;
    863869}
    864870
    865 .add-cat-toggle.is-toggled {
    866         margin-top: -36px;
    867 }
    868 
    869871.add-cat-toggle.is-toggled .dashicons:before {
    870872        content: "\f179";
    871873}
     
    12101212        vertical-align: middle;
    12111213}
    12121214
    1213 .options-open,
    1214 .options-close {
     1215.options-toggle {
    12151216        display: none;
    12161217}
    12171218
    12181219@media (max-width: 900px) {
    1219         .options-open,
    1220         .options-close {
     1220        .options-toggle {
    12211221                display: block;
    12221222        }
    12231223}
    12241224
    1225 .options-open.is-hidden,
    1226 .options-close.is-hidden,
     1225.options-open-label.is-hidden,
     1226.options-close-label.is-hidden,
    12271227.options-panel-back.is-hidden {
    12281228        display: none;
    12291229}
    12301230
    1231 .options-open:focus .dashicons {
     1231.options-toggle:hover .dashicons,
     1232.options-toggle:focus .dashicons {
    12321233        color: #fff;
    12331234        text-decoration: none;
    12341235}
    12351236
    1236 .options-open .dashicons {
     1237.options-toggle .dashicons {
    12371238        margin-top: 3px;
    12381239}
    12391240
    1240 .options-close {
     1241.options-close-label {
    12411242        color: #2ea2cc;
    12421243}
    12431244
  • src/wp-admin/includes/class-wp-press-this.php

     
    959959        $admin_body_class .= ' version-' . str_replace( '.', '-', preg_replace( '/^([.0-9]+).*/', '$1', $wp_version ) );
    960960        $admin_body_class .= ' admin-color-' . sanitize_html_class( get_user_option( 'admin_color' ), 'fresh' );
    961961        $admin_body_class .= ' locale-' . sanitize_html_class( strtolower( str_replace( '_', '-', get_locale() ) ) );
    962        
     962
    963963        /** This filter is documented in wp-admin/admin-header.php */
    964964        $admin_body_classes = apply_filters( 'admin_body_class', '' );
    965965
     
    970970                        <span class="dashicons dashicons-wordpress"></span>
    971971                        <span><?php bloginfo( 'name' ); ?></span>
    972972                </h1>
    973                 <button type="button" class="options-open button-subtle">
    974                         <span class="dashicons dashicons-tag"></span><span class="screen-reader-text"><?php _e( 'Show post options' ); ?></span>
     973                <button type="button" class="options-toggle button-subtle" aria-expanded="false" aria-controls="options-panel">
     974                        <span class="options-open-label"><span class="dashicons dashicons-tag"></span><span class="screen-reader-text"><?php _e( 'Show post options' ); ?></span></span>
     975                        <span class="options-close-label is-hidden"><span aria-hidden="true"><?php _e( 'Done' ); ?></span><span class="screen-reader-text"><?php _e( 'Close post options' ); ?></span></span>
    975976                </button>
    976                 <button type="button" class="options-close button-subtle is-hidden"><?php _e( 'Done' ); ?></button>
    977977        </div>
    978978
    979979        <div id="scanbar" class="scan">
     
    10391039                        </div>
    10401040                </div>
    10411041
    1042                 <div class="options-panel-back is-hidden" tabindex="-1"></div> 
    1043                 <div class="options-panel is-off-screen is-hidden" tabindex="-1">
     1042                <div class="options-panel-back is-hidden" tabindex="-1"></div>
     1043                <div class="options-panel is-off-screen is-hidden" tabindex="-1" id="options-panel">
    10441044                        <div class="post-options">
    10451045
    10461046                                <?php if ( $supports_formats ) : ?>
  • src/wp-admin/js/press-this.js

     
    691691
    692692                /**
    693693                 * Interactive behavior for the sidebar toggle, to show the options modals
     694                 *
     695                 * @param action string Optional toggle|close (defaults to toggle)
    694696                 */
    695                 function openSidebar() {
    696                         sidebarIsOpen = true;
     697                function toggleSidebar( event, action ) {
    697698
    698                         $( '.options-open, .press-this-actions, #scanbar' ).addClass( isHidden );
    699                         $( '.options-close, .options-panel-back' ).removeClass( isHidden );
     699                        if ( ! action ) {
     700                                action = 'toggle';
     701                        }
    700702
    701                         $( '.options-panel' ).removeClass( offscreenHidden )
    702                                 .one( 'transitionend', function() {
    703                                         $( '.post-option:first' ).focus();
    704                                 } );
    705                 }
     703                        if ( ! sidebarIsOpen ) {
     704                                sidebarIsOpen = true;
    706705
    707                 function closeSidebar() {
    708                         sidebarIsOpen = false;
     706                                $( '.options-toggle' ).attr( 'aria-expanded', 'true' );
     707                                $( '.options-open-label, .press-this-actions, #scanbar' ).addClass( isHidden );
     708                                $( '.options-close-label, .options-panel-back' ).removeClass( isHidden );
    709709
    710                         $( '.options-close, .options-panel-back' ).addClass( isHidden );
    711                         $( '.options-open, .press-this-actions, #scanbar' ).removeClass( isHidden );
     710                                $( '.options-panel' ).removeClass( offscreenHidden )
     711                                        .one( 'transitionend', function() {
     712                                                $( '.post-option:first' ).focus();
     713                                        } );
     714                                return;
     715                        }
    712716
    713                         $( '.options-panel' ).addClass( isOffScreen )
    714                                 .one( 'transitionend', function() {
    715                                         $( this ).addClass( isHidden );
    716                                         // Reset to options list
    717                                         $( '.post-options' ).removeClass( offscreenHidden );
    718                                         $( '.setting-modal').addClass( offscreenHidden );
    719                                 } );
     717                        if ( 'close' === action || sidebarIsOpen ) {
     718                                sidebarIsOpen = false;
     719
     720                                $( '.options-toggle' ).attr( 'aria-expanded', 'false' );
     721                                $( '.options-close-label, .options-panel-back' ).addClass( isHidden );
     722                                $( '.options-open-label, .press-this-actions, #scanbar' ).removeClass( isHidden );
     723
     724                                $( '.options-panel' ).addClass( isOffScreen )
     725                                        .one( 'transitionend', function() {
     726                                                $( this ).addClass( isHidden );
     727                                                // Reset to options list
     728                                                $( '.post-options' ).removeClass( offscreenHidden );
     729                                                $( '.setting-modal').addClass( offscreenHidden );
     730                                        } );
     731                                return;
     732                        }
    720733                }
    721734
    722735                /**
     
    788801                        monitorOptionsModal();
    789802                        monitorPlaceholder();
    790803
    791                         $( '.options-open' ).on( 'click.press-this', openSidebar );
    792                         $( '.options-close' ).on( 'click.press-this', closeSidebar );
     804                        $( '.options-toggle' ).on( 'click.press-this', toggleSidebar );
    793805
    794806                        // Close the sidebar when focus moves outside of it.
    795                         $( '.options-panel, .options-panel-back' ).on( 'focusout.press-this', function() {
     807                        $( '.options-panel, .options-panel-back' ).on( 'focusout.press-this', function( event ) {
    796808                                setTimeout( function() {
    797809                                        var node = document.activeElement,
    798810                                                $node = $( node );
     
    800812                                        if ( sidebarIsOpen && node && ! $node.hasClass( 'options-panel-back' ) &&
    801813                                                ( node.nodeName === 'BODY' ||
    802814                                                        ( ! $node.closest( '.options-panel' ).length &&
    803                                                         ! $node.closest( '.options-open' ).length ) ) ) {
     815                                                        ! $node.closest( '.options-toggle' ).length ) ) ) {
    804816
    805                                                 closeSidebar();
     817                                                toggleSidebar( event, 'close' );
    806818                                        }
    807819                                }, 50 );
    808820                        });