1/** 2 * @file 3 * Admin Toolbar hoverIntent plugin behavior for the display of the menu. 4 */ 5 6(($, Drupal, once) => { 7 /** 8 * Implements the Admin Toolbar hoverIntent plugin behavior. 9 * 10 * @type {Drupal~behavior} 11 * 12 * @prop {Drupal~behaviorAttach} attach 13 * Attaches the behavior for the display of the menu on hover. 14 */ 15 Drupal.behaviors.adminToolbarHoverIntent = { 16 attach: (context, settings) => { 17 if (context !== document) { 18 return; 19 } 20 once('admin-toolbar-hover-plugin', 'body', context).forEach((element) => { 21 // Call the hoverIntent JQuery plugin on the menu items. 22 $( 23 '.toolbar-tray-horizontal li.menu-item--expanded, .toolbar-tray-horizontal ul li.menu-item--expanded .menu-item', 24 element, 25 ).hoverIntent({ 26 over() { 27 // At the current depth, we should delete all 'hover-intent' 28 // classes. Other wise we get unwanted behavior where menu items are 29 // expanded while already in hovering other ones. 30 $(this).parent().find('li').removeClass('hover-intent'); 31 $(this).addClass('hover-intent'); 32 }, 33 out() { 34 $(this).removeClass('hover-intent'); 35 }, 36 timeout: settings.hoverIntentTimeout, 37 }); 38 }); 39 }, 40 }; 41})(jQuery, Drupal, once);
Line numbers count LF bytes from the start of the resource, as the search results do. Vendor segments are library code the classifier recognised; they are stored but not indexed. Bytes are shown as Latin1 characters, one per byte.