1(function ($, Drupal) { 2 "use strict"; 3 4 Drupal.behaviors.showBootstrapModal = { 5 isInited: false, 6 attach: function (context, settings) { 7 if (this.isInited) return; 8 this.isInited = true; 9 10 var selectors = settings.showBootstrapModal; 11 12 var showModal = function () { 13 Object.keys(selectors).forEach(function (target) { 14 var selector = $(settings.showBootstrapModal[target]); 15 if (selector.length) { 16 selector.modal('show'); 17 } 18 }); 19 }; 20 21 var waitForOneTrust = function () { 22 var attempts = 0; 23 var maxAttempts = 50; // ~5s 24 var interval = setInterval(function () { 25 var banner = document.getElementById('onetrust-banner-sdk'); 26 attempts++; 27 28 if (banner) { 29 clearInterval(interval); 30 // Add delay only after user interacts with OneTrust 31 $(document).on('click', '#onetrust-accept-btn-handler, #onetrust-reject-all-handler', function () { 32 setTimeout(showModal, 800); 33 }); 34 } else if (attempts >= maxAttempts) { 35 clearInterval(interval); 36 showModal(); 37 } 38 }, 100); 39 }; 40 41 // Wait until page and external scripts (like OneTrust) have loaded 42 $(window).on('load', function () { 43 waitForOneTrust(); 44 }); 45 } 46 }; 47 48})(jQuery, Drupal);
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.