Second pass, admin bar overhaul. see #18197.

git-svn-id: http://svn.automattic.com/wordpress/trunk@18776 1a063a9b-81f0-0310-95a4-ce76da25c4cd
This commit is contained in:
koopersmith 2011-09-25 23:30:40 +00:00
parent b9bd6e3632
commit 590868d915
7 changed files with 356 additions and 141 deletions

View File

@ -66,6 +66,54 @@ function wp_admin_bar_render() {
add_action( 'wp_footer', 'wp_admin_bar_render', 1000 );
add_action( 'admin_footer', 'wp_admin_bar_render', 1000 );
/**
* Add the WordPress logo menu.
*
* @since 3.3.0
*/
function wp_admin_bar_wp_menu( $wp_admin_bar ) {
$wp_admin_bar->add_menu( array(
'id' => 'wp-logo',
'title' => ' ',
'href' => '#',
'meta' => array(
'class' => 'wp-admin-bar-logo',
),
) );
// Add "About This Version" link
$wp_admin_bar->add_menu( array(
'parent' => 'wp-logo',
'id' => 'about',
'title' => __('About This Version'),
'href' => admin_url('about.php'),
) );
// Add codex link
$wp_admin_bar->add_menu( array(
'parent' => 'wp-logo',
'id' => 'documentation',
'title' => __('Documentation'),
'href' => 'http://codex.wordpress.org',
) );
// Add forums link
$wp_admin_bar->add_menu( array(
'parent' => 'wp-logo',
'id' => 'support-forums',
'title' => __('Support Forums'),
'href' => 'http://wordpress.org/support/',
) );
// Add WordPress.org link
$wp_admin_bar->add_menu( array(
'parent' => 'wp-logo',
'id' => 'wporg',
'title' => __('WordPress.org'),
'href' => 'http://wordpress.org',
) );
}
/**
* Add the "My Account" menu and all submenus.
*
@ -74,19 +122,92 @@ add_action( 'admin_footer', 'wp_admin_bar_render', 1000 );
function wp_admin_bar_my_account_menu( $wp_admin_bar ) {
global $user_identity;
$user_id = get_current_user_id();
$user_id = get_current_user_id();
$current_user = wp_get_current_user();
if ( 0 != $user_id ) {
/* Add the 'My Account' menu */
$avatar = get_avatar( get_current_user_id(), 28 );
$id = ( ! empty( $avatar ) ) ? 'my-account-with-avatar' : 'my-account';
$howdy = sprintf( __('Howdy, %1$s'), $user_identity );
$class = 'opposite';
$wp_admin_bar->add_menu( array( 'id' => $id, 'title' => $howdy . $avatar, 'href' => get_edit_profile_url( $user_id ) ) );
if ( ! empty( $avatar ) )
$class .= ' with-avatar';
$wp_admin_bar->add_menu( array(
'id' => 'my-account',
'title' => $howdy . $avatar,
'href' => get_edit_profile_url( $user_id ),
'meta' => array(
'class' => $class,
),
) );
/* Add the "My Account" sub menus */
$wp_admin_bar->add_menu( array( 'id' => 'edit-profile', 'parent' => $id, 'title' => __( 'Edit My Profile' ), 'href' => get_edit_profile_url( $user_id ) ) );
$wp_admin_bar->add_menu( array( 'id' => 'logout', 'parent' => $id, 'title' => __( 'Log Out' ), 'href' => wp_logout_url() ) );
$user_info = get_avatar( get_current_user_id(), 64 );
$user_info .= "<span class='display-name'>{$current_user->display_name}</span>";
if ( $current_user->display_name !== $current_user->user_nicename )
$user_info .= "<span class='username'>{$current_user->user_nicename}</span>";
$wp_admin_bar->add_menu( array(
'parent' => 'my-account',
'id' => 'user-info',
'title' => $user_info,
'meta' => array(
'class' => 'user-info user-info-item'
),
) );
$wp_admin_bar->add_menu( array(
'parent' => 'my-account',
'id' => 'edit-profile',
'title' => __( 'Edit My Profile' ),
'href' => get_edit_profile_url( $user_id ),
'meta' => array(
'class' => 'user-info-item',
),
) );
$wp_admin_bar->add_menu( array(
'parent' => 'my-account',
'id' => 'logout',
'title' => __( 'Log Out' ),
'href' => wp_logout_url(),
'meta' => array(
'class' => 'user-info-item',
),
) );
$wp_admin_bar->add_menu( array(
'parent' => 'my-account',
'id' => 'my-account-secondary',
'title' => '&nbsp;',
'meta' => array(
'class' => 'secondary',
),
) );
}
wp_admin_bar_my_sites_menu( $wp_admin_bar );
}
/**
* Add the "Network Admin" menu.
*
* @since 3.3.0
*/
function wp_admin_bar_network_admin_menu( $wp_admin_bar ) {
if ( is_multisite() && is_super_admin() && ! is_network_admin() ) {
$wp_admin_bar->add_menu( array(
'id' => 'network-admin',
'title' => __('Network Admin'),
'href' => network_admin_url(),
'meta' => array(
'class' => 'opposite',
),
) );
}
}
@ -159,34 +280,6 @@ function wp_admin_bar_blog_admin_menu( $wp_admin_bar ) {
function wp_admin_bar_my_sites_menu( $wp_admin_bar ) {
global $wpdb;
/* Add the 'My Sites' menu if the user has more than one site. */
// if ( count( $wp_admin_bar->user->blogs ) <= 1 )
// return;
if ( is_multisite() )
$url = admin_url( 'my-sites.php' );
else
$url = admin_url();
$wp_admin_bar->add_menu( array(
'id' => 'my-blogs',
'title' => '&nbsp;',
'href' => $url,
'meta' => array(
'class' => 'wp-admin-bar-logo',
),
) );
// Add network admin link
if ( is_multisite() && is_super_admin() && ! is_network_admin() ) {
$wp_admin_bar->add_menu( array(
'parent' => 'my-blogs',
'id' => 'network-admin',
'title' => __('Network Admin'),
'href' => network_admin_url(),
) );
}
if ( is_user_logged_in() ) {
// Add blog links
$blue_wp_logo_url = includes_url('images/wpmini-blue.png');
@ -202,34 +295,45 @@ function wp_admin_bar_my_sites_menu( $wp_admin_bar ) {
$blavatar = '<img src="' . esc_url($blue_wp_logo_url) . '" alt="' . esc_attr__( 'Blavatar' ) . '" width="16" height="16" class="blavatar"/>';
$blogname = empty( $blog->blogname ) ? $blog->domain : $blog->blogname;
$menu_id = 'blog-' . $blog->userblog_id;
$wp_admin_bar->add_menu( array( 'parent' => 'my-blogs', 'id' => 'blog-' . $blog->userblog_id, 'title' => $blavatar . $blogname, 'href' => get_admin_url($blog->userblog_id) ) );
$wp_admin_bar->add_menu( array( 'parent' => 'blog-' . $blog->userblog_id, 'id' => 'blog-' . $blog->userblog_id . '-d', 'title' => __( 'Dashboard' ), 'href' => get_admin_url($blog->userblog_id) ) );
$wp_admin_bar->add_menu( array(
'parent' => 'my-account-secondary',
'id' => $menu_id,
'title' => $blavatar . $blogname,
'href' => get_admin_url( $blog->userblog_id ),
) );
$wp_admin_bar->add_menu( array(
'parent' => $menu_id,
'id' => $menu_id . '-d',
'title' => __( 'Dashboard' ),
'href' => get_admin_url( $blog->userblog_id ),
) );
if ( current_user_can_for_blog( $blog->userblog_id, 'edit_posts' ) ) {
$wp_admin_bar->add_menu( array( 'parent' => 'blog-' . $blog->userblog_id, 'id' => 'blog-' . $blog->userblog_id . '-n', 'title' => __( 'New Post' ), 'href' => get_admin_url($blog->userblog_id, 'post-new.php') ) );
$wp_admin_bar->add_menu( array( 'parent' => 'blog-' . $blog->userblog_id, 'id' => 'blog-' . $blog->userblog_id . '-c', 'title' => __( 'Manage Comments' ), 'href' => get_admin_url($blog->userblog_id, 'edit-comments.php') ) );
$wp_admin_bar->add_menu( array(
'parent' => $menu_id,
'id' => $menu_id . '-n',
'title' => __( 'New Post' ),
'href' => get_admin_url( $blog->userblog_id, 'post-new.php' ),
) );
$wp_admin_bar->add_menu( array(
'parent' => $menu_id,
'id' => $menu_id . '-c',
'title' => __( 'Manage Comments' ),
'href' => get_admin_url( $blog->userblog_id, 'edit-comments.php' ),
) );
}
$wp_admin_bar->add_menu( array( 'parent' => 'blog-' . $blog->userblog_id, 'id' => 'blog-' . $blog->userblog_id . '-v', 'title' => __( 'Visit Site' ), 'href' => get_home_url($blog->userblog_id) ) );
$wp_admin_bar->add_menu( array(
'parent' => $menu_id,
'id' => $menu_id . '-v',
'title' => __( 'Visit Site' ),
'href' => get_home_url( $blog->userblog_id ),
) );
}
}
// Add WordPress.org link
$wp_admin_bar->add_menu( array(
'parent' => 'my-blogs',
'id' => 'about',
'title' => __('About This Version'),
'href' => admin_url('about.php'),
) );
// Add WordPress.org link
$wp_admin_bar->add_menu( array(
'parent' => 'my-blogs',
'id' => 'wporg',
'title' => __('WordPress.org'),
'href' => 'http://wordpress.org',
) );
}
/**

View File

@ -88,9 +88,9 @@ class WP_Admin_Bar {
function render() {
?>
<div id="wpadminbar" class="nojq">
<div id="wpadminbar" class="nojq nojs">
<div class="quicklinks">
<ul>
<ul class="ab-top-menu">
<?php foreach ( (array) $this->menu as $id => $menu_item ) : ?>
<?php $this->recursive_render( $id, $menu_item ) ?>
<?php endforeach; ?>
@ -173,16 +173,17 @@ class WP_Admin_Bar {
}
function add_menus() {
add_action( 'admin_bar_menu', 'wp_admin_bar_wp_menu', 10 );
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_new_content_menu', 40 );
add_action( 'admin_bar_menu', 'wp_admin_bar_comments_menu', 50 );
add_action( 'admin_bar_menu', 'wp_admin_bar_updates_menu', 70 );
add_action( 'admin_bar_menu', 'wp_admin_bar_shortlink_menu', 80 );
add_action( 'admin_bar_menu', 'wp_admin_bar_network_admin_menu', 80 );
if ( ! is_admin() ) {
add_action( 'admin_bar_menu', 'wp_admin_bar_blog_front_menu', 25 );
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_search_menu', 100 );
} else {
add_action( 'admin_bar_menu', 'wp_admin_bar_blog_admin_menu', 25 );

File diff suppressed because one or more lines are too long

View File

@ -7,7 +7,7 @@
text-transform: none;
letter-spacing: normal;
line-height: 1;
font: normal 12px/28px "Helvetica Neue", sans-serif;
font: normal 13px/28px "Helvetica Neue", sans-serif;
color: #ccc;
text-shadow: #444 0px -1px 0px;
}
@ -30,7 +30,7 @@
#wpadminbar {
direction: ltr;
color: #ccc;
font: normal 12px/28px "Helvetica Neue", sans-serif;
font: normal 13px/28px "Helvetica Neue", sans-serif;
height: 28px;
position: fixed;
top: 0;
@ -62,24 +62,35 @@
text-align: left;
}
#wpadminbar .quicklinks ul li {
#wpadminbar li {
float: left;
}
#wpadminbar .quicklinks > ul > li > a {
#wpadminbar .quicklinks > ul > li {
border-right: 1px solid #555;
}
#wpadminbar .quicklinks > ul > li > a {
border-right: 1px solid #333;
}
#wpadminbar .quicklinks > ul > li.opposite {
border-left: 1px solid #333;
border-right: 0;
}
#wpadminbar .quicklinks > ul > li.opposite > a {
border-left: 1px solid #555;
border-right: 0;
}
#wpadminbar .quicklinks > ul > li:last-child > a {
/*#wpadminbar .quicklinks > ul > li:last-child > a {
border-right: none;
}
}*/
#wpadminbar .quicklinks a,
#wpadminbar .shortlink-input {
height: 28px;
display: block;
padding: 0 0.85em;
padding: 0 1em;
margin: 0;
}
@ -89,16 +100,22 @@
#wpadminbar .quicklinks .menupop ul,
#wpadminbar .shortlink-input {
margin: 0 0 0 1px;
margin: 0 0 0 -1px;
padding: 6px 0;
-moz-box-shadow: 0 4px 8px rgba(0,0,0,0.2);
-webkit-box-shadow: 0 4px 8px rgba(0,0,0,0.2);
box-shadow: 0 4px 8px rgba(0,0,0,0.2);
-moz-box-shadow: 0 4px 6px rgba(0,0,0,0.2);
-webkit-box-shadow: 0 4px 6px rgba(0,0,0,0.2);
box-shadow: 0 4px 6px rgba(0,0,0,0.2);
background: #fff;
display: none;
position: absolute;
border-top: none;
float: none;
border-width: 0 1px 1px 1px;
border-style: solid;
border-color: #dfdfdf;
}
#wpadminbar .quicklinks .opposite.menupop ul {
right: 0;
margin: 0 -1px 0 0;
}
#wpadminbar .selected .shortlink-input {
@ -116,6 +133,10 @@
#wpadminbar .quicklinks .menupop ul li a,
#wpadminbar .quicklinks .menupop ul li a span,
#wpadminbar .quicklinks .menupop ul li a strong,
#wpadminbar .quicklinks .menupop.hover ul li a,
#wpadminbar .quicklinks .menupop.hover ul li a span,
#wpadminbar.nojs .quicklinks .menupop:hover ul li a,
#wpadminbar.nojs .quicklinks .menupop:hover ul li a span,
#wpadminbar .shortlink-input {
line-height: 26px;
height: 26px;
@ -129,7 +150,7 @@
width: 200px;
}
#wpadminbar.nojq .quicklinks li:hover > ul,
#wpadminbar.nojs .quicklinks li:hover > ul,
#wpadminbar .quicklinks li.hover > ul {
display: block;
}
@ -137,40 +158,99 @@
#wpadminbar .quicklinks .menupop li:hover > ul,
#wpadminbar .quicklinks .menupop li.hover > ul {
margin-left: 100%;
margin-top: -28px;
margin-top: -33px;
border-width: 1px;
}
#wpadminbar .quicklinks li:hover,
#wpadminbar .quicklinks .selected {
background-color: #fff;
#wpadminbar .quicklinks .opposite.menupop li:hover > ul,
#wpadminbar .quicklinks .opposite.menupop li.hover > ul {
margin-left: 0;
left: inherit;
right: 100%;
}
#wpadminbar .quicklinks li:hover a,
#wpadminbar .quicklinks .selected a,
#wpadminbar .quicklinks li:hover span,
#wpadminbar .quicklinks .selected span {
#wpadminbar .ab-top-menu > li:hover {
/* @todo: add other gradients */
background-image: -webkit-linear-gradient(bottom, #3a3a3a, #222); /* new Webkit */
}
#wpadminbar.nojs .ab-top-menu > li.menupop:hover,
#wpadminbar .ab-top-menu li.menupop.hover {
background: #fff;
}
#wpadminbar .ab-top-menu .selected.screen-meta-toggle {
background: #f1f1f1;
}
#wpadminbar.nojs .quicklinks .menupop:hover a,
#wpadminbar.nojs .quicklinks .menupop:hover span,
#wpadminbar .quicklinks .menupop.hover a,
#wpadminbar .quicklinks .menupop.hover span,
#wpadminbar .ab-top-menu .selected.screen-meta-toggle a,
#wpadminbar .ab-top-menu .selected.screen-meta-toggle span {
color: #333;
text-shadow: none;
}
#wpadminbar .quicklinks .menupop li:hover {
/* background: #888;
background: -moz-linear-gradient(bottom, #888, #9d9d9d);
background: -webkit-gradient(linear, left bottom, left top, from(#888), to(#9d9d9d));*/
background: #f8fbfe;
#wpadminbar .quicklinks .menupop li:hover,
#wpadminbar .quicklinks .menupop li.hover {
background-color: #eaf2fa;
}
#wpadminbar .quicklinks .menupop a > span {
display: inline;
background: url(../images/admin-bar-sprite.png?d=11122010) right -58px no-repeat;
padding-right: .8em;
#wpadminbar .ab-top-menu > .menupop > a span {
padding-right: 10px;
margin-right: -10px;
}
#wpadminbar .ab-top-menu > li > a:hover,
#wpadminbar .ab-top-menu > li > a:hover span {
color: #fafafa;
}
#wpadminbar .ab-top-menu > li > a:hover span {
background: url(../images/admin-bar-sprite.png?d=11122010) right -57px no-repeat;
}
#wpadminbar.nojs .ab-top-menu > li > a:hover span,
#wpadminbar .ab-top-menu > li.hover > a:hover span {
background: none;
}
#wpadminbar .quicklinks .menupop ul li a > span {
#wpadminbar .menupop li a > span {
display: block;
background: url(../images/admin-bar-sprite.png?d=11122010) right -29px no-repeat;
padding-right: 1.5em;
background: url(../images/admin-bar-sprite.png?d=11122010) right -31px no-repeat;
padding: 0 1.5em 0 0;
}
#wpadminbar .opposite.menupop li a > span {
background-position: -28px -31px;
padding: 0 0 0 1.5em;
}
#wpadminbar .quicklinks .menupop .secondary {
background: #eee;
margin: 6px 0 -6px;
border-top: 1px solid #dfdfdf;
}
#wpadminbar .quicklinks .menupop .secondary > a {
display: none;
}
#wpadminbar .quicklinks .menupop li.secondary > ul,
#wpadminbar .quicklinks .opposite.menupop li.secondary > ul {
display: block;
position: relative;
right: auto;
margin: 0;
border: 0;
-moz-box-shadow: none;
-webkit-box-shadow: none;
box-shadow: none;
background: #eee;
}
#wpadminbar .quicklinks .menupop li.secondary > ul > li:hover,
#wpadminbar .quicklinks .menupop li.secondary > ul > li.hover {
background: #dfdfdf;
}
#wpadminbar .quicklinks a span#ab-updates {
@ -192,20 +272,49 @@
color: #000;
}
#wpadminbar #wp-admin-bar-my-account,
#wpadminbar #wp-admin-bar-my-account-with-avatar {
#wpadminbar li.opposite {
float: right;
}
#wpadminbar .quicklinks li#wp-admin-bar-my-account > a {
border: none;
#wp-admin-bar-my-account > ul {
min-width: 270px;
}
#wpadminbar #wp-admin-bar-my-account .user-info-item {
margin-left: 88px;
margin-right: 16px;
}
#wpadminbar #wp-admin-bar-my-account .user-info-item > a {
padding-left: 8px;
}
#wpadminbar .quicklinks li#wp-admin-bar-my-account-with-avatar > a {
border: none;
#wpadminbar #wp-admin-bar-my-account .user-info {
margin-top: 6px;
margin-bottom: 15px;
height: auto;
background: none;
}
#wp-admin-bar-my-account .user-info .avatar {
position: absolute;
left: -72px;
top: 4px;
}
#wpadminbar #wp-admin-bar-my-account .user-info a {
height: auto;
}
#wpadminbar #wp-admin-bar-my-account .user-info span {
background: none;
padding: 0;
height: 18px;
}
#wpadminbar #wp-admin-bar-my-account .user-info .display-name {
color: #333;
}
#wpadminbar #wp-admin-bar-my-account .user-info .username {
color: #999;
font-size: 11px;
}
#wpadminbar .quicklinks li#wp-admin-bar-my-account-with-avatar > a img {
#wpadminbar .quicklinks li#wp-admin-bar-my-account.with-avatar > a img {
width: 16px;
height: 16px;
border: 1px solid #999;
@ -216,43 +325,39 @@
margin: -2px 0 0 6px;
}
#wpadminbar .quicklinks li#wp-admin-bar-my-account-with-avatar ul ul {
left: 0;
}
#wpadminbar .quicklinks li img.blavatar {
vertical-align: middle;
margin: -3px 4px 0 0;
padding: 0;
}
#wpadminbar #wp-admin-bar-search {
border-right: 0;
}
#wpadminbar #wp-admin-bar-search a {
padding: 0;
border-right: 0;
}
#wpadminbar .quicklinks .admin-bar-search:hover {
/* default background */
background: transparent;
}
#wpadminbar .quicklinks .admin-bar-search:hover > a {
/* default borders */
border-right: none;
border-left: 1px solid #333;
}
#wpadminbar #adminbarsearch {
float: right;
height: 26px;
height: 24px;
padding: 2px 4px;
/* padding: 0;*/
margin: 0;
}
#wpadminbar #adminbarsearch .adminbar-input {
height: 23px;
width: 140px;
float: left;
font: 12px "Helvetica Neue", sans-serif;
font: 13px "Helvetica Neue", sans-serif;
border: none;
padding: 0 3px 0 24px;
margin: 0 3px 0 0;
@ -333,15 +438,17 @@
* WP Logo item
*/
#wpadminbar .wp-admin-bar-logo {
background: url(../images/wp-logo-white.png) no-repeat 8px 6px;
}
#wpadminbar .wp-admin-bar-logo > a {
padding-left: 22px;
padding-left: 24px;
background: url(../images/wp-logo-white.png) no-repeat 13px 6px;
}
#wpadminbar .wp-admin-bar-logo > a span {
height: 28px;
}
#wpadminbar .wp-admin-bar-logo:hover {
background: url(../images/wp-logo-dark.png) no-repeat 8px 6px;
#wpadminbar.nojs .wp-admin-bar-logo:hover > a,
#wpadminbar .wp-admin-bar-logo.hover > a {
background: url(../images/wp-logo-dark.png) no-repeat 12px 6px;
}
/**

View File

@ -4,7 +4,7 @@ if ( typeof(jQuery) != 'undefined' ) {
(function(a){a.fn.hoverIntent=function(l,j){var m={sensitivity:7,interval:100,timeout:0};m=a.extend(m,j?{over:l,out:j}:l);var o,n,h,d;var e=function(f){o=f.pageX;n=f.pageY};var c=function(g,f){f.hoverIntent_t=clearTimeout(f.hoverIntent_t);if((Math.abs(h-o)+Math.abs(d-n))<m.sensitivity){a(f).unbind("mousemove",e);f.hoverIntent_s=1;return m.over.apply(f,[g])}else{h=o;d=n;f.hoverIntent_t=setTimeout(function(){c(g,f)},m.interval)}};var i=function(g,f){f.hoverIntent_t=clearTimeout(f.hoverIntent_t);f.hoverIntent_s=0;return m.out.apply(f,[g])};var b=function(q){var f=this;var g=(q.type=="mouseover"?q.fromElement:q.toElement)||q.relatedTarget;while(g&&g!=this){try{g=g.parentNode}catch(q){g=this}}if(g==this){if(a.browser.mozilla){if(q.type=="mouseout"){f.mtout=setTimeout(function(){k(q,f)},30)}else{if(f.mtout){f.mtout=clearTimeout(f.mtout)}}}return}else{if(f.mtout){f.mtout=clearTimeout(f.mtout)}k(q,f)}};var k=function(p,f){var g=jQuery.extend({},p);if(f.hoverIntent_t){f.hoverIntent_t=clearTimeout(f.hoverIntent_t)}if(p.type=="mouseover"){h=g.pageX;d=g.pageY;a(f).bind("mousemove",e);if(f.hoverIntent_s!=1){f.hoverIntent_t=setTimeout(function(){c(g,f)},m.interval)}}else{a(f).unbind("mousemove",e);if(f.hoverIntent_s==1){f.hoverIntent_t=setTimeout(function(){i(g,f)},m.timeout)}}};return this.mouseover(b).mouseout(b)}})(jQuery);
jQuery(document).ready(function($){
$('#wpadminbar').removeClass('nojq').find('li.menupop').hoverIntent({
$('#wpadminbar').removeClass('nojq').removeClass('nojs').find('li.menupop').hoverIntent({
over: function(e){
$(this).addClass('hover');
},
@ -31,10 +31,10 @@ if ( typeof(jQuery) != 'undefined' ) {
else if (obj.attachEvent)
obj.attachEvent('on' + type, function() { return fn.call(obj, window.event);});
},
aB, hc = new RegExp('\\bhover\\b', 'g'), q = [],
rselected = new RegExp('\\bselected\\b', 'g'),
/**
* Get the timeout ID of the given element
*/
@ -45,12 +45,12 @@ if ( typeof(jQuery) != 'undefined' ) {
return q[i][0];
return false;
},
addHoverClass = function(t) {
var i, id, inA, hovering, ul, li,
ancestors = [],
ancestorLength = 0;
while ( t && t != aB && t != d ) {
if( 'LI' == t.nodeName.toUpperCase() ) {
ancestors[ ancestors.length ] = t;
@ -62,7 +62,7 @@ if ( typeof(jQuery) != 'undefined' ) {
}
t = t.parentNode;
}
// Remove any selected classes.
if ( hovering && hovering.parentNode ) {
ul = hovering.parentNode;
@ -75,7 +75,7 @@ if ( typeof(jQuery) != 'undefined' ) {
}
}
}
/* remove the hover class for any objects not in the immediate element's ancestry */
i = q.length;
while ( i-- ) {
@ -85,12 +85,12 @@ if ( typeof(jQuery) != 'undefined' ) {
if ( ancestors[ ancestorLength ] == q[i][1] )
inA = true;
}
if ( ! inA )
q[i][1].className = q[i][1].className ? q[i][1].className.replace(hc, '') : '';
}
},
removeHoverClass = function(t) {
while ( t && t != aB && t != d ) {
if( 'LI' == t.nodeName.toUpperCase() ) {
@ -104,11 +104,11 @@ if ( typeof(jQuery) != 'undefined' ) {
t = t.parentNode;
}
},
clickShortlink = function(e) {
var i, l, node,
t = e.target || e.srcElement;
// Make t the shortlink menu item, or return.
while ( true ) {
// Check if we've gone past the shortlink node,
@ -120,15 +120,15 @@ if ( typeof(jQuery) != 'undefined' ) {
break;
t = t.parentNode;
}
// IE doesn't support preventDefault, and does support returnValue
if ( e.preventDefault )
e.preventDefault();
e.returnValue = false;
if ( -1 == t.className.indexOf('selected') )
t.className += ' selected';
for ( i = 0, l = t.childNodes.length; i < l; i++ ) {
node = t.childNodes[i];
if ( node.className && -1 != node.className.indexOf('shortlink-input') ) {
@ -142,24 +142,27 @@ if ( typeof(jQuery) != 'undefined' ) {
}
return false;
};
addEvent(w, 'load', function() {
aB = d.getElementById('wpadminbar');
if ( d.body && aB ) {
d.body.appendChild( aB );
if ( aB.className )
aB.className = aB.className.replace(/nojs/, '');
addEvent(aB, 'mouseover', function(e) {
addHoverClass( e.target || e.srcElement );
});
addEvent(aB, 'mouseout', function(e) {
removeHoverClass( e.target || e.srcElement );
});
addEvent(aB, 'click', clickShortlink );
}
if ( w.location.hash )
w.scrollBy(0,-32);
});

View File

@ -1 +1 @@
if(typeof(jQuery)!="undefined"){if(typeof(jQuery.fn.hoverIntent)=="undefined"){(function(a){a.fn.hoverIntent=function(l,j){var m={sensitivity:7,interval:100,timeout:0};m=a.extend(m,j?{over:l,out:j}:l);var o,n,h,d;var e=function(f){o=f.pageX;n=f.pageY};var c=function(g,f){f.hoverIntent_t=clearTimeout(f.hoverIntent_t);if((Math.abs(h-o)+Math.abs(d-n))<m.sensitivity){a(f).unbind("mousemove",e);f.hoverIntent_s=1;return m.over.apply(f,[g])}else{h=o;d=n;f.hoverIntent_t=setTimeout(function(){c(g,f)},m.interval)}};var i=function(g,f){f.hoverIntent_t=clearTimeout(f.hoverIntent_t);f.hoverIntent_s=0;return m.out.apply(f,[g])};var b=function(q){var f=this;var g=(q.type=="mouseover"?q.fromElement:q.toElement)||q.relatedTarget;while(g&&g!=this){try{g=g.parentNode}catch(q){g=this}}if(g==this){if(a.browser.mozilla){if(q.type=="mouseout"){f.mtout=setTimeout(function(){k(q,f)},30)}else{if(f.mtout){f.mtout=clearTimeout(f.mtout)}}}return}else{if(f.mtout){f.mtout=clearTimeout(f.mtout)}k(q,f)}};var k=function(p,f){var g=jQuery.extend({},p);if(f.hoverIntent_t){f.hoverIntent_t=clearTimeout(f.hoverIntent_t)}if(p.type=="mouseover"){h=g.pageX;d=g.pageY;a(f).bind("mousemove",e);if(f.hoverIntent_s!=1){f.hoverIntent_t=setTimeout(function(){c(g,f)},m.interval)}}else{a(f).unbind("mousemove",e);if(f.hoverIntent_s==1){f.hoverIntent_t=setTimeout(function(){i(g,f)},m.timeout)}}};return this.mouseover(b).mouseout(b)}})(jQuery);}jQuery(document).ready(function(a){a("#wpadminbar").removeClass("nojq").find("li.menupop").hoverIntent({over:function(b){a(this).addClass("hover")},out:function(b){a(this).removeClass("hover")},timeout:200,sensitivity:7,interval:120});a("#wp-admin-bar-get-shortlink").click(function(b){b.preventDefault();a(this).addClass("selected").children(".shortlink-input").blur(function(){a(this).parents("#wp-admin-bar-get-shortlink").removeClass("selected")}).focus().select()})})}else{(function(i,k){var c=function(n,m,d){if(n.addEventListener){n.addEventListener(m,d,false)}else{if(n.attachEvent){n.attachEvent("on"+m,function(){return d.call(n,window.event)})}}},e,f=new RegExp("\\bhover\\b","g"),a=[],j=new RegExp("\\bselected\\b","g"),g=function(m){var d=a.length;while(d--){if(a[d]&&m==a[d][1]){return a[d][0]}}return false},h=function(s){var n,d,q,m,p,r,u=[],o=0;while(s&&s!=e&&s!=i){if("LI"==s.nodeName.toUpperCase()){u[u.length]=s;d=g(s);if(d){clearTimeout(d)}s.className=s.className?(s.className.replace(f,"")+" hover"):"hover";m=s}s=s.parentNode}if(m&&m.parentNode){p=m.parentNode;if(p&&"UL"==p.nodeName.toUpperCase()){n=p.childNodes.length;while(n--){r=p.childNodes[n];if(r!=m){r.className=r.className?r.className.replace(j,""):""}}}}n=a.length;while(n--){q=false;o=u.length;while(o--){if(u[o]==a[n][1]){q=true}}if(!q){a[n][1].className=a[n][1].className?a[n][1].className.replace(f,""):""}}},l=function(d){while(d&&d!=e&&d!=i){if("LI"==d.nodeName.toUpperCase()){(function(m){var n=setTimeout(function(){m.className=m.className?m.className.replace(f,""):""},500);a[a.length]=[n,m]})(d)}d=d.parentNode}},b=function(p){var n,d,o,m=p.target||p.srcElement;while(true){if(!m||m==i||m==e){return}if(m.id&&m.id=="wp-admin-bar-get-shortlink"){break}m=m.parentNode}if(p.preventDefault){p.preventDefault()}p.returnValue=false;if(-1==m.className.indexOf("selected")){m.className+=" selected"}for(n=0,d=m.childNodes.length;n<d;n++){o=m.childNodes[n];if(o.className&&-1!=o.className.indexOf("shortlink-input")){o.focus();o.select();o.onblur=function(){m.className=m.className?m.className.replace(j,""):""};break}}return false};c(k,"load",function(){e=i.getElementById("wpadminbar");if(i.body&&e){i.body.appendChild(e);c(e,"mouseover",function(d){h(d.target||d.srcElement)});c(e,"mouseout",function(d){l(d.target||d.srcElement)});c(e,"click",b)}if(k.location.hash){k.scrollBy(0,-32)}})})(document,window)};
if(typeof(jQuery)!="undefined"){if(typeof(jQuery.fn.hoverIntent)=="undefined"){(function(b){b.fn.hoverIntent=function(p,r){var g={sensitivity:7,interval:100,timeout:0};g=b.extend(g,r?{over:p,out:r}:p);var a,f,t,v;var u=function(c){a=c.pageX;f=c.pageY};var w=function(c,d){d.hoverIntent_t=clearTimeout(d.hoverIntent_t);if((Math.abs(t-a)+Math.abs(v-f))<g.sensitivity){b(d).unbind("mousemove",u);d.hoverIntent_s=1;return g.over.apply(d,[c])}else{t=a;v=f;d.hoverIntent_t=setTimeout(function(){w(c,d)},g.interval)}};var s=function(c,d){d.hoverIntent_t=clearTimeout(d.hoverIntent_t);d.hoverIntent_s=0;return g.out.apply(d,[c])};var x=function(e){var d=this;var c=(e.type=="mouseover"?e.fromElement:e.toElement)||e.relatedTarget;while(c&&c!=this){try{c=c.parentNode}catch(e){c=this}}if(c==this){if(b.browser.mozilla){if(e.type=="mouseout"){d.mtout=setTimeout(function(){q(e,d)},30)}else{if(d.mtout){d.mtout=clearTimeout(d.mtout)}}}return}else{if(d.mtout){d.mtout=clearTimeout(d.mtout)}q(e,d)}};var q=function(e,d){var c=jQuery.extend({},e);if(d.hoverIntent_t){d.hoverIntent_t=clearTimeout(d.hoverIntent_t)}if(e.type=="mouseover"){t=c.pageX;v=c.pageY;b(d).bind("mousemove",u);if(d.hoverIntent_s!=1){d.hoverIntent_t=setTimeout(function(){w(c,d)},g.interval)}}else{b(d).unbind("mousemove",u);if(d.hoverIntent_s==1){d.hoverIntent_t=setTimeout(function(){s(c,d)},g.timeout)}}};return this.mouseover(x).mouseout(x)}})(jQuery)}jQuery(document).ready(function(a){a("#wpadminbar").removeClass("nojq").removeClass("nojs").find("li.menupop").hoverIntent({over:function(b){a(this).addClass("hover")},out:function(b){a(this).removeClass("hover")},timeout:200,sensitivity:7,interval:120});a("#wp-admin-bar-get-shortlink").click(function(b){b.preventDefault();a(this).addClass("selected").children(".shortlink-input").blur(function(){a(this).parents("#wp-admin-bar-get-shortlink").removeClass("selected")}).focus().select()})})}else{(function(i,k){var c=function(n,m,d){if(n.addEventListener){n.addEventListener(m,d,false)}else{if(n.attachEvent){n.attachEvent("on"+m,function(){return d.call(n,window.event)})}}},e,f=new RegExp("\\bhover\\b","g"),a=[],j=new RegExp("\\bselected\\b","g"),g=function(m){var d=a.length;while(d--){if(a[d]&&m==a[d][1]){return a[d][0]}}return false},h=function(s){var n,d,q,m,p,r,u=[],o=0;while(s&&s!=e&&s!=i){if("LI"==s.nodeName.toUpperCase()){u[u.length]=s;d=g(s);if(d){clearTimeout(d)}s.className=s.className?(s.className.replace(f,"")+" hover"):"hover";m=s}s=s.parentNode}if(m&&m.parentNode){p=m.parentNode;if(p&&"UL"==p.nodeName.toUpperCase()){n=p.childNodes.length;while(n--){r=p.childNodes[n];if(r!=m){r.className=r.className?r.className.replace(j,""):""}}}}n=a.length;while(n--){q=false;o=u.length;while(o--){if(u[o]==a[n][1]){q=true}}if(!q){a[n][1].className=a[n][1].className?a[n][1].className.replace(f,""):""}}},l=function(d){while(d&&d!=e&&d!=i){if("LI"==d.nodeName.toUpperCase()){(function(m){var n=setTimeout(function(){m.className=m.className?m.className.replace(f,""):""},500);a[a.length]=[n,m]})(d)}d=d.parentNode}},b=function(p){var n,d,o,m=p.target||p.srcElement;while(true){if(!m||m==i||m==e){return}if(m.id&&m.id=="wp-admin-bar-get-shortlink"){break}m=m.parentNode}if(p.preventDefault){p.preventDefault()}p.returnValue=false;if(-1==m.className.indexOf("selected")){m.className+=" selected"}for(n=0,d=m.childNodes.length;n<d;n++){o=m.childNodes[n];if(o.className&&-1!=o.className.indexOf("shortlink-input")){o.focus();o.select();o.onblur=function(){m.className=m.className?m.className.replace(j,""):""};break}}return false};c(k,"load",function(){e=i.getElementById("wpadminbar");if(i.body&&e){i.body.appendChild(e);if(e.className){e.className=e.className.replace(/nojs/,"")}c(e,"mouseover",function(d){h(d.target||d.srcElement)});c(e,"mouseout",function(d){l(d.target||d.srcElement)});c(e,"click",b)}if(k.location.hash){k.scrollBy(0,-32)}})})(document,window)};

View File

@ -258,7 +258,7 @@ function wp_default_scripts( &$scripts ) {
$scripts->add( 'user-profile', "/wp-admin/js/user-profile$suffix.js", array( 'jquery', 'password-strength-meter' ), '20110628', 1 );
$scripts->add( 'admin-bar', "/wp-includes/js/admin-bar$suffix.js", false, '20110801' );
$scripts->add( 'admin-bar', "/wp-includes/js/admin-bar$suffix.js", false, '20110925' );
$scripts->add_data( 'admin-bar', 'group', 1 );
$scripts->add( 'wplink', "/wp-includes/js/wplink$suffix.js", array( 'jquery', 'wpdialogs' ), '20110802', 1 );
@ -450,7 +450,7 @@ function wp_default_styles( &$styles ) {
$styles->add( 'farbtastic', '/wp-admin/css/farbtastic.css', array(), '1.3u1' );
$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( 'admin-bar', "/wp-includes/css/admin-bar$suffix.css", array(), '20110916b' );
$styles->add( 'admin-bar', "/wp-includes/css/admin-bar$suffix.css", array(), '20110925' );
$styles->add( 'wp-jquery-ui-dialog', "/wp-includes/css/jquery-ui-dialog$suffix.css", array(), '20101224' );
$styles->add( 'editor-buttons', "/wp-includes/css/editor-buttons$suffix.css", array(), '20110802' );
$styles->add( 'wp-pointer', "/wp-includes/css/wp-pointer$suffix.css", array(), '20110918' );