+/* jshint loopfunc: true */
// use jQuery and hoverIntent if loaded
if ( typeof(jQuery) != 'undefined' ) {
- if ( typeof(jQuery.fn.hoverIntent) == 'undefined' )
- (function(a){a.fn.hoverIntent=function(l,j){var m={sensitivity:7,interval:100,timeout:0};m=a.extend(m,j?{over:l,out:j}:l);var o,n,h,d;var e=function(f){o=f.pageX;n=f.pageY};var c=function(g,f){f.hoverIntent_t=clearTimeout(f.hoverIntent_t);if((Math.abs(h-o)+Math.abs(d-n))<m.sensitivity){a(f).unbind("mousemove",e);f.hoverIntent_s=1;return m.over.apply(f,[g])}else{h=o;d=n;f.hoverIntent_t=setTimeout(function(){c(g,f)},m.interval)}};var i=function(g,f){f.hoverIntent_t=clearTimeout(f.hoverIntent_t);f.hoverIntent_s=0;return m.out.apply(f,[g])};var b=function(q){var f=this;var g=(q.type=="mouseover"?q.fromElement:q.toElement)||q.relatedTarget;while(g&&g!=this){try{g=g.parentNode}catch(q){g=this}}if(g==this){if(a.browser.mozilla){if(q.type=="mouseout"){f.mtout=setTimeout(function(){k(q,f)},30)}else{if(f.mtout){f.mtout=clearTimeout(f.mtout)}}}return}else{if(f.mtout){f.mtout=clearTimeout(f.mtout)}k(q,f)}};var k=function(p,f){var g=jQuery.extend({},p);if(f.hoverIntent_t){f.hoverIntent_t=clearTimeout(f.hoverIntent_t)}if(p.type=="mouseover"){h=g.pageX;d=g.pageY;a(f).bind("mousemove",e);if(f.hoverIntent_s!=1){f.hoverIntent_t=setTimeout(function(){c(g,f)},m.interval)}}else{a(f).unbind("mousemove",e);if(f.hoverIntent_s==1){f.hoverIntent_t=setTimeout(function(){i(g,f)},m.timeout)}}};return this.mouseover(b).mouseout(b)}})(jQuery);
-
+ if ( typeof(jQuery.fn.hoverIntent) == 'undefined' ) {
+ /* jshint ignore:start */
+ // hoverIntent v1.8.1 - Copy of wp-includes/js/hoverIntent.min.js
+ !function(a){a.fn.hoverIntent=function(b,c,d){var e={interval:100,sensitivity:6,timeout:0};e="object"==typeof b?a.extend(e,b):a.isFunction(c)?a.extend(e,{over:b,out:c,selector:d}):a.extend(e,{over:b,out:b,selector:c});var f,g,h,i,j=function(a){f=a.pageX,g=a.pageY},k=function(b,c){return c.hoverIntent_t=clearTimeout(c.hoverIntent_t),Math.sqrt((h-f)*(h-f)+(i-g)*(i-g))<e.sensitivity?(a(c).off("mousemove.hoverIntent",j),c.hoverIntent_s=!0,e.over.apply(c,[b])):(h=f,i=g,c.hoverIntent_t=setTimeout(function(){k(b,c)},e.interval),void 0)},l=function(a,b){return b.hoverIntent_t=clearTimeout(b.hoverIntent_t),b.hoverIntent_s=!1,e.out.apply(b,[a])},m=function(b){var c=a.extend({},b),d=this;d.hoverIntent_t&&(d.hoverIntent_t=clearTimeout(d.hoverIntent_t)),"mouseenter"===b.type?(h=c.pageX,i=c.pageY,a(d).on("mousemove.hoverIntent",j),d.hoverIntent_s||(d.hoverIntent_t=setTimeout(function(){k(c,d)},e.interval))):(a(d).off("mousemove.hoverIntent",j),d.hoverIntent_s&&(d.hoverIntent_t=setTimeout(function(){l(c,d)},e.timeout)))};return this.on({"mouseenter.hoverIntent":m,"mouseleave.hoverIntent":m},e.selector)}}(jQuery);
+ /* jshint ignore:end */
+ }
jQuery(document).ready(function($){
var adminbar = $('#wpadminbar'), refresh, touchOpen, touchClose, disableHoverIntent = false;
adminbar.find('li.menupop').on('click.wp-mobile-hover', function(e) {
var el = $(this);
- if ( !el.hasClass('hover') ) {
+ if ( el.parent().is('#wp-admin-bar-root-default') && !el.hasClass('hover') ) {
e.preventDefault();
adminbar.find('li.menupop.hover').removeClass('hover');
el.addClass('hover');
+ } else if ( !el.hasClass('hover') ) {
+ e.stopPropagation();
+ e.preventDefault();
+ el.addClass('hover');
}
if ( unbind ) {
}
adminbar.find('li.menupop').hoverIntent({
- over: function(e){
+ over: function() {
if ( disableHoverIntent )
return;
$(this).addClass('hover');
},
- out: function(e){
+ out: function() {
if ( disableHoverIntent )
return;
if ( e.which != 13 )
return;
- var target = $(e.target), wrap = target.closest('ab-sub-wrapper');
+ var target = $(e.target),
+ wrap = target.closest('.ab-sub-wrapper'),
+ parentHasHover = target.parent().hasClass('hover');
e.stopPropagation();
e.preventDefault();
wrap = $('#wpadminbar .quicklinks');
wrap.find('.menupop').removeClass('hover');
- target.parent().toggleClass('hover');
+
+ if ( ! parentHasHover ) {
+ target.parent().toggleClass('hover');
+ }
+
target.siblings('.ab-sub-wrapper').find('.ab-item').each(refresh);
}).each(refresh);
// fix focus bug in WebKit
$('.screen-reader-shortcut').keydown( function(e) {
+ var id, ua;
+
if ( 13 != e.which )
return;
- var id = $(this).attr('href');
+ id = $( this ).attr( 'href' );
+
+ ua = navigator.userAgent.toLowerCase();
- if ( $.browser.webkit && id && id.charAt(0) == '#' ) {
+ if ( ua.indexOf('applewebkit') != -1 && id && id.charAt(0) == '#' ) {
setTimeout(function () {
$(id).focus();
}, 100);
}
});
+
+ $( '#adminbar-search' ).on({
+ focus: function() {
+ $( '#adminbarsearch' ).addClass( 'adminbar-focused' );
+ }, blur: function() {
+ $( '#adminbarsearch' ).removeClass( 'adminbar-focused' );
+ }
+ } );
+
+ // Empty sessionStorage on logging out
+ if ( 'sessionStorage' in window ) {
+ $('#wp-admin-bar-logout a').click( function() {
+ try {
+ for ( var key in sessionStorage ) {
+ if ( key.indexOf('wp-autosave-') != -1 )
+ sessionStorage.removeItem(key);
+ }
+ } catch(e) {}
+ });
+ }
+
+ if ( navigator.userAgent && document.body.className.indexOf( 'no-font-face' ) === -1 &&
+ /Android (1.0|1.1|1.5|1.6|2.0|2.1)|Nokia|Opera Mini|w(eb)?OSBrowser|webOS|UCWEB|Windows Phone OS 7|XBLWP7|ZuneWP7|MSIE 7/.test( navigator.userAgent ) ) {
+
+ document.body.className += ' no-font-face';
+ }
});
} else {
(function(d, w) {
addEvent(aB, 'click', function(e) {
scrollToTop( e.target || e.srcElement );
});
+
+ addEvent( document.getElementById('wp-admin-bar-logout'), 'click', function() {
+ if ( 'sessionStorage' in window ) {
+ try {
+ for ( var key in sessionStorage ) {
+ if ( key.indexOf('wp-autosave-') != -1 )
+ sessionStorage.removeItem(key);
+ }
+ } catch(e) {}
+ }
+ });
}
if ( w.location.hash )
w.scrollBy(0,-32);
+
+ if ( navigator.userAgent && document.body.className.indexOf( 'no-font-face' ) === -1 &&
+ /Android (1.0|1.1|1.5|1.6|2.0|2.1)|Nokia|Opera Mini|w(eb)?OSBrowser|webOS|UCWEB|Windows Phone OS 7|XBLWP7|ZuneWP7|MSIE 7/.test( navigator.userAgent ) ) {
+
+ document.body.className += ' no-font-face';
+ }
});
})(document, window);