2015-06-08 14:04:39 +00:00
|
|
|
/**
|
2017-05-19 22:12:53 +00:00
|
|
|
* DO NOT EDIT THIS FILE.
|
|
|
|
* See the following change record for more information,
|
2017-05-23 14:30:14 +00:00
|
|
|
* https://www.drupal.org/node/2815083
|
2017-05-19 22:12:53 +00:00
|
|
|
* @preserve
|
|
|
|
**/
|
2015-06-08 14:04:39 +00:00
|
|
|
|
2013-04-26 19:32:39 +00:00
|
|
|
(function ($, Modernizr, Drupal) {
|
2014-01-27 21:41:32 +00:00
|
|
|
function CollapsibleDetails(node) {
|
|
|
|
this.$node = $(node);
|
|
|
|
this.$node.data('details', this);
|
2020-01-30 09:08:38 +00:00
|
|
|
var anchor = window.location.hash && window.location.hash !== '#' ? ", ".concat(window.location.hash) : '';
|
2017-05-19 22:12:53 +00:00
|
|
|
|
2020-01-30 09:08:38 +00:00
|
|
|
if (this.$node.find(".error".concat(anchor)).length) {
|
2014-01-27 21:41:32 +00:00
|
|
|
this.$node.attr('open', true);
|
|
|
|
}
|
2017-05-19 22:12:53 +00:00
|
|
|
|
Issue #1936708 by bnjmnm, espurnes, bendev, nod_, justinchev, ayushmishra206, vsujeetkumar, mbroere, mrinalini9, Knee-X, vacho, priyanka.sahni, jaspreetsingh31, paulocs, sokru, joum, kwoxer, yoroy, lauriii, rootwork, droplet: Current element values missing from vertical tabs when shown in 2-column layout
2020-09-18 14:42:57 +00:00
|
|
|
this.setupSummaryPolyfill();
|
2014-01-27 21:41:32 +00:00
|
|
|
}
|
2006-02-07 02:29:06 +00:00
|
|
|
|
2017-05-19 22:12:53 +00:00
|
|
|
$.extend(CollapsibleDetails, {
|
2014-01-27 21:41:32 +00:00
|
|
|
instances: []
|
|
|
|
});
|
2017-05-19 22:12:53 +00:00
|
|
|
$.extend(CollapsibleDetails.prototype, {
|
Issue #1936708 by bnjmnm, espurnes, bendev, nod_, justinchev, ayushmishra206, vsujeetkumar, mbroere, mrinalini9, Knee-X, vacho, priyanka.sahni, jaspreetsingh31, paulocs, sokru, joum, kwoxer, yoroy, lauriii, rootwork, droplet: Current element values missing from vertical tabs when shown in 2-column layout
2020-09-18 14:42:57 +00:00
|
|
|
setupSummaryPolyfill: function setupSummaryPolyfill() {
|
|
|
|
var $summary = this.$node.find('> summary');
|
2021-03-05 12:54:27 +00:00
|
|
|
$summary.attr('tabindex', '-1');
|
Issue #1936708 by bnjmnm, espurnes, bendev, nod_, justinchev, ayushmishra206, vsujeetkumar, mbroere, mrinalini9, Knee-X, vacho, priyanka.sahni, jaspreetsingh31, paulocs, sokru, joum, kwoxer, yoroy, lauriii, rootwork, droplet: Current element values missing from vertical tabs when shown in 2-column layout
2020-09-18 14:42:57 +00:00
|
|
|
$('<span class="details-summary-prefix visually-hidden"></span>').append(this.$node.attr('open') ? Drupal.t('Hide') : Drupal.t('Show')).prependTo($summary).after(document.createTextNode(' '));
|
|
|
|
$('<a class="details-title"></a>').attr('href', "#".concat(this.$node.attr('id'))).prepend($summary.contents()).appendTo($summary);
|
|
|
|
$summary.append(this.$summary).on('click', $.proxy(this.onSummaryClick, this));
|
2014-01-27 21:41:32 +00:00
|
|
|
},
|
Issue #1936708 by bnjmnm, espurnes, bendev, nod_, justinchev, ayushmishra206, vsujeetkumar, mbroere, mrinalini9, Knee-X, vacho, priyanka.sahni, jaspreetsingh31, paulocs, sokru, joum, kwoxer, yoroy, lauriii, rootwork, droplet: Current element values missing from vertical tabs when shown in 2-column layout
2020-09-18 14:42:57 +00:00
|
|
|
onSummaryClick: function onSummaryClick(e) {
|
2014-01-27 21:41:32 +00:00
|
|
|
this.toggle();
|
|
|
|
e.preventDefault();
|
|
|
|
},
|
2017-05-19 22:12:53 +00:00
|
|
|
toggle: function toggle() {
|
2017-07-06 06:21:40 +00:00
|
|
|
var _this = this;
|
|
|
|
|
2014-01-27 21:41:32 +00:00
|
|
|
var isOpen = !!this.$node.attr('open');
|
|
|
|
var $summaryPrefix = this.$node.find('> summary span.details-summary-prefix');
|
2020-01-30 09:08:38 +00:00
|
|
|
|
2014-01-27 21:41:32 +00:00
|
|
|
if (isOpen) {
|
|
|
|
$summaryPrefix.html(Drupal.t('Show'));
|
2017-05-19 22:12:53 +00:00
|
|
|
} else {
|
2014-01-27 21:41:32 +00:00
|
|
|
$summaryPrefix.html(Drupal.t('Hide'));
|
|
|
|
}
|
2017-05-19 22:12:53 +00:00
|
|
|
|
2015-06-07 00:43:51 +00:00
|
|
|
setTimeout(function () {
|
2017-07-06 06:21:40 +00:00
|
|
|
_this.$node.attr('open', !isOpen);
|
|
|
|
}, 0);
|
2006-02-07 02:29:06 +00:00
|
|
|
}
|
2014-01-27 21:41:32 +00:00
|
|
|
});
|
|
|
|
Drupal.behaviors.collapse = {
|
2017-05-19 22:12:53 +00:00
|
|
|
attach: function attach(context) {
|
2014-01-27 21:41:32 +00:00
|
|
|
if (Modernizr.details) {
|
|
|
|
return;
|
|
|
|
}
|
2020-01-30 09:08:38 +00:00
|
|
|
|
2021-08-10 10:05:02 +00:00
|
|
|
once('collapse', 'details', context).forEach(function (detail) {
|
|
|
|
detail.classList.add('collapse-processed');
|
|
|
|
CollapsibleDetails.instances.push(new CollapsibleDetails(detail));
|
|
|
|
});
|
2012-08-26 20:45:53 +00:00
|
|
|
}
|
2014-01-27 21:41:32 +00:00
|
|
|
};
|
2009-02-18 13:46:55 +00:00
|
|
|
|
Issue #2531700 by dmsmidt, alexrayu, cboyden, finne, tameeshb, kattekrab, andrewmacpherson, hass, droplet, drpal, dsnopek, nod_: Fragment links to children elements in closed grouping elements don't work
2017-07-26 00:21:52 +00:00
|
|
|
var handleFragmentLinkClickOrHashChange = function handleFragmentLinkClickOrHashChange(e, $target) {
|
|
|
|
$target.parents('details').not('[open]').find('> summary').trigger('click');
|
|
|
|
};
|
|
|
|
|
|
|
|
$('body').on('formFragmentLinkClickOrHashChange.details', handleFragmentLinkClickOrHashChange);
|
2014-01-27 21:41:32 +00:00
|
|
|
Drupal.CollapsibleDetails = CollapsibleDetails;
|
2017-05-19 22:12:53 +00:00
|
|
|
})(jQuery, Modernizr, Drupal);
|