Admin bar shortlink improvements. props koopersmith, fixes #16155.

git-svn-id: http://svn.automattic.com/wordpress/trunk@17265 1a063a9b-81f0-0310-95a4-ce76da25c4cd
This commit is contained in:
nacin 2011-01-12 00:32:00 +00:00
parent f9cdc3156d
commit 84369f43f9
5 changed files with 20 additions and 15 deletions

File diff suppressed because one or more lines are too long

View File

@ -117,6 +117,10 @@
width: 160px;
}
#wpadminbar .shortlink-input {
width: 200px;
}
#wpadminbar .quicklinks .menupop ul li:hover > a {
color: #fff;
text-shadow: #666 0px -1px 0px;

View File

@ -38,13 +38,15 @@
}
// Remove any selected classes.
ul = hovering.parentNode;
if ( ul && 'UL' == ul.nodeName.toUpperCase() ) {
i = ul.childNodes.length;
while ( i-- ) {
li = ul.childNodes[i];
if ( li != hovering )
li.className = li.className ? li.className.replace( rselected, '' ) : '';
if ( hovering ) {
ul = hovering.parentNode;
if ( ul && 'UL' == ul.nodeName.toUpperCase() ) {
i = ul.childNodes.length;
while ( i-- ) {
li = ul.childNodes[i];
if ( li != hovering )
li.className = li.className ? li.className.replace( rselected, '' ) : '';
}
}
}
@ -78,15 +80,14 @@
},
clickShortlink = function(e) {
var i, l, node, className,
t = e.target || e.srcElement,
shortlink = t.href;
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,
// or if the user is clicking on the input.
if ( ! t || t == d || t == aB || -1 != t.className.indexOf('shortlink-input') )
if ( ! t || t == d || t == aB )
return;
// Check if we've found the shortlink node.
if ( t.className && -1 != t.className.indexOf('ab-get-shortlink') )

View File

@ -1 +1 @@
(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}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(r){var n,d,q,o,m=r.target||r.srcElement,p=m.href;while(true){if(!m||m==i||m==e||-1!=m.className.indexOf("shortlink-input")){return}if(m.className&&-1!=m.className.indexOf("ab-get-shortlink")){break}m=m.parentNode}if(r.preventDefault){r.preventDefault()}r.returnValue=false;if(-1==m.className.indexOf("selected")){m.className+=" selected"}for(n=0,d=m.childNodes.length;n<d;n++){q=m.childNodes[n];if(q.className&&-1!=q.className.indexOf("shortlink-input")){q.focus();q.select();q.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);
(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){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.className&&-1!=m.className.indexOf("ab-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);

View File

@ -262,7 +262,7 @@ function wp_default_scripts( &$scripts ) {
$scripts->add( 'user-profile', "/wp-admin/js/user-profile$suffix.js", array( 'jquery', 'password-strength-meter' ), '20100925' );
$scripts->add_data( 'user-profile', 'group', 1 );
$scripts->add( 'admin-bar', "/wp-includes/js/admin-bar$suffix.js", false, '20110111');
$scripts->add( 'admin-bar', "/wp-includes/js/admin-bar$suffix.js", false, '20110111a' );
$scripts->add_data( 'admin-bar', 'group', 1 );
$scripts->localize( 'admin-bar', 'adminBarL10n', array(
'l10n_print_after' => 'try{convertEntities(adminBarL10n);}catch(e){};',
@ -513,7 +513,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(), '20110111' );
$styles->add( 'admin-bar', "/wp-includes/css/admin-bar$suffix.css", array(), '20110111a' );
$styles->add( 'wp-jquery-ui-dialog', "/wp-includes/css/jquery-ui-dialog$suffix.css", array(), '20101224' );
$styles->add( 'wplink', "/wp-includes/js/tinymce/plugins/wplink/css/wplink$suffix.css", array(), '20101224' );