Chris@0: /** Chris@0: * DO NOT EDIT THIS FILE. Chris@0: * See the following change record for more information, Chris@0: * https://www.drupal.org/node/2815083 Chris@0: * @preserve Chris@0: **/ Chris@0: Chris@0: (function ($, Drupal) { Chris@0: Drupal.behaviors.responsiveDetails = { Chris@0: attach: function attach(context) { Chris@0: var $details = $(context).find('details').once('responsive-details'); Chris@0: Chris@0: if (!$details.length) { Chris@0: return; Chris@0: } Chris@0: Chris@17: var $summaries = $details.find('> summary'); Chris@17: Chris@0: function detailsToggle(matches) { Chris@0: if (matches) { Chris@0: $details.attr('open', true); Chris@0: $summaries.attr('aria-expanded', true); Chris@0: $summaries.on('click.details-open', false); Chris@0: } else { Chris@0: var $notPressed = $details.find('> summary[aria-pressed!=true]').attr('aria-expanded', false); Chris@0: $notPressed.parent('details').attr('open', false); Chris@0: Chris@0: $summaries.off('.details-open'); Chris@0: } Chris@0: } Chris@0: Chris@0: function handleDetailsMQ(event) { Chris@0: detailsToggle(event.matches); Chris@0: } Chris@0: Chris@0: var mql = window.matchMedia('(min-width:48em)'); Chris@0: mql.addListener(handleDetailsMQ); Chris@0: detailsToggle(mql.matches); Chris@0: } Chris@0: }; Chris@0: })(jQuery, Drupal);