WordPress/wp-includes/js/admin-bar.min.js

1 line
7.0 KiB
JavaScript
Raw Normal View History

"undefined"!=typeof jQuery?(void 0===jQuery.fn.hoverIntent&&function(u){u.fn.hoverIntent=function(e,t,n){function a(e){o=e.pageX,r=e.pageY}var o,r,s,i,c={interval:100,sensitivity:6,timeout:0},c="object"==typeof e?u.extend(c,e):u.isFunction(t)?u.extend(c,{over:e,out:t,selector:n}):u.extend(c,{over:e,out:e,selector:t}),l=function(e,t){return t.hoverIntent_t=clearTimeout(t.hoverIntent_t),Math.sqrt((s-o)*(s-o)+(i-r)*(i-r))<c.sensitivity?(u(t).off("mousemove.hoverIntent",a),t.hoverIntent_s=!0,c.over.apply(t,[e])):(s=o,i=r,void(t.hoverIntent_t=setTimeout(function(){l(e,t)},c.interval)))},t=function(e){var n=u.extend({},e),o=this;o.hoverIntent_t&&(o.hoverIntent_t=clearTimeout(o.hoverIntent_t)),"mouseenter"===e.type?(s=n.pageX,i=n.pageY,u(o).on("mousemove.hoverIntent",a),o.hoverIntent_s||(o.hoverIntent_t=setTimeout(function(){l(n,o)},c.interval))):(u(o).off("mousemove.hoverIntent",a),o.hoverIntent_s&&(o.hoverIntent_t=setTimeout(function(){var e,t;e=n,(t=o).hoverIntent_t=clearTimeout(t.hoverIntent_t),t.hoverIntent_s=!1,c.out.apply(t,[e])},c.timeout)))};return this.on({"mouseenter.hoverIntent":t,"mouseleave.hoverIntent":t},c.selector)}}(jQuery),jQuery(document).ready(function(a){var o=a("#wpadminbar"),r=!1,s=function(e,t){var n=a(t),t=n.attr("tabindex");t&&n.attr("tabindex","0").attr("tabindex",t)},e=function(n){o.find("li.menupop").on("click.wp-mobile-hover",function(e){var t=a(this);t.parent().is("#wp-admin-bar-root-default")&&!t.hasClass("hover")?(e.preventDefault(),o.find("li.menupop.hover").removeClass("hover"),t.addClass("hover")):t.hasClass("hover")?a(e.target).closest("div").hasClass("ab-sub-wrapper")||(e.stopPropagation(),e.preventDefault(),t.removeClass("hover")):(e.stopPropagation(),e.preventDefault(),t.addClass("hover")),n&&(a("li.menupop").off("click.wp-mobile-hover"),r=!1)})},t=function(){var e=/Mobile\/.+Safari/.test(navigator.userAgent)?"touchstart":"click";a(document.body).on(e+".wp-mobile-hover",function(e){a(e.target).closest("#wpadminbar").length||o.find("li.menupop.hover").removeClass("hover")})};o.removeClass("nojq").removeClass("nojs"),"ontouchstart"in window?(o.on("touchstart",function(){e(!0),r=!0}),t()):/IEMobile\/[1-9]/.test(navigator.userAgent)&&(e(),t()),o.find("li.menupop").hoverIntent({over:function(){r||a(this).addClass("hover")},out:function(){r||a(this).removeClass("hover")},timeout:180,sensitivity:7,interval:100}),window.location.hash&&window.scrollBy(0,-32),a("#wp-admin-bar-get-shortlink").click(function(e){e.preventDefault(),a(this).addClass("selected").children(".shortlink-input").blur(function(){a(this).parents("#wp-admin-bar-get-shortlink").removeClass("selected")}).focus().select()}),a("#wpadminbar li.menupop > .ab-item").bind("keydown.adminbar",function(e){var t,n,o;13==e.which&&(n=(t=a(e.target)).closest(".ab-sub-wrapper"),o=t.parent().hasClass("hover"),e.stopPropagation(),e.preventDefault(),(n=!n.length?a("#wpadminbar .quicklinks"):n).find(".menupop").removeClass("hover"),o||t.parent().toggleClass("hover"),t.siblings(".ab-sub-wrapper").find(".ab-item").each(s))}).each(s),a("#wpadminbar .ab-item").bind("keydown.adminbar",function(e){var t;27==e.which&&(t=a(e.target),e.stopPropagation(),e.preventDefault(),t.closest(".hover").removeClass("hover").children(".ab-item").focus(),t.siblings(".ab-sub-wrapper").find(".ab-item").each(s))}),o.click(function(e){"wpadminbar"!=e.target.id&&"wp-admin-bar-top-secondary"!=e.target.id||(o.find("li.menupop.hover").removeClass("hover"),a("html, body").animate({scrollTop:0},"fast"),e.preventDefault())}),a(".screen-reader-shortcut").keydown(function(e){var t;13==e.which&&(t=a(this).attr("href"),-1!=navigator.userAgent.toLowerCase().indexOf("applewebkit")&&t&&"#"==t.charAt(0)&&setTimeout(function(){a(t).focus()},100))}),a("#adminbar-search").on({focus:function(){a("#adminbarsearch").addClass("adminbar-focused")},blur:function(){a("#adminbarsearch").removeClass("adminbar-focused")}}),"sessionStorage"in window&&a("#wp-admin-bar-logout a").click(function(){try{for(var e in sessionStorage)-1!=e.indexOf("wp-autosave-")&&sessionStorage.removeItem(e)}catch(e){}}),nav