Admin bar hover fixes. Props filosofo. see #15307

git-svn-id: http://svn.automattic.com/wordpress/trunk@16274 1a063a9b-81f0-0310-95a4-ce76da25c4cd
This commit is contained in:
ryan 2010-11-10 16:19:55 +00:00
parent 795ab6d0f3
commit 6764a0c3fa
3 changed files with 25 additions and 3 deletions

View File

@ -8,6 +8,9 @@
aB, hc = new RegExp('\\bhover\\b', 'g'), q = [],
/**
* Get the timeout ID of the given element
*/
getTOID = function(el) {
var i = q.length;
while( i-- )
@ -17,15 +20,34 @@
},
addClass = function(t) {
var ancestors = [],
ancestorLength = 0,
id,
i = q.length,
inA;
while ( t && t != aB && t != d ) {
if( 'LI' == t.nodeName.toUpperCase() ) {
var id = getTOID(t);
ancestors[ ancestors.length ] = t;
id = getTOID(t);
if ( id )
clearTimeout( id );
t.className = t.className ? ( t.className.replace(hc, '') + ' hover' ) : 'hover';
}
t = t.parentNode;
}
/* remove the hover class for any objects not in the immediate element's ancestry */
while ( i-- ) {
inA = false;
ancestorLength = ancestors.length;
while( ancestorLength-- ) {
if ( ancestors[ ancestorLength ] == q[i][1] )
inA = true;
}
if ( ! inA )
q[i][1].className = q[i][1].className ? q[i][1].className.replace(hc, '') : '';
}
},
removeClass = function(t) {

View File

@ -1 +1 @@
(function(i,j){var c=function(m,l,d){if(m.addEventListener){m.addEventListener(l,d,false)}else{if(m.attachEvent){m.attachEvent("on"+l,function(){return d.call(m,window.event)})}}},e,f=new RegExp("\\bhover\\b","g"),a=[],g=function(l){var d=a.length;while(d--){if(a[d]&&l==a[d][1]){return a[d][0]}}return false},h=function(d){while(d&&d!=e&&d!=i){if("LI"==d.nodeName.toUpperCase()){var l=g(d);if(l){clearTimeout(l)}d.className=d.className?(d.className.replace(f,"")+" hover"):"hover"}d=d.parentNode}},k=function(d){while(d&&d!=e&&d!=i){if("LI"==d.nodeName.toUpperCase()){(function(l){var m=setTimeout(function(){l.className=l.className?l.className.replace(f,""):""},500);a[a.length]=[m,l]})(d)}d=d.parentNode}},b=function(n){var m=n.target||n.srcElement,d,l;if("undefined"==typeof adminBarL10n){return}while(m&&m!=e&&m!=i&&(!m.className||-1==m.className.indexOf("ab-get-shortlink"))){m=m.parentNode}if(m&&m.className&&-1!=m.className.indexOf("ab-get-shortlink")){d=i.getElementsByTagName("link");if(!d.length){d=i.links}l=d.length;if(n.preventDefault){n.preventDefault()}n.returnValue=false;while(l--){if(d[l]&&"shortlink"==d[l].getAttribute("rel")){prompt(adminBarL10n.url,d[l].href);return false}}alert(adminBarL10n.noShortlink);return false}};c(j,"load",function(){var d=i.getElementsByTagName("body")[0],l=i.getElementById("adminbar-search");e=i.getElementById("wpadminbar");if(d&&e){d.appendChild(e);c(e,"mouseover",function(m){h(m.target||m.srcElement)});c(e,"mouseout",function(m){k(m.target||m.srcElement)});c(e,"click",b)}if(l){if(""==l.value){l.value=l.getAttribute("title")}l.onblur=function(){this.value=""==this.value?this.getAttribute("title"):this.value};l.onfocus=function(){this.value=this.getAttribute("title")==this.value?"":this.value}}if(j.location.hash){j.scrollBy(0,-32)}})})(document,window);
(function(i,j){var c=function(m,l,d){if(m.addEventListener){m.addEventListener(l,d,false)}else{if(m.attachEvent){m.attachEvent("on"+l,function(){return d.call(m,window.event)})}}},e,f=new RegExp("\\bhover\\b","g"),a=[],g=function(l){var d=a.length;while(d--){if(a[d]&&l==a[d][1]){return a[d][0]}}return false},h=function(l){var m=[],p=0,o,d=a.length,n;while(l&&l!=e&&l!=i){if("LI"==l.nodeName.toUpperCase()){m[m.length]=l;o=g(l);if(o){clearTimeout(o)}l.className=l.className?(l.className.replace(f,"")+" hover"):"hover"}l=l.parentNode}while(d--){n=false;p=m.length;while(p--){if(m[p]==a[d][1]){n=true}}if(!n){a[d][1].className=a[d][1].className?a[d][1].className.replace(f,""):""}}},k=function(d){while(d&&d!=e&&d!=i){if("LI"==d.nodeName.toUpperCase()){(function(l){var m=setTimeout(function(){l.className=l.className?l.className.replace(f,""):""},500);a[a.length]=[m,l]})(d)}d=d.parentNode}},b=function(n){var m=n.target||n.srcElement,d,l;if("undefined"==typeof adminBarL10n){return}while(m&&m!=e&&m!=i&&(!m.className||-1==m.className.indexOf("ab-get-shortlink"))){m=m.parentNode}if(m&&m.className&&-1!=m.className.indexOf("ab-get-shortlink")){d=i.getElementsByTagName("link");if(!d.length){d=i.links}l=d.length;if(n.preventDefault){n.preventDefault()}n.returnValue=false;while(l--){if(d[l]&&"shortlink"==d[l].getAttribute("rel")){prompt(adminBarL10n.url,d[l].href);return false}}alert(adminBarL10n.noShortlink);return false}};c(j,"load",function(){var d=i.getElementsByTagName("body")[0],l=i.getElementById("adminbar-search");e=i.getElementById("wpadminbar");if(d&&e){d.appendChild(e);c(e,"mouseover",function(m){h(m.target||m.srcElement)});c(e,"mouseout",function(m){k(m.target||m.srcElement)});c(e,"click",b)}if(l){if(""==l.value){l.value=l.getAttribute("title")}l.onblur=function(){this.value=""==this.value?this.getAttribute("title"):this.value};l.onfocus=function(){this.value=this.getAttribute("title")==this.value?"":this.value}}if(j.location.hash){j.scrollBy(0,-32)}})})(document,window);

View File

@ -499,7 +499,7 @@ function wp_default_styles( &$styles ) {
$styles->add( 'nav-menu', "/wp-admin/css/nav-menu$suffix.css", array(), '20100907' );
// Admin bar
$styles->add( 'admin-bar', "/wp-includes/css/admin-bar$suffix.css", array(), '20101029' );
$styles->add( 'admin-bar', "/wp-includes/css/admin-bar$suffix.css", array(), '20101110' );
foreach ( $rtl_styles as $rtl_style ) {
$styles->add_data( $rtl_style, 'rtl', true );