wp/wp-includes/js/admin-bar.js
changeset 7 cf61fcea0001
parent 5 5e2f62d02dcd
child 9 177826044cd9
equal deleted inserted replaced
6:490d5cc509ed 7:cf61fcea0001
    26 					el.addClass('hover');
    26 					el.addClass('hover');
    27 				} else if ( !el.hasClass('hover') ) {
    27 				} else if ( !el.hasClass('hover') ) {
    28 					e.stopPropagation();
    28 					e.stopPropagation();
    29 					e.preventDefault();
    29 					e.preventDefault();
    30 					el.addClass('hover');
    30 					el.addClass('hover');
       
    31 				} else if ( ! $( e.target ).closest( 'div' ).hasClass( 'ab-sub-wrapper' ) ) {
       
    32 					// We're dealing with an already-touch-opened menu genericon (we know el.hasClass('hover')),
       
    33 					// so close it on a second tap and prevent propag and defaults. See #29906
       
    34 					e.stopPropagation();
       
    35 					e.preventDefault();
       
    36 					el.removeClass('hover');
    31 				}
    37 				}
    32 
    38 
    33 				if ( unbind ) {
    39 				if ( unbind ) {
    34 					$('li.menupop').off('click.wp-mobile-hover');
    40 					$('li.menupop').off('click.wp-mobile-hover');
    35 					disableHoverIntent = false;
    41 					disableHoverIntent = false;
   121 
   127 
   122 			target.closest('.hover').removeClass('hover').children('.ab-item').focus();
   128 			target.closest('.hover').removeClass('hover').children('.ab-item').focus();
   123 			target.siblings('.ab-sub-wrapper').find('.ab-item').each(refresh);
   129 			target.siblings('.ab-sub-wrapper').find('.ab-item').each(refresh);
   124 		});
   130 		});
   125 
   131 
   126 		$('#wpadminbar').click( function(e) {
   132 		adminbar.click( function(e) {
   127 			if ( e.target.id != 'wpadminbar' && e.target.id != 'wp-admin-bar-top-secondary' )
   133 			if ( e.target.id != 'wpadminbar' && e.target.id != 'wp-admin-bar-top-secondary' ) {
   128 				return;
   134 				return;
   129 
   135 			}
       
   136 
       
   137 			adminbar.find( 'li.menupop.hover' ).removeClass( 'hover' );
       
   138 			$( 'html, body' ).animate( { scrollTop: 0 }, 'fast' );
   130 			e.preventDefault();
   139 			e.preventDefault();
   131 			$('html, body').animate({ scrollTop: 0 }, 'fast');
       
   132 		});
   140 		});
   133 
   141 
   134 		// fix focus bug in WebKit
   142 		// fix focus bug in WebKit
   135 		$('.screen-reader-shortcut').keydown( function(e) {
   143 		$('.screen-reader-shortcut').keydown( function(e) {
   136 			var id, ua;
   144 			var id, ua;