-
Notifications
You must be signed in to change notification settings - Fork 8
/
metatag.admin.js
48 lines (41 loc) · 1.47 KB
/
metatag.admin.js
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
/**
* @file
* Custom admin-side JS for the Metatag module.
*/
(function ($) {
'use strict';
Drupal.behaviors.metatagUIConfigListing = {
attach: function (context) {
// Hidden elements to be visible if JavaScript is enabled.
$('.js-show').show();
// Make the leaf arrow clickable.
$('.metatag-config-label').hover(function(){
$(this).css({'cursor': 'pointer'});
})
.click(function(){
$(this).find('a.toggle-details', context).trigger('click');
});
// Show or hide the summary.
$('table.metatag-config-overview a.toggle-details', context).click(function(event) {
$(this).parent('div').siblings('div.metatag-config-details').each(function() {
if ($(this).hasClass('js-hide')) {
$(this).slideDown('slow').removeClass('js-hide');
}
else {
$(this).slideUp('slow').addClass('js-hide');
}
});
// Change the expanded or collapsed state of the instance label.
if ($(this).parent('div').hasClass('collapsed')) {
$(this).parent('div').removeClass('collapsed').addClass('expanded');
}
else {
$(this).parent('div').removeClass('expanded').addClass('collapsed');
}
// This event may be triggered by a parent element click - so we don't
// want the click to bubble up otherwise we get recursive click events.
event.stopPropagation();
});
}
};
})(jQuery);