mirror of
https://github.com/tag1consulting/d7_to_d10_migration.git
synced 2025-09-05 16:51:21 +00:00
Initial commit
This commit is contained in:
commit
c5e731d8ae
2773 changed files with 600767 additions and 0 deletions
52
drupal7/web/modules/contextual/contextual.js
Normal file
52
drupal7/web/modules/contextual/contextual.js
Normal file
|
@ -0,0 +1,52 @@
|
|||
/**
|
||||
* @file
|
||||
* Attaches behaviors for the Contextual module.
|
||||
*/
|
||||
|
||||
(function ($) {
|
||||
|
||||
Drupal.contextualLinks = Drupal.contextualLinks || {};
|
||||
|
||||
/**
|
||||
* Attaches outline behavior for regions associated with contextual links.
|
||||
*/
|
||||
Drupal.behaviors.contextualLinks = {
|
||||
attach: function (context) {
|
||||
$('div.contextual-links-wrapper', context).once('contextual-links', function () {
|
||||
var $wrapper = $(this);
|
||||
var $region = $wrapper.closest('.contextual-links-region');
|
||||
var $links = $wrapper.find('ul.contextual-links');
|
||||
var $trigger = $('<a class="contextual-links-trigger" href="#" />').text(Drupal.t('Configure')).click(
|
||||
function () {
|
||||
$links.stop(true, true).slideToggle(100);
|
||||
$wrapper.toggleClass('contextual-links-active');
|
||||
return false;
|
||||
}
|
||||
);
|
||||
// Attach hover behavior to trigger and ul.contextual-links.
|
||||
$trigger.add($links).hover(
|
||||
function () { $region.addClass('contextual-links-region-active'); },
|
||||
function () { $region.removeClass('contextual-links-region-active'); }
|
||||
);
|
||||
// Hide the contextual links when user clicks a link or rolls out of the .contextual-links-region.
|
||||
$region.bind('mouseleave click', Drupal.contextualLinks.mouseleave);
|
||||
$region.hover(
|
||||
function() { $trigger.addClass('contextual-links-trigger-active'); },
|
||||
function() { $trigger.removeClass('contextual-links-trigger-active'); }
|
||||
);
|
||||
// Prepend the trigger.
|
||||
$wrapper.prepend($trigger);
|
||||
});
|
||||
}
|
||||
};
|
||||
|
||||
/**
|
||||
* Disables outline for the region contextual links are associated with.
|
||||
*/
|
||||
Drupal.contextualLinks.mouseleave = function () {
|
||||
$(this)
|
||||
.find('.contextual-links-active').removeClass('contextual-links-active')
|
||||
.find('ul.contextual-links').hide();
|
||||
};
|
||||
|
||||
})(jQuery);
|
Loading…
Add table
Add a link
Reference in a new issue