Ticket #21583: 21583.18.b.diff
File 21583.18.b.diff, 12.5 KB (added by , 12 years ago) |
---|
-
wp-includes/admin-bar.php
657 657 ) ); 658 658 } 659 659 660 function wp_admin_bar_screen_options( $wp_admin_bar ) { 661 662 if ( ! get_current_screen()->show_screen_options() ) 663 return; 664 665 $wp_admin_bar->add_menu( array( 666 'parent' => 'top-secondary', 667 'id' => 'screen-options', 668 'title' => '<span class="ab-icon"></span>', 669 'href' => '#screen-options-wrap', 670 'meta' => array( 671 'class' => 'screen-meta-toggle' 672 ) 673 ) ); 674 } 675 676 function wp_admin_bar_contextual_help( $wp_admin_bar ) { 677 $wp_admin_bar->add_menu( array( 678 'parent' => 'top-secondary', 679 'id' => 'screen-help', 680 'title' => 'Help<span class="ab-icon"></span>', 681 'href' => '#contextual-help-wrap', 682 'meta' => array( 683 'class' => 'screen-meta-toggle' 684 ) 685 ) ); 686 } 687 660 688 /** 661 689 * Add secondary menus. 662 690 * -
wp-includes/js/admin-bar.js
10 10 node.attr('tabindex', '0').attr('tabindex', tab); 11 11 }; 12 12 13 $('#wpadminbar').removeClass('nojq').removeClass('nojs').find('li.menupop'). hoverIntent({13 $('#wpadminbar').removeClass('nojq').removeClass('nojs').find('li.menupop').not('.sticky').hoverIntent({ 14 14 over: function(e){ 15 15 $(this).addClass('hover'); 16 heightCheck($(this)); 16 17 }, 17 18 out: function(e){ 18 19 $(this).removeClass('hover'); … … 22 23 interval: 100 23 24 }); 24 25 26 $('.sticky', '#wpadminbar').click(function(e){ 27 e.preventDefault(); 28 $(this).toggleClass('hover'); 29 }); 30 25 31 $('#wp-admin-bar-get-shortlink').click(function(e){ 26 32 e.preventDefault(); 27 33 $(this).addClass('selected').children('.shortlink-input').blur(function(){ … … 66 72 e.preventDefault(); 67 73 $('html, body').animate({ scrollTop: 0 }, 'fast'); 68 74 }); 75 76 69 77 70 78 }); 79 80 function heightCheck( menu ) { 81 // Add overflow if sub menu height exceeds window height 82 var wHeight = jQuery(window).height(), 83 toolbarPlusPadding = 28 + 23, 84 subWrapper = menu.find('.ab-sub-wrapper'), 85 subMenuHeight = subWrapper.height() + toolbarPlusPadding; 86 87 if ( subMenuHeight > wHeight ) 88 subWrapper.css({ 'overflow-y': 'auto', 'overflow-x': 'hidden', 'height': wHeight - toolbarPlusPadding + 'px'}); 89 } 90 71 91 } else { 72 92 (function(d, w) { 73 93 var addEvent = function( obj, type, fn ) { -
wp-includes/css/admin-bar.css
10 10 font: normal 13px/28px sans-serif; 11 11 color: #ccc; 12 12 text-shadow: #444 0px -1px 0px; 13 } 13 } 14 14 15 15 #wpadminbar ul li:before, 16 16 #wpadminbar ul li:after { … … 206 206 } 207 207 208 208 #wpadminbar.nojs .ab-top-menu > li.menupop:hover > .ab-item, 209 #wpadminbar .ab-top-menu > li.menupop.hover > .ab-item { 209 #wpadminbar .ab-top-menu > li.menupop.hover > .ab-item, 210 #wpadminbar .ab-top-menu > li > .screen-meta-active, 211 #wpadminbar .ab-top-menu > li:hover > .screen-meta-active { 210 212 background: #fff; 211 213 color: #333; 212 214 text-shadow: none; … … 517 519 } 518 520 519 521 /** 522 * Sticky menu toggle arrows 523 */ 524 #wpadminbar .sticky .sticky-indicator { 525 position: relative; 526 float: right; 527 width: 20px; 528 height: 16px; 529 margin-top: 6px; 530 background-image: url("../images/admin-bar-sprite.png"); 531 background-position: 0 -254px; 532 background-repeat: no-repeat; 533 cursor: pointer; 534 } 535 536 #wpadminbar .sticky.hover .sticky-indicator { 537 background-position: 0 -228px; 538 } 539 540 /** 520 541 * WP Logo icon 521 542 */ 522 543 #wp-admin-bar-wp-logo > .ab-item .ab-icon { … … 573 594 } 574 595 575 596 /** 597 * Screen Settings icon 598 */ 599 #wpadminbar #wp-admin-bar-screen-options > .ab-item .ab-icon { 600 background-image: url(../images/admin-bar-sprite.png?d=20111130); 601 background-position: -3px -252px; 602 background-repeat: no-repeat; 603 } 604 605 #wpadminbar.nojs #wp-admin-bar-screen-options:hover > .ab-item .ab-icon, 606 #wpadminbar #wp-admin-bar-screen-options.hover > .ab-item .ab-icon { 607 background-image: url(../images/admin-bar-sprite.png?d=20111130); 608 background-position: -3px -228px; 609 background-repeat: no-repeat; 610 } 611 612 /** 576 613 * Customize support classes 577 614 */ 578 615 .no-customize-support .hide-if-no-customize, … … 590 627 #wp-admin-bar-wp-logo > .ab-item .ab-icon, 591 628 #wp-admin-bar-updates > .ab-item .ab-icon, 592 629 #wp-admin-bar-comments > .ab-item .ab-icon, 593 #wpadminbar #wp-admin-bar-new-content > .ab-item .ab-icon { 594 background-image: url(../images/admin-bar-sprite-2x.png?d=20120830); 595 background-size: 20px 220px; 630 #wpadminbar #wp-admin-bar-new-content > .ab-item .ab-icon, 631 #wpadminbar #wp-admin-bar-screen-options > .ab-item .ab-icon, 632 #wpadminbar .sticky .sticky-indicator { 633 background-image: url( "../images/admin-bar-sprite-2x.png?d=20120830" ); 634 background-size: 20px 276px; 596 635 } 597 636 } 598 637 -
wp-includes/class-wp-admin-bar.php
104 104 'parent' => false, 105 105 'href' => false, 106 106 'group' => false, 107 'sticky' => false, 107 108 'meta' => array(), 108 109 ); 109 110 … … 396 397 397 398 $is_parent = ! empty( $node->children ); 398 399 $has_link = ! empty( $node->href ); 400 $has_title = ! empty( $node->title ); 401 $is_sticky = $node->sticky === true ? true : false; 399 402 400 403 $tabindex = isset( $node->meta['tabindex'] ) ? (int) $node->meta['tabindex'] : ''; 401 404 $aria_attributes = $tabindex ? 'tabindex="' . $tabindex . '"' : ''; … … 410 413 if ( ! empty( $node->meta['class'] ) ) 411 414 $menuclass .= $node->meta['class']; 412 415 416 if ( $is_sticky ) 417 $menuclass .= 'sticky'; 418 413 419 if ( $menuclass ) 414 420 $menuclass = ' class="' . esc_attr( trim( $menuclass ) ) . '"'; 415 421 416 422 ?> 417 423 418 424 <li id="<?php echo esc_attr( 'wp-admin-bar-' . $node->id ); ?>"<?php echo $menuclass; ?>><?php 419 if ( $has_link ): 420 ?><a class="ab-item" <?php echo $aria_attributes; ?> href="<?php echo esc_url( $node->href ) ?>"<?php 421 if ( ! empty( $node->meta['onclick'] ) ) : 422 ?> onclick="<?php echo esc_js( $node->meta['onclick'] ); ?>"<?php 425 if ( $has_title ): 426 if ( $has_link ): 427 ?><a class="ab-item" <?php echo $aria_attributes; ?> href="<?php echo esc_url( $node->href ) ?>"<?php 428 if ( ! empty( $node->meta['onclick'] ) ) : 429 ?> onclick="<?php echo esc_js( $node->meta['onclick'] ); ?>"<?php 430 endif; 431 if ( ! empty( $node->meta['target'] ) ) : 432 ?> target="<?php echo esc_attr( $node->meta['target'] ); ?>"<?php 423 433 endif; 424 if ( ! empty( $node->meta['target'] ) ) : 425 ?> target="<?php echo esc_attr( $node->meta['target'] ); ?>"<?php 434 if ( ! empty( $node->meta['title'] ) ) : 435 ?> title="<?php echo esc_attr( $node->meta['title'] ); ?>"<?php 436 endif; 437 ?>><?php 438 else: 439 ?><a href="#" onclick="return false;" class="ab-item ab-empty-item" <?php echo $aria_attributes; 440 if ( ! empty( $node->meta['title'] ) ) : 441 ?> title="<?php echo esc_attr( $node->meta['title'] ); ?>"<?php 442 endif; 443 ?>><?php 426 444 endif; 427 if ( ! empty( $node->meta['title'] ) ) : 428 ?> title="<?php echo esc_attr( $node->meta['title'] ); ?>"<?php 445 446 echo $node->title; 447 448 if ( $is_sticky ) : 449 ?><span class="sticky-indicator"></span><?php 429 450 endif; 430 ?>><?php 431 else:432 ?><div class="ab-item ab-empty-item" <?php echo $aria_attributes;433 if ( ! empty( $node->meta['title'] ) ):434 ?> title="<?php echo esc_attr( $node->meta['title'] ); ?>"<?php451 452 if ( $has_link ) : 453 ?></a><?php 454 else: 455 ?></a><?php 435 456 endif; 436 ?>><?php437 457 endif; 438 458 439 echo $node->title;440 441 if ( $has_link ) :442 ?></a><?php443 else:444 ?></div><?php445 endif;446 447 459 if ( $is_parent ) : 448 460 ?><div class="ab-sub-wrapper"><?php 449 461 foreach ( $node->children as $group ) { … … 455 467 if ( ! empty( $node->meta['html'] ) ) 456 468 echo $node->meta['html']; 457 469 470 if ( ! empty( $node->meta['html_callback'] ) ) 471 call_user_func( $node->meta['html_callback'] ); 458 472 ?> 459 473 </li><?php 460 474 } … … 483 497 } 484 498 add_action( 'admin_bar_menu', 'wp_admin_bar_edit_menu', 80 ); 485 499 500 if ( is_admin() ) { 501 add_action( 'admin_bar_menu', 'wp_admin_bar_screen_options', 0 ); 502 add_action( 'admin_bar_menu', 'wp_admin_bar_contextual_help', 90 ); 503 } 504 486 505 add_action( 'admin_bar_menu', 'wp_admin_bar_add_secondary_groups', 200 ); 487 506 488 507 do_action( 'add_admin_bar_menus' ); -
wp-admin/includes/screen.php
784 784 785 785 // Time to render! 786 786 ?> 787 <div id="screen-meta" class="metabox-prefs">788 789 787 <div id="contextual-help-wrap" class="<?php echo esc_attr( $help_class ); ?>" tabindex="-1" aria-label="<?php esc_attr_e('Contextual Help Tab'); ?>"> 790 788 <div id="contextual-help-back"></div> 791 789 <div id="contextual-help-columns"> … … 860 858 // Add screen options 861 859 if ( $this->show_screen_options() ) 862 860 $this->render_screen_options(); 863 ?>864 </div>865 <?php866 if ( ! $this->get_help_tabs() && ! $this->show_screen_options() )867 return;868 ?>869 <div id="screen-meta-links">870 <?php if ( $this->get_help_tabs() ) : ?>871 <div id="contextual-help-link-wrap" class="hide-if-no-js screen-meta-toggle">872 <a href="#contextual-help-wrap" id="contextual-help-link" class="show-settings" aria-controls="contextual-help-wrap" aria-expanded="false"><?php _e( 'Help' ); ?></a>873 </div>874 <?php endif;875 if ( $this->show_screen_options() ) : ?>876 <div id="screen-options-link-wrap" class="hide-if-no-js screen-meta-toggle">877 <a href="#screen-options-wrap" id="show-settings-link" class="show-settings" aria-controls="screen-options-wrap" aria-expanded="false"><?php _e( 'Screen Options' ); ?></a>878 </div>879 <?php endif; ?>880 </div>881 <?php882 861 } 883 862 884 863 public function show_screen_options() { -
wp-admin/js/common.js
90 90 }; 91 91 92 92 screenMeta = { 93 element: null, // #screen-meta94 93 toggles: null, // .screen-meta-toggle 95 page: null, // #wpcontent96 94 97 95 init: function() { 98 this.element = $('#screen-meta');99 96 this.toggles = $('.screen-meta-toggle a'); 100 this.page = $('#wpcontent');101 97 102 this.toggles.click( this.toggleEvent ); 98 this.toggles.hoverIntent({ 99 over: this.toggleEvent, 100 out: this.toggleEvent 101 }); 103 102 }, 104 103 105 104 toggleEvent: function( e ) { … … 116 115 }, 117 116 118 117 open: function( panel, link ) { 119 120 $('.screen-meta-toggle').not( link.parent() ).css('visibility', 'hidden'); 121 122 panel.parent().show(); 123 panel.slideDown( 'fast', function() { 118 panel.show( 0, function() { 124 119 panel.focus(); 125 120 link.addClass('screen-meta-active').attr('aria-expanded', true); 126 121 }); 127 122 }, 128 123 129 124 close: function( panel, link ) { 130 panel. slideUp( 'fast', function() {125 panel.hide( 0, function() { 131 126 link.removeClass('screen-meta-active').attr('aria-expanded', false); 132 $('.screen-meta-toggle').css('visibility', '');133 panel.parent().hide();134 127 }); 135 128 } 136 129 }; -
wp-admin/admin-header.php
115 115 <div id="wpcontent"> 116 116 117 117 <?php 118 $current_screen->set_parentage( $parent_file ); 118 119 do_action('in_admin_header'); 119 120 ?> 120 121 … … 122 123 <?php 123 124 unset($title_class, $blog_name, $total_update_count, $update_title); 124 125 125 $current_screen->set_parentage( $parent_file );126 127 126 ?> 128 127 129 128 <div id="wpbody-content" aria-label="<?php esc_attr_e('Main content'); ?>"> -
wp-admin/css/wp-admin.css
1117 1117 1118 1118 #screen-options-wrap, 1119 1119 #contextual-help-wrap { 1120 margin: 0 ;1120 margin: 0 2px 0 0; 1121 1121 padding: 8px 20px 12px; 1122 position: relative;1122 position: absolute; 1123 1123 overflow: auto; 1124 z-index: 9999; 1125 -webkit-box-shadow: 0 4px 4px rgba(0,0,0,0.2); 1126 box-shadow: 0 4px 4px rgba(0,0,0,0.2); 1127 background: #f1f1f1; 1128 border-width: 0 1px 1px 1px; 1129 border-style: solid; 1130 border-color: #dfdfdf; 1124 1131 } 1132 #screen-options-wrap { 1133 right: 0; 1134 margin: 0; 1135 width: 200px; 1136 background: #fff; 1137 } 1125 1138 1126 1139 #screen-meta .screen-reader-text { 1127 1140 visibility: hidden;