Admin bar sprite cleanups. Props ocean90, darrenmeehan. see #15611

git-svn-id: http://svn.automattic.com/wordpress/trunk@16897 1a063a9b-81f0-0310-95a4-ce76da25c4cd
This commit is contained in:
ryan 2010-12-13 20:35:28 +00:00
parent ba02f47bfd
commit cd009bb900
9 changed files with 101 additions and 119 deletions

View File

@ -66,18 +66,6 @@ function wp_admin_bar_render() {
add_action( 'wp_footer', 'wp_admin_bar_render', 1000 );
add_action( 'admin_footer', 'wp_admin_bar_render', 1000 );
/**
* Show the logged in user's gravatar as a separator.
*
* @since 3.1.0
*/
function wp_admin_bar_me_separator() {
global $wp_admin_bar;
$user_id = get_current_user_id();
if ( 0 != $user_id )
$wp_admin_bar->add_menu( array( 'id' => 'me', 'title' => get_avatar( get_current_user_id(), 16 ), 'href' => get_edit_profile_url( $user_id ), ) );
}
/**
* Add the "My Account" menu and all submenus.
*
@ -90,7 +78,8 @@ function wp_admin_bar_my_account_menu() {
if ( 0 != $user_id ) {
/* Add the 'My Account' menu */
$wp_admin_bar->add_menu( array( 'id' => 'my-account', 'title' => $user_identity, 'href' => get_edit_profile_url( $user_id ) ) );
$avatar = get_avatar( get_current_user_id(), 16 );
$wp_admin_bar->add_menu( array( 'id' => 'my-account', 'title' => $avatar . $user_identity, 'href' => get_edit_profile_url( $user_id ) ) );
/* Add the "My Account" sub menus */
$wp_admin_bar->add_menu( array( 'parent' => 'my-account', 'title' => __( 'Edit My Profile' ), 'href' => get_edit_profile_url( $user_id ) ) );
@ -146,18 +135,6 @@ function wp_admin_bar_my_sites_menu() {
}
}
/**
* Show the blavatar of the current site as a separator.
*
* @since 3.1.0
*/
function wp_admin_bar_blog_separator() {
global $wp_admin_bar, $current_blog;
$default = includes_url('images/wpmini-blue.png');
$wp_admin_bar->add_menu( array( 'id' => 'blog', 'title' => '<img class="avatar" src="' . $default . '" alt="' . esc_attr__( 'Current site avatar' ) . '" width="16" height="16" />', 'href' => home_url(), ) );
}
/**
* Provide a shortlink.
*
@ -192,6 +169,11 @@ function wp_admin_bar_edit_menu () {
}
}
/**
* Add "Add New" menu.
*
* @since 3.1.0
*/
function wp_admin_bar_new_content_menu() {
global $wp_admin_bar;
@ -199,6 +181,7 @@ function wp_admin_bar_new_content_menu() {
foreach ( (array) get_post_types( array( 'show_ui' => true ), 'objects' ) as $ptype_obj ) {
if ( true !== $ptype_obj->show_in_menu || ! current_user_can( $ptype_obj->cap->edit_posts ) )
continue;
$actions[ 'post-new.php?post_type=' . $ptype_obj->name ] = array( $ptype_obj->labels->singular_name, $ptype_obj->cap->edit_posts, 'new-' . $ptype_obj->name );
}
@ -212,6 +195,11 @@ function wp_admin_bar_new_content_menu() {
}
}
/**
* Add edit comments link with awaiting moderation count bubble.
*
* @since 3.1.0
*/
function wp_admin_bar_comments_menu() {
global $wp_admin_bar;
@ -225,6 +213,11 @@ function wp_admin_bar_comments_menu() {
$wp_admin_bar->add_menu( array( 'id' => 'comments', 'title' => sprintf( __('Comments %s'), $awaiting_mod ), 'href' => admin_url('edit-comments.php') ) );
}
/**
* Add "Appearance" menu with widget and nav menu submenu.
*
* @since 3.1.0
*/
function wp_admin_bar_appearance_menu() {
global $wp_admin_bar;
@ -243,6 +236,11 @@ function wp_admin_bar_appearance_menu() {
$wp_admin_bar->add_menu( array( 'parent' => 'appearance', 'id' => 'menus', 'title' => __('Menus'), 'href' => admin_url('nav-menus.php') ) );
}
/**
* Provide an update link if theme/plugin/core updates are available.
*
* @since 3.1.0
*/
function wp_admin_bar_updates_menu() {
global $wp_admin_bar;

View File

@ -101,7 +101,7 @@ class WP_Admin_Bar {
<div id="adminbarsearch-wrap">
<form action="<?php echo home_url(); ?>" method="get" id="adminbarsearch">
<input class="adminbar-input" name="s" id="adminbar-search" type="text" value="" maxlength="150" />
<button type="submit" class="adminbar-button"><span><?php _e('Search'); ?></span></button>
<input type="submit" class="adminbar-button" value="<?php _e('Search'); ?>"/>
</form>
</div>
</div>
@ -174,17 +174,16 @@ class WP_Admin_Bar {
}
function add_menus() {
add_action( 'admin_bar_menu', 'wp_admin_bar_me_separator', 10 );
add_action( 'admin_bar_menu', 'wp_admin_bar_my_account_menu', 20 );
add_action( 'admin_bar_menu', 'wp_admin_bar_my_sites_menu', 30 );
add_action( 'admin_bar_menu', 'wp_admin_bar_edit_menu', 40 );
add_action( 'admin_bar_menu', 'wp_admin_bar_shortlink_menu', 90 );
add_action( 'admin_bar_menu', 'wp_admin_bar_updates_menu', 80 );
add_action( 'admin_bar_menu', 'wp_admin_bar_my_account_menu', 10 );
add_action( 'admin_bar_menu', 'wp_admin_bar_my_sites_menu', 20 );
add_action( 'admin_bar_menu', 'wp_admin_bar_edit_menu', 30 );
add_action( 'admin_bar_menu', 'wp_admin_bar_shortlink_menu', 80 );
add_action( 'admin_bar_menu', 'wp_admin_bar_updates_menu', 70 );
if ( !is_network_admin() && !is_user_admin() ) {
add_action( 'admin_bar_menu', 'wp_admin_bar_new_content_menu', 50 );
add_action( 'admin_bar_menu', 'wp_admin_bar_comments_menu', 60 );
add_action( 'admin_bar_menu', 'wp_admin_bar_appearance_menu', 70 );
add_action( 'admin_bar_menu', 'wp_admin_bar_new_content_menu', 40 );
add_action( 'admin_bar_menu', 'wp_admin_bar_comments_menu', 50 );
add_action( 'admin_bar_menu', 'wp_admin_bar_appearance_menu', 60 );
}
do_action( 'add_admin_bar_menus' );

View File

@ -1 +1 @@
#wpadminbar{background:#666 url(../images/admin-bar-sprite-rtl.png?d=08102010) 0 -222px repeat-x;direction:rtl;font-family:Tahoma,Arial,sans-serif;right:0;left:auto;}#wpadminbar .quicklinks ul{text-align:right;}#wpadminbar .quicklinks ul li{float:right;}#wpadminbar .quicklinks>ul>li>a{border-left:1px solid #686868;border-right:1px solid #808080;}#wpadminbar .quicklinks>ul>li:last-child>a{border-left:none;border-right:1px solid #808080;}#wpadminbar .quicklinks>ul>li:hover>a{border-right-color:#707070;border-left-color:#686868;}#wpadminbar .quicklinks li.ab-me a img.avatar{margin:5px -4px 0 2px;}#wpadminbar .quicklinks .menupop li:hover>ul,#wpadminbar .quicklinks .menupop li.hover>ul{margin-right:100%;margin-left:0;}#wpadminbar .quicklinks .menupop a>span{background:url(../images/admin-bar-sprite-rtl.png?d=08102010) 0 100.4% no-repeat;padding-right:0;padding-left:.8em;}#wpadminbar .quicklinks .menupop ul li a>span{background:url(../images/admin-bar-sprite-rtl.png?d=08102010) 0 97.2% no-repeat;padding-right:0;padding-left:1.5em;}#wpadminbar .quicklinks a{font-family:Tahoma,Arial,Helvetica,sans-serif;}#wpadminbar .quicklinks li:hover{background:#555 url(../images/admin-bar-sprite-rtl.png?d=08102010) 0 -282px repeat-x;}#wpadminbar .quicklinks .menupop li:hover{background:#888 url(../images/admin-bar-sprite-rtl.png?d=08102010) 0 -222px repeat-x;}#wpadminbar .quicklinks .menupop li a img.blavatar{margin-right:0;margin-left:8px;}#wpadminbar .quicklinks li.ab-me>a{background:url(../images/admin-bar-sprite-rtl.png?d=08102010) 0 59.8% no-repeat;}#wpadminbar .quicklinks li.ab-my-account>a{border-right:none;border-left:1px solid #686868;}#wpadminbar #adminbarsearch{float:left;}#wpadminbar #adminbarsearch .adminbar-input{background:#ddd url(../images/admin-bar-sprite-rtl.png?d=08102010) right top no-repeat;float:right;font-family:Tahoma,Arial,Helvetica,sans-serif;margin-right:0;margin-left:3px;}#wpadminbar #adminbarsearch .adminbar-button{background:url(../images/admin-bar-sprite-rtl.png?d=08102010) left -107px no-repeat;float:right;padding:0 0 0 14px;}#wpadminbar #adminbarsearch .adminbar-button span{background:url(../images/admin-bar-sprite-rtl.png?d=08102010) right -69px no-repeat;padding:3px 14px 0 0;font-family:Tahoma,Arial,Helvetica,sans-serif;}#wpadminbar #adminbarsearch .adminbar-button:active{background-position:left -184px;}#wpadminbar #adminbarsearch .adminbar-button:active span{background-position:right -146px;}
#wpadminbar{background:#666 url(../images/admin-bar-sprite-rtl.png?d=08102010) 0 -222px repeat-x;direction:rtl;font-family:Tahoma,Arial,sans-serif;right:0;left:auto;}#wpadminbar .quicklinks ul{text-align:right;}#wpadminbar .quicklinks ul li{float:right;}#wpadminbar .quicklinks>ul>li>a{border-left:1px solid #686868;border-right:1px solid #808080;}#wpadminbar .quicklinks>ul>li:last-child>a{border-left:none;border-right:1px solid #808080;}#wpadminbar .quicklinks>ul>li:hover>a{border-right-color:#707070;border-left-color:#686868;}#wpadminbar .quicklinks li.ab-my-account a img.avatar{margin:-2px -5px 0 23px;}#wpadminbar .quicklinks li.ab-my-account ul{left:auto;right:30px;}#wpadminbar .quicklinks .menupop li:hover>ul,#wpadminbar .quicklinks .menupop li.hover>ul{margin-right:100%;margin-left:0;}#wpadminbar .quicklinks .menupop a>span{background:url(../images/admin-bar-sprite-rtl.png?d=11122010) left -58px no-repeat;padding-right:0;padding-left:.8em;}#wpadminbar .quicklinks .menupop ul li a>span{background:url(../images/admin-bar-sprite-rtl.png?d=11122010) left -29px no-repeat;padding-right:0;padding-left:1.5em;}#wpadminbar .quicklinks a{font-family:Tahoma,Arial,Helvetica,sans-serif;}#wpadminbar .quicklinks .menupop li a img.blavatar{margin-right:0;margin-left:8px;}#wpadminbar .quicklinks li.ab-my-account>a{background:url(../images/admin-bar-sprite-rtl.png?d=11122010) top right no-repeat;}#wpadminbar .quicklinks li.ab-my-account>a{border-right:none;border-left:1px solid #686868;}#wpadminbar #adminbarsearch{float:left;}#wpadminbar #adminbarsearch .adminbar-input{float:right;font-family:Tahoma,Arial,Helvetica,sans-serif;margin-right:0;margin-left:3px;-moz-box-shadow:inset 2px -2px 1px #cdcdcd;-webkit-box-shadow:inset -2px 2px 1px #cdcdcd;box-shadow:inset 2px -2px 1px #cdcdcd;}#wpadminbar #adminbarsearch .adminbar-button{float:right;font-family:Tahoma,Arial,Helvetica,sans-serif;}

View File

@ -29,8 +29,13 @@
border-left-color: #686868;
}
#wpadminbar .quicklinks li.ab-me a img.avatar {
margin: 5px -4px 0 2px;
#wpadminbar .quicklinks li.ab-my-account a img.avatar {
margin: -2px -5px 0 23px;
}
#wpadminbar .quicklinks li.ab-my-account ul {
left: auto;
right: 30px;
}
#wpadminbar .quicklinks .menupop li:hover > ul,
@ -40,13 +45,13 @@
}
#wpadminbar .quicklinks .menupop a > span {
background: url(../images/admin-bar-sprite-rtl.png?d=08102010) 0 100.4% no-repeat;
background: url(../images/admin-bar-sprite-rtl.png?d=11122010) left -58px no-repeat;
padding-right: 0;
padding-left: .8em;
}
#wpadminbar .quicklinks .menupop ul li a > span {
background: url(../images/admin-bar-sprite-rtl.png?d=08102010) 0% 97.2% no-repeat;
background: url(../images/admin-bar-sprite-rtl.png?d=11122010) left -29px no-repeat;
padding-right: 0;
padding-left: 1.5em;
}
@ -55,21 +60,13 @@
font-family: Tahoma, Arial, Helvetica, sans-serif;
}
#wpadminbar .quicklinks li:hover {
background: #555 url(../images/admin-bar-sprite-rtl.png?d=08102010) 0 -282px repeat-x;
}
#wpadminbar .quicklinks .menupop li:hover {
background: #888 url(../images/admin-bar-sprite-rtl.png?d=08102010) 0 -222px repeat-x;
}
#wpadminbar .quicklinks .menupop li a img.blavatar {
margin-right: 0;
margin-left: 8px;
}
#wpadminbar .quicklinks li.ab-me > a {
background: url(../images/admin-bar-sprite-rtl.png?d=08102010) 0% 59.8% no-repeat;
#wpadminbar .quicklinks li.ab-my-account > a {
background: url(../images/admin-bar-sprite-rtl.png?d=11122010) top right no-repeat;
}
#wpadminbar .quicklinks li.ab-my-account > a {
@ -82,29 +79,16 @@
}
#wpadminbar #adminbarsearch .adminbar-input {
background: #ddd url(../images/admin-bar-sprite-rtl.png?d=08102010) right top no-repeat;
float: right;
font-family: Tahoma, Arial, Helvetica, sans-serif;
margin-right: 0;
margin-left: 3px;
-moz-box-shadow: inset 2px -2px 1px #cdcdcd;
-webkit-box-shadow: inset -2px 2px 1px #cdcdcd;
box-shadow: inset 2px -2px 1px #cdcdcd;
}
#wpadminbar #adminbarsearch .adminbar-button {
background: url(../images/admin-bar-sprite-rtl.png?d=08102010) left -107px no-repeat;
float: right;
padding: 0 0 0 14px;
}
#wpadminbar #adminbarsearch .adminbar-button span {
background: url(../images/admin-bar-sprite-rtl.png?d=08102010) right -69px no-repeat;
padding: 3px 14px 0 0;
font-family: Tahoma, Arial, Helvetica, sans-serif;
}
#wpadminbar #adminbarsearch .adminbar-button:active {
background-position: left -184px;
}
#wpadminbar #adminbarsearch .adminbar-button:active span {
background-position: right -146px;
}

File diff suppressed because one or more lines are too long

View File

@ -1,13 +1,16 @@
#wpadminbar {
direction: ltr;
background: #666 url(../images/admin-bar-sprite.png?d=08102010) 0 -222px repeat-x;
background: #666;
background: -moz-linear-gradient(bottom, #666, #7f7f7f);
background: -webkit-gradient(linear, left bottom, left top, from(#666), to(#7f7f7f));
color: #ddd;
font: 12px Arial, Helvetica, sans-serif;
height: 28px;
left: 0;
margin: 0;
padding: 0;
position: fixed;
top: 0;
left: 0;
width: 100%;
z-index: 99999;
min-width: 960px;
@ -75,6 +78,7 @@
border-top: none;
float: none;
}
#wpadminbar .quicklinks .menupop ul li {
float: none;
}
@ -105,21 +109,25 @@
}
#wpadminbar .quicklinks li:hover {
background: #555 url(../images/admin-bar-sprite.png?d=08102010) 0 -282px repeat-x;
background: #555;
background: -moz-linear-gradient(bottom, #555, #3e3e3e);
background: -webkit-gradient(linear, left bottom, left top, from(#555), to(#3e3e3e));
}
#wpadminbar .quicklinks .menupop li:hover {
background: #888 url(../images/admin-bar-sprite.png?d=08102010) 0 -222px repeat-x;
background: #888;
background: -moz-linear-gradient(bottom, #888, #9d9d9d);
background: -webkit-gradient(linear, left bottom, left top, from(#888), to(#9d9d9d));
}
#wpadminbar .quicklinks .menupop a > span {
background: url(../images/admin-bar-sprite.png?d=08102010) 100% 100.4% no-repeat;
background: url(../images/admin-bar-sprite.png?d=11122010) right -58px no-repeat;
padding-right: .8em;
}
#wpadminbar .quicklinks .menupop ul li a > span {
display: block;
background: url(../images/admin-bar-sprite.png?d=08102010) 100% 97.2% no-repeat;
background: url(../images/admin-bar-sprite.png?d=11122010) right -29px no-repeat;
padding-right: 1.5em;
}
@ -144,25 +152,20 @@
color: #000;
}
#wpadminbar .quicklinks li.ab-me a {
border: none;
background: url(../images/admin-bar-sprite.png?d=08102010) 100% 59.8% no-repeat;
}
#wpadminbar .quicklinks li.ab-my-account > a {
border-left: none;
background: url(../images/admin-bar-sprite.png?d=11122010) top left no-repeat;
}
#wpadminbar .quicklinks li.ab-me:hover {
background: none;
}
#wpadminbar .quicklinks li.ab-me a img.avatar {
#wpadminbar .quicklinks li.ab-my-account a img.avatar {
border: 1px solid #999;
margin: 5px 2px 0 -4px;
vertical-align: middle;
margin: -2px 23px 0 -5px;
background: #eee;
width: 16px;
height: 16px;
}
#wpadminbar .quicklinks li.ab-my-account ul {
left: 30px;
}
#wpadminbar .quicklinks .menupop li a img.blavatar {
@ -177,62 +180,60 @@
}
#wpadminbar #adminbarsearch .adminbar-input {
color: #555;
width: 140px;
display: block;
float: left;
font: 12px Arial, Helvetica, sans-serif;
color: #555;
text-shadow: 0 1px 0 #fff;
border: 1px solid #626262;
padding: 2px 3px;
margin: 0 3px 0 0;
background: #ddd url(../images/admin-bar-sprite.png?d=08102010) top left no-repeat;
background-color: #ddd;
-moz-box-shadow: inset 2px 2px 1px #cdcdcd;
-webkit-box-shadow: inset 2px 2px 1px #cdcdcd;
box-shadow: inset 2px 2px 1px #cdcdcd;
-webkit-border-radius: 0;
-khtml-border-radius: 0;
-moz-border-radius: 0;
border-radius: 0;
-moz-box-sizing: border-box;
-webkit-box-sizing: border-box;
-ms-box-sizing: border-box;
box-sizing: border-box;
outline: none;
text-shadow: 0 1px 0 #fff;
}
#wpadminbar #adminbarsearch .adminbar-button {
position: relative;
border: 0;
cursor: pointer;
overflow: visible;
margin: 0 !important;
float: left;
background: url(../images/admin-bar-sprite.png?d=08102010) right -107px no-repeat;
padding: 0 14px 0 0;
text-align: center;
outline: none;
}
#wpadminbar #adminbarsearch .adminbar-button span {
position: relative;
display: block;
white-space: nowrap;
height: 19px;
background: url(../images/admin-bar-sprite.png?d=08102010) left -69px no-repeat;
padding: 3px 0 0 14px;
font: 12px Arial, Helvetica, sans-serif;
font-weight: bold;
font: bold 12px Arial, Helvetica, sans-serif;
color: #444;
text-shadow: 0px 1px 0px #eee;
cursor: pointer;
float: left;
background: #aaa;
background: -moz-linear-gradient(bottom, #aaa, #cecece);
background: -webkit-gradient(linear, left bottom, left top, from(#aaa), to(#cecece));
-webkit-border-radius: 10px;
-khtml-border-radius: 10px;
-moz-border-radius: 10px;
border-radius: 10px;
border: 1px solid #626262;
padding: 2px 13px;
margin: 0;
}
#wpadminbar #adminbarsearch .adminbar-button:active {
background-position: right -184px;
text-shadow: 0px 1px 0px #eee;
background: #a0a0a0;
background:-moz-linear-gradient(bottom, #a0a0a0, #c1c1c1);
background:-webkit-gradient(linear, left bottom, left top, from(#a0a0a0), to(#c1c1c1));
-moz-box-shadow: inset 1px 1px 1px #9b9b9b;
-webkit-box-shadow: inset 1px 1px 1px #9b9b9b;
box-shadow: inset 1px 1px 1px #9b9b9b;
}
#wpadminbar #adminbarsearch .adminbar-button:hover span {
#wpadminbar #adminbarsearch .adminbar-button:hover {
color: #000;
}
#wpadminbar #adminbarsearch .adminbar-button:active span {
background-position: left -146px;
}
#wpadminbar #adminbarsearch .adminbar-button::-moz-focus-inner {
border: none;
}

Binary file not shown.

Before

Width:  |  Height:  |  Size: 18 KiB

After

Width:  |  Height:  |  Size: 732 B

Binary file not shown.

Before

Width:  |  Height:  |  Size: 15 KiB

After

Width:  |  Height:  |  Size: 737 B

View File

@ -516,7 +516,7 @@ function wp_default_styles( &$styles ) {
$styles->add( 'jcrop', '/wp-includes/js/jcrop/jquery.Jcrop.css', array(), '0.9.8' );
$styles->add( 'imgareaselect', '/wp-includes/js/imgareaselect/imgareaselect.css', array(), '0.9.1' );
$styles->add( 'nav-menu', "/wp-admin/css/nav-menu$suffix.css", array(), '20100907' );
$styles->add( 'admin-bar', "/wp-includes/css/admin-bar$suffix.css", array(), '20101210' );
$styles->add( 'admin-bar', "/wp-includes/css/admin-bar$suffix.css", array(), '20101213' );
$styles->add( 'wp-jquery-ui-dialog', "/wp-includes/css/jquery-ui-dialog$suffix.css", array(), '20101119' );
$styles->add( 'wplink', "/wp-includes/js/tinymce/plugins/wplink/css/wplink$suffix.css", array(), '20101206' );