1(function (Drupal, once) { 2 'use strict'; 3 4 function openDialog(dialog) { 5 if (!dialog) return; 6 if (typeof dialog.showModal === 'function') { 7 try { dialog.showModal(); } catch (e) { dialog.setAttribute('open', 'open'); } 8 } 9 else { 10 dialog.setAttribute('open', 'open'); 11 } 12 } 13 14 function closeDialog(dialog) { 15 if (!dialog) return; 16 if (typeof dialog.close === 'function') { 17 try { dialog.close(); } catch (e) { dialog.removeAttribute('open'); } 18 } 19 else { 20 dialog.removeAttribute('open'); 21 } 22 } 23 24 Drupal.behaviors.lifebetAutoPredictHubHelp = { 25 attach: function (context) { 26 once('lifebetAutoPredictHubHelp', '.lb-glossary', context).forEach(function (wrap) { 27 var btn = wrap.querySelector('.lb-glossary-btn'); 28 var dialogId = btn ? btn.getAttribute('aria-controls') : null; 29 var dialog = dialogId ? document.getElementById(dialogId) : null; 30 if (!btn || !dialog) return; 31 32 btn.addEventListener('click', function (e) { 33 e.preventDefault(); 34 openDialog(dialog); 35 }); 36 37 // Close buttons. 38 dialog.querySelectorAll('[data-lb-dialog-close]').forEach(function (el) { 39 el.addEventListener('click', function (e) { 40 e.preventDefault(); 41 closeDialog(dialog); 42 }); 43 }); 44 45 // Click on backdrop to close (native dialog only). 46 dialog.addEventListener('click', function (e) { 47 // If click is directly on dialog element (backdrop area), close. 48 if (e.target === dialog) { 49 closeDialog(dialog); 50 } 51 }); 52 53 // Esc key fallback for non-native. 54 dialog.addEventListener('keydown', function (e) { 55 if (e.key === 'Escape') { 56 e.preventDefault(); 57 closeDialog(dialog); 58 } 59 }); 60 }); 61 } 62 }; 63})(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.