1
|
|
2
|
|
3
|
|
4
|
|
5
|
|
6
|
(function ($) {
|
7
|
|
8
|
Drupal.contextualLinks = Drupal.contextualLinks || {};
|
9
|
|
10
|
|
11
|
|
12
|
|
13
|
Drupal.behaviors.contextualLinks = {
|
14
|
attach: function (context) {
|
15
|
$('div.contextual-links-wrapper', context).once('contextual-links', function () {
|
16
|
var $wrapper = $(this);
|
17
|
var $region = $wrapper.closest('.contextual-links-region');
|
18
|
var $links = $wrapper.find('ul.contextual-links');
|
19
|
var $trigger = $('<a class="contextual-links-trigger" href="#" />').text(Drupal.t('Configure')).click(
|
20
|
function () {
|
21
|
$links.stop(true, true).slideToggle(100);
|
22
|
$wrapper.toggleClass('contextual-links-active');
|
23
|
return false;
|
24
|
}
|
25
|
);
|
26
|
|
27
|
$trigger.add($links).hover(
|
28
|
function () { $region.addClass('contextual-links-region-active'); },
|
29
|
function () { $region.removeClass('contextual-links-region-active'); }
|
30
|
);
|
31
|
|
32
|
$region.bind('mouseleave click', Drupal.contextualLinks.mouseleave);
|
33
|
$region.hover(
|
34
|
function() { $trigger.addClass('contextual-links-trigger-active'); },
|
35
|
function() { $trigger.removeClass('contextual-links-trigger-active'); }
|
36
|
);
|
37
|
|
38
|
$wrapper.prepend($trigger);
|
39
|
});
|
40
|
}
|
41
|
};
|
42
|
|
43
|
|
44
|
|
45
|
|
46
|
Drupal.contextualLinks.mouseleave = function () {
|
47
|
$(this)
|
48
|
.find('.contextual-links-active').removeClass('contextual-links-active')
|
49
|
.find('ul.contextual-links').hide();
|
50
|
};
|
51
|
|
52
|
})(jQuery);
|