1/** 2 * @file 3 * Attaches behaviors for the Contextual module. 4 */ 5 6(function ($) { 7 8Drupal.contextualLinks = Drupal.contextualLinks || {}; 9 10/** 11 * Attaches outline behavior for regions associated with contextual links. 12 */ 13Drupal.behaviors.contextualLinks = { 14 attach: function (context) { 15 // added the wrapper to the parent 16 $(".contextual-links-wrapper").parent().addClass('contextual-links-region clearfix'); 17 18 $('div.contextual-links-wrapper', context).once('contextual-links', function () { 19 var $wrapper = $(this); 20 var $region = $wrapper.closest('.contextual-links-region'); 21 var $links = $wrapper.find('ul.contextual-links'); 22 var $trigger = $('<a class="contextual-links-trigger" href="#" />').text(Drupal.t('Configure')).click( 23 function () { 24 $links.stop(true, true).slideToggle(100); 25 $wrapper.toggleClass('contextual-links-active'); 26 return false; 27 } 28 ); 29 // Attach hover behavior to trigger and ul.contextual-links. 30 $trigger.add($links).hover( 31 function () { $region.addClass('contextual-links-region-active'); }, 32 function () { $region.removeClass('contextual-links-region-active'); } 33 ); 34 // Hide the contextual links when user clicks a link or rolls out of the .contextual-links-region. 35 $region.bind('mouseleave click', Drupal.contextualLinks.mouseleave); 36 37 $region.hover( 38 function() { $trigger.addClass('contextual-links-trigger-active'); }, 39 function() { $trigger.removeClass('contextual-links-trigger-active'); } 40 ); 41 42 // Prepend the trigger. 43 $wrapper.prepend($trigger); 44 }); 45 } 46}; 47 48/** 49 * Disables outline for the region contextual links are associated with. 50 */ 51Drupal.contextualLinks.mouseleave = function () { 52 $(this) 53 .find('.contextual-links-active').removeClass('contextual-links-active') 54 .find('ul.contextual-links').hide(); 55}; 56 57})(jQuery);
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.