Ticket #25970: 25970.diff
File 25970.diff, 2.5 KB (added by , 12 years ago) |
---|
-
src/wp-includes/js/admin-bar.js
1 /* jshint loopfunc: true */ 1 2 // use jQuery and hoverIntent if loaded 2 3 if ( typeof(jQuery) != 'undefined' ) { 3 4 if ( typeof(jQuery.fn.hoverIntent) == 'undefined' ) { 5 /* jshint ignore:start */ 4 6 // hoverIntent r6 - Copy of wp-includes/js/hoverIntent.min.js 5 7 (function(a){a.fn.hoverIntent=function(m,d,h){var j={interval:100,sensitivity:7,timeout:0};if(typeof m==="object"){j=a.extend(j,m)}else{if(a.isFunction(d)){j=a.extend(j,{over:m,out:d,selector:h})}else{j=a.extend(j,{over:m,out:m,selector:d})}}var l,k,g,f;var e=function(n){l=n.pageX;k=n.pageY};var c=function(o,n){n.hoverIntent_t=clearTimeout(n.hoverIntent_t);if((Math.abs(g-l)+Math.abs(f-k))<j.sensitivity){a(n).off("mousemove.hoverIntent",e);n.hoverIntent_s=1;return j.over.apply(n,[o])}else{g=l;f=k;n.hoverIntent_t=setTimeout(function(){c(o,n)},j.interval)}};var i=function(o,n){n.hoverIntent_t=clearTimeout(n.hoverIntent_t);n.hoverIntent_s=0;return j.out.apply(n,[o])};var b=function(p){var o=jQuery.extend({},p);var n=this;if(n.hoverIntent_t){n.hoverIntent_t=clearTimeout(n.hoverIntent_t)}if(p.type=="mouseenter"){g=o.pageX;f=o.pageY;a(n).on("mousemove.hoverIntent",e);if(n.hoverIntent_s!=1){n.hoverIntent_t=setTimeout(function(){c(o,n)},j.interval)}}else{a(n).off("mousemove.hoverIntent",e);if(n.hoverIntent_s==1){n.hoverIntent_t=setTimeout(function(){i(o,n)},j.timeout)}}};return this.on({"mouseenter.hoverIntent":b,"mouseleave.hoverIntent":b},j.selector)}})(jQuery); 8 /* jshint ignore:end */ 6 9 } 7 10 jQuery(document).ready(function($){ 8 11 var adminbar = $('#wpadminbar'), refresh, touchOpen, touchClose, disableHoverIntent = false; … … 53 56 } 54 57 55 58 adminbar.find('li.menupop').hoverIntent({ 56 over: function( e){59 over: function() { 57 60 if ( disableHoverIntent ) 58 61 return; 59 62 60 63 $(this).addClass('hover'); 61 64 }, 62 out: function( e){65 out: function() { 63 66 if ( disableHoverIntent ) 64 67 return; 65 68 … … 120 123 121 124 // fix focus bug in WebKit 122 125 $('.screen-reader-shortcut').keydown( function(e) { 126 var id, ua; 127 123 128 if ( 13 != e.which ) 124 129 return; 125 130 126 var id = $(this).attr('href');131 id = $( this ).attr( 'href' ); 127 132 128 var ua = navigator.userAgent.toLowerCase(); 133 ua = navigator.userAgent.toLowerCase(); 134 129 135 if ( ua.indexOf('applewebkit') != -1 && id && id.charAt(0) == '#' ) { 130 136 setTimeout(function () { 131 137 $(id).focus();