WordPress.org

Make WordPress Core

Changeset 16274


Ignore:
Timestamp:
11/10/10 16:19:55 (3 years ago)
Author:
ryan
Message:

Admin bar hover fixes. Props filosofo. see #15307

Location:
trunk/wp-includes
Files:
3 edited

Legend:

Unmodified
Added
Removed
  • trunk/wp-includes/js/admin-bar.dev.js

    r16074 r16274  
    99    aB, hc = new RegExp('\\bhover\\b', 'g'), q = [], 
    1010 
     11    /** 
     12     * Get the timeout ID of the given element 
     13     */ 
    1114    getTOID = function(el) { 
    1215        var i = q.length; 
     
    1821 
    1922    addClass = function(t) { 
     23        var ancestors = [], 
     24        ancestorLength = 0, 
     25        id, 
     26        i = q.length, 
     27        inA; 
    2028        while ( t && t != aB && t != d ) { 
    2129            if( 'LI' == t.nodeName.toUpperCase() ) { 
    22                 var id = getTOID(t);     
     30                ancestors[ ancestors.length ] = t; 
     31                id = getTOID(t);     
    2332                if ( id ) 
    2433                    clearTimeout( id ); 
     
    2635            } 
    2736            t = t.parentNode; 
     37        } 
     38         
     39        /* remove the hover class for any objects not in the immediate element's ancestry */ 
     40        while ( i-- ) { 
     41            inA = false;     
     42            ancestorLength = ancestors.length; 
     43            while( ancestorLength-- ) { 
     44                if ( ancestors[ ancestorLength ] == q[i][1] )  
     45                    inA = true;  
     46            } 
     47 
     48            if ( ! inA ) 
     49                q[i][1].className = q[i][1].className ? q[i][1].className.replace(hc, '') : ''; 
    2850        } 
    2951    }, 
  • trunk/wp-includes/js/admin-bar.js

    r16074 r16274  
    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); 
     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(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); 
  • trunk/wp-includes/script-loader.php

    r16248 r16274  
    500500     
    501501    // Admin bar 
    502     $styles->add( 'admin-bar', "/wp-includes/css/admin-bar$suffix.css", array(), '20101029' ); 
     502    $styles->add( 'admin-bar', "/wp-includes/css/admin-bar$suffix.css", array(), '20101110' ); 
    503503 
    504504    foreach ( $rtl_styles as $rtl_style ) { 
Note: See TracChangeset for help on using the changeset viewer.