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

2 lines
3.5 KiB
JavaScript
Raw Normal View History

/*! This file is auto-generated */
!function(u,d,m){function f(e){var t;27===e.which&&(t=S(e.target,".menupop"))&&(t.querySelector(".menupop > .ab-item").focus(),E(t,"hover"))}function p(e){var t;13===e.which&&(S(e.target,".ab-sub-wrapper")||(t=S(e.target,".menupop"))&&(e.preventDefault(),o(t,"hover")?E(t,"hover"):y(t,"hover")))}function h(e){var t;13===e.which&&(t=e.target.getAttribute("href"),-1<m.userAgent.toLowerCase().indexOf("applewebkit")&&t&&"#"===t.charAt(0)&&setTimeout(function(){var e=u.getElementById(t.replace("#",""));e&&(e.setAttribute("tabIndex","0"),e.focus())},100))}function v(e,t){var n;S(t.target,".ab-sub-wrapper")||(t.preventDefault(),(n=S(t.target,".menupop"))&&(o(n,"hover")?E(n,"hover"):(L(e),y(n,"hover"))))}function g(e){var t,n=e.target.parentNode;if(n&&(t=n.querySelector(".shortlink-input")),t)return e.preventDefault&&e.preventDefault(),e.returnValue=!1,y(n,"selected"),t.focus(),t.select(),!(t.onblur=function(){E(n,"selected")})}function b(){if("sessionStorage"in d)try{for(var e in sessionStorage)-1<e.indexOf("wp-autosave-")&&sessionStorage.removeItem(e)}catch(e){}}function o(e,t){return!!e&&(e.classList&&e.classList.contains?e.classList.contains(t):!!e.className&&-1<e.className.split(" ").indexOf(t))}function y(e,t){e&&(e.classList&&e.classList.add?e.classList.add(t):o(e,t)||(e.className&&(e.className+=" "),e.className+=t))}function E(e,t){var n,r;if(e&&o(e,t))if(e.classList&&e.classList.remove)e.classList.remove(t);else{for(n=" "+t+" ",r=" "+e.className+" ";-1<r.indexOf(n);)r=r.replace(n,"");e.className=r.replace(/^[\s]+|[\s]+$/g,"")}}function L(e){if(e&&e.length)for(var t=0;t<e.length;t++)E(e[t],"hover")}function w(e){if(!e.target||"wpadminbar"===e.target.id||"wp-admin-bar-top-secondary"===e.target.id)try{d.scrollTo({top:-32,left:0,behavior:"smooth"})}catch(e){d.scrollTo(0,-32)}}function S(e,t){for(d.Element.prototype.matches||(d.Element.prototype.matches=d.Element.prototype.matchesSelector||d.Element.prototype.mozMatchesSelector||d.Element.prototype.msMatchesSelector||d.Element.prototype.oMatchesSelector||d.Element.prototype.webkitMatchesSelector||function(e){for(var t=(this.document||this.ownerDocument).querySelectorAll(e),n=t.length;0<=--n&&t.item(n)!==this;);return-1<n});e&&e!==u;e=e.parentNode)if(e.matches(t))return e;return null}u.addEventListener("DOMContentLoaded",function(){var n,e,t,r,o,a,s,i,c,l=u.getElementById("wpadminbar");if(l&&"querySelectorAll"in l){n=l.querySelectorAll("li.menupop"),e=l.querySelectorAll(".ab-item"),t=u.getElementById("wp-admin-bar-logout"),r=u.getElementById("adminbarsearch"),o=u.getElementById("wp-admin-bar-get-shortlink"),a=l.querySelector(".screen-reader-shortcut"),s=/Mobile\/.+Safari/.test(m.userAgent)?"touchstart":"click",E(l,"nojs"),"ontouchstart"in d&&(u.body.addEventListener(s,function(e){S(e.target,"li.menupop")||L(n)}),l.addEventListener("touchstart",function e(){for(var t=0;t<n.length;t++)n[t].addEventListener("click",v.bind(null,n));l.removeEventListener("touchstart",e)})),l.addEventListener("click",w);for(c=0;c<n.length;c++)d.hoverintent(n[c],y.bind(null,n[c],"hover"),E.bind(null,n[c],"hover")).options({timeout:180}),n[c].addEventListener("keydown",p);for(c=0;c<e.length;c++)e[c].addEventListener("keydown",f);r&&((i=u.getElementById("adminbar-search")).addEventListener("focus",function(){y(r,"adminbar-focused")}),i.addEventListener("blur",function(){E(r,"adminbar-focused")})),a&&a.addEventListener("keydown",h),o&&o.addEventListener("click",g),d.location.hash&&d.scrollBy(0,-32),t&&t.addEventListener("click",b)}})}(document,window,navigator);