Fix JSHint errors in admin-bar.js.

props kadamwhite.
fixes #25970.


git-svn-id: https://develop.svn.wordpress.org/trunk@26160 602fd350-edb4-49c9-b593-d223f7449a82
This commit is contained in:
Andrew Nacin 2013-11-14 05:50:40 +00:00
parent c0207f3bfb
commit 6e585ecd0c
1 changed files with 10 additions and 4 deletions

View File

@ -1,8 +1,11 @@
/* jshint loopfunc: true */
// use jQuery and hoverIntent if loaded // use jQuery and hoverIntent if loaded
if ( typeof(jQuery) != 'undefined' ) { if ( typeof(jQuery) != 'undefined' ) {
if ( typeof(jQuery.fn.hoverIntent) == 'undefined' ) { if ( typeof(jQuery.fn.hoverIntent) == 'undefined' ) {
/* jshint ignore:start */
// hoverIntent r6 - Copy of wp-includes/js/hoverIntent.min.js // hoverIntent r6 - Copy of wp-includes/js/hoverIntent.min.js
(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); (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);
/* jshint ignore:end */
} }
jQuery(document).ready(function($){ jQuery(document).ready(function($){
var adminbar = $('#wpadminbar'), refresh, touchOpen, touchClose, disableHoverIntent = false; var adminbar = $('#wpadminbar'), refresh, touchOpen, touchClose, disableHoverIntent = false;
@ -53,13 +56,13 @@ if ( typeof(jQuery) != 'undefined' ) {
} }
adminbar.find('li.menupop').hoverIntent({ adminbar.find('li.menupop').hoverIntent({
over: function(e){ over: function() {
if ( disableHoverIntent ) if ( disableHoverIntent )
return; return;
$(this).addClass('hover'); $(this).addClass('hover');
}, },
out: function(e){ out: function() {
if ( disableHoverIntent ) if ( disableHoverIntent )
return; return;
@ -120,12 +123,15 @@ if ( typeof(jQuery) != 'undefined' ) {
// fix focus bug in WebKit // fix focus bug in WebKit
$('.screen-reader-shortcut').keydown( function(e) { $('.screen-reader-shortcut').keydown( function(e) {
var id, ua;
if ( 13 != e.which ) if ( 13 != e.which )
return; return;
var id = $(this).attr('href'); id = $( this ).attr( 'href' );
ua = navigator.userAgent.toLowerCase();
var ua = navigator.userAgent.toLowerCase();
if ( ua.indexOf('applewebkit') != -1 && id && id.charAt(0) == '#' ) { if ( ua.indexOf('applewebkit') != -1 && id && id.charAt(0) == '#' ) {
setTimeout(function () { setTimeout(function () {
$(id).focus(); $(id).focus();