1(function (global) { 2 'use strict'; 3 4 var currentScript = document.currentScript; 5 var scriptUrl = currentScript && currentScript.src 6 ? new URL(currentScript.src, document.baseURI) 7 : null; 8 var moduleUrl = currentScript && currentScript.src 9 ? new URL('../src/cookie-banner.js', currentScript.src).href 10 : new URL('src/cookie-banner.js', document.baseURI).href; 11 12 // Reutiliza la versión del script distribuido para evitar servir un módulo cacheado. 13 if (scriptUrl && scriptUrl.searchParams.get('v')) { 14 var cacheBuster = new URL(moduleUrl); 15 cacheBuster.searchParams.set('v', scriptUrl.searchParams.get('v')); 16 moduleUrl = cacheBuster.href; 17 } 18 19 function removePreferencesButton() { 20 document.querySelectorAll('.cookie-banner__preferences-trigger, [data-cookie-preferences-trigger]') 21 .forEach(function (button) { button.remove(); }); 22 } 23 24 var ready = import(moduleUrl).then(function (module) { 25 return module; 26 }); 27 28 global.CookieBanner = { 29 ready: ready, 30 init: function (config) { 31 return ready.then(function (module) { 32 var cookieBanner = module.initCookieBanner(config || {}); 33 if (config && (config.showPreferencesButton === false || config.showPreferencesButton === 'false')) { 34 removePreferencesButton(); 35 } 36 return cookieBanner; 37 }); 38 }, 39 initAsync: function (config) { 40 return ready.then(function (module) { 41 return module.initCookieBannerAsync(config || {}).then(function (cookieBanner) { 42 if (config && (config.showPreferencesButton === false || config.showPreferencesButton === 'false')) { 43 removePreferencesButton(); 44 } 45 return cookieBanner; 46 }); 47 }); 48 }, 49 load: ready 50 }; 51 52 global.CookieBannerReady = ready; 53}(window));
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.