1/** 2 * @file overlay.js 3 * 4 * JS File to toggle overlay elements. 5 */ 6(function (Drupal, once) { 7 8 const toggleSelector = '[data-overlay-toggle]'; 9 10 /** 11 * @Behavior 12 * 13 * Open/close target overlay elements. 14 */ 15 Drupal.behaviors.overlayToggleElement = { 16 onceName: 'overlay-toggle', 17 attach(context) { 18 once('overlay-toggle', context.querySelectorAll('[data-overlay-toggle]'), context).forEach(function (btn) { 19 ['click', 'touch'].forEach(function (e) { 20 btn.addEventListener(e, function (event) { 21 const overlaySelector = '[data-overlay="' + btn.getAttribute('data-overlay-toggle') + '"]'; 22 const overlayElement = document.querySelector(overlaySelector); 23 if (overlayElement) { 24 overlayElement.toggleAttribute('aria-hidden'); 25 } 26 }); 27 }); 28 }); 29 }, 30 detach: function detach(context, settings, trigger) { 31 if (trigger === "unload") { 32 once.remove(this.onceName, context.querySelectorAll(toggleSelector)); 33 } 34 }, 35 }; 36})(Drupal, once);
Line numbers count LF bytes from the start of the resource, as the search results do. Vendor segments are library code the classifier recognised; they are stored but not indexed. Bytes are shown as Latin1 characters, one per byte.