Make WordPress Core

Ticket #25970: 25970.diff

File 25970.diff, 2.5 KB (added by kadamwhite, 12 years ago)

Changes to make grunt jshint:core --file=admin-bar.js pass without error

  • src/wp-includes/js/admin-bar.js

     
     1/* jshint loopfunc: true */
    12// use jQuery and hoverIntent if loaded
    23if ( typeof(jQuery) != 'undefined' ) {
    34        if ( typeof(jQuery.fn.hoverIntent) == 'undefined' ) {
     5                /* jshint ignore:start */
    46                // hoverIntent r6 - Copy of wp-includes/js/hoverIntent.min.js
    57                (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 */
    69        }
    710        jQuery(document).ready(function($){
    811                var adminbar = $('#wpadminbar'), refresh, touchOpen, touchClose, disableHoverIntent = false;
     
    5356                }
    5457
    5558                adminbar.find('li.menupop').hoverIntent({
    56                         over: function(e){
     59                        over: function() {
    5760                                if ( disableHoverIntent )
    5861                                        return;
    5962
    6063                                $(this).addClass('hover');
    6164                        },
    62                         out: function(e){
     65                        out: function() {
    6366                                if ( disableHoverIntent )
    6467                                        return;
    6568
     
    120123
    121124                // fix focus bug in WebKit
    122125                $('.screen-reader-shortcut').keydown( function(e) {
     126                        var id, ua;
     127
    123128                        if ( 13 != e.which )
    124129                                return;
    125130
    126                         var id = $(this).attr('href');
     131                        id = $( this ).attr( 'href' );
    127132
    128                         var ua = navigator.userAgent.toLowerCase();
     133                        ua = navigator.userAgent.toLowerCase();
     134
    129135                        if ( ua.indexOf('applewebkit') != -1 && id && id.charAt(0) == '#' ) {
    130136                                setTimeout(function () {
    131137                                        $(id).focus();