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

1 line
5.7 KiB
JavaScript
Raw Normal View History

if(typeof(jQuery)!="undefined"){if(typeof(jQuery.fn.hoverIntent)=="undefined"){(function(b){b.fn.hoverIntent=function(p,r){var g={sensitivity:7,interval:100,timeout:0};g=b.extend(g,r?{over:p,out:r}:p);var a,f,t,v;var u=function(c){a=c.pageX;f=c.pageY};var w=function(c,d){d.hoverIntent_t=clearTimeout(d.hoverIntent_t);if((Math.abs(t-a)+Math.abs(v-f))<g.sensitivity){b(d).unbind("mousemove",u);d.hoverIntent_s=1;return g.over.apply(d,[c])}else{t=a;v=f;d.hoverIntent_t=setTimeout(function(){w(c,d)},g.interval)}};var s=function(c,d){d.hoverIntent_t=clearTimeout(d.hoverIntent_t);d.hoverIntent_s=0;return g.out.apply(d,[c])};var x=function(e){var d=this;var c=(e.type=="mouseover"?e.fromElement:e.toElement)||e.relatedTarget;while(c&&c!=this){try{c=c.parentNode}catch(e){c=this}}if(c==this){if(b.browser.mozilla){if(e.type=="mouseout"){d.mtout=setTimeout(function(){q(e,d)},30)}else{if(d.mtout){d.mtout=clearTimeout(d.mtout)}}}return}else{if(d.mtout){d.mtout=clearTimeout(d.mtout)}q(e,d)}};var q=function(e,d){var c=jQuery.extend({},e);if(d.hoverIntent_t){d.hoverIntent_t=clearTimeout(d.hoverIntent_t)}if(e.type=="mouseover"){t=c.pageX;v=c.pageY;b(d).bind("mousemove",u);if(d.hoverIntent_s!=1){d.hoverIntent_t=setTimeout(function(){w(c,d)},g.interval)}}else{b(d).unbind("mousemove",u);if(d.hoverIntent_s==1){d.hoverIntent_t=setTimeout(function(){s(c,d)},g.timeout)}}};return this.mouseover(x).mouseout(x)}})(jQuery)}jQuery(document).ready(function(c){var b=c("#wpadminbar"),a;a=function(d,f){var g=c(f),e=g.attr("tabindex");if(e){g.attr("tabindex","0").attr("tabindex",e)}};b.removeClass("nojq").removeClass("nojs");if("ontouchstart" in window||/IEMobile\/[1-9]/.test(navigator.userAgent)){c(document.body).on("click.wp-mobile-hover",function(d){if(!c(d.target).closest("#wpadminbar").length){b.find("li.menupop.hover").removeClass("hover")}});b.find("li.menupop").on("click.wp-mobile-hover",function(f){var d=c(this);if(!d.hasClass("hover")){f.preventDefault();b.find("li.menupop.hover").removeClass("hover");d.addClass("hover")}})}else{b.find("li.menupop").hoverIntent({over:function(d){c(this).addClass("hover")},out:function(d){c(this).removeClass("hover")},timeout:180,sensitivity:7,interval:100})}c("#wp-admin-bar-get-shortlink").click(function(d){d.preventDefault();c(this).addClass("selected").children(".shortlink-input").blur(function(){c(this).parents("#wp-admin-bar-get-shortlink").removeClass("selected")}).focus().select()});c("#wpadminbar li.menupop > .ab-item").bind("keydown.adminbar",function(g){if(g.which!=13){return}var f=c(g.target),d=f.closest("ab-sub-wrapper");g.stopPropagation();g.preventDefault();if(!d.length){d=c("#wpadminbar .quicklinks")}d.find(".menupop").removeClass("hover");f.parent().toggleClass("hover");f.siblings(".ab-sub-wrapper").find(".ab-item").each(a)}).each(a);c("#wpadminbar .ab-item").bind("keydown.adminbar",function(f){if(f.which!=27){return}var d=c(f.target);f.stopPropagation();f.preventDefault();d.closest(".hover").removeClass("hover").children(".ab-item").focus();d.siblings(".ab-sub-wrapper").find(".ab-item").each(a)});c("#wpadminbar").click(function(d){if(d.target.id!="wpadminbar"&&d.target.id!="wp-admin-bar-top-secondary"){return}d.preventDefault();c("html, body").animate({scrollTop:0},"fast")});c(".screen-reader-shortcut").keydown(function(d){if(13!=d.which){return}var f=c(this).attr("href");if(c.browser.webkit&&f&&f.charAt(0)=="#"){setTimeout(function(){c(f).focus()},100)}})})}else{(function(j,l){var e=function(o,n,d){if(o.addEventListener){o.addEventListener(n,d,false)}else{if(o.attachEvent){o.attachEvent("on"+n,function(){return d.call(o,window.event)})}}},f,g=new RegExp("\\bhover\\b","g"),b=[],k=new RegExp("\\bselected\\b","g"),h=function(n){var d=b.length;while(d--){if(b[d]&&n==b[d][1]){return b[d][0]}}return false},i=function(u){var o,d,r,n,q,s,v=[],p=0;while(u&&u!=f&&u!=j){if("LI"==u.nodeName.toUpperCase()){v[v.length]=u;d=h(u);if(d){clearTimeout(d)}u.className=u.className?(u.className.replace(g,"")+" hover"):"hover";n=u}u=u.parentNode}if(n&&n.parentNode){q=n.parentNode;if(q&&"UL"==q.nodeName.toUpperCase()){o=q.c