1function createSnippet(scriptToLoad) { 2 const {src, attachName} = scriptToLoad; 3 const tag = document.createElement('script'); 4 tag.src = decodeURI(src); 5 if (attachName) { 6 const intervalId = setInterval(() => { 7 if (Drupal.behaviors[attachName]) { 8 Drupal.behaviors[attachName].attach(document, drupalSettings); 9 clearInterval(intervalId); 10 } 11 }, 100); 12 } 13 document.body.appendChild(tag); 14} 15window.euCookieComplianceLoadScripts = function(category) { 16 const unverifiedScripts = drupalSettings.eu_cookie_compliance.unverified_scripts; 17 const scriptList = [{"src":"/modules/contrib/google_analytics/js/google_analytics.js","categoryName":"statistics"},{"src":"https://static.addtoany.com/menu/page.js","categoryName":"social_media"},{"src":"/modules/contrib/addtoany/js/addtoany.js","categoryName":"social_media"}]; 18 19 scriptList.forEach(scriptToLoad => { 20 const {src, categoryName} = scriptToLoad; 21 if (!unverifiedScripts.includes(src)) { 22 if (!category && !categoryName) { 23 // Load scripts without any categories specified. 24 createSnippet(scriptToLoad); 25 } else if (categoryName === category) { 26 // Load scripts for the specific category. 27 createSnippet(scriptToLoad); 28 } 29 } 30 }); 31}
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.