1/** 2* DO NOT EDIT THIS FILE. 3* See the following change record for more information, 4* https://www.drupal.org/node/2815083 5* @preserve 6**/ 7 8(function ($, Drupal, cookies, once) { 9 'use strict'; 10 11 var $window = $(window); 12 var renewConsentTriggerEventName = 'cookiebotConsentRenew'; 13 14 /** 15 * Capitalize the first character of a given string. 16 * 17 * @param {string} string 18 * The string to capitalize the first character of. 19 * 20 * @return {string} 21 * The string with the first letter capitalized. 22 */ 23 var capitalizeFirstCharacter = function (string) { 24 return string[0].toUpperCase() + string.substring(1); 25 }; 26 27 /** 28 * Listens to event of a user accepting the use of cookies. 29 * 30 * This is also called on every page load when cookies are already accepted. 31 */ 32 $window.on('CookiebotOnAccept', function () { 33 Drupal.cookiebot.updateCookies(); 34 }); 35 36 /** 37 * Listens to the event of a user declining the use of cookies. 38 * 39 * This is also called on every page load when cookies are already declined. 40 */ 41 $window.on('CookiebotOnDecline', function () {
42 Drupal.cookiebot.updateCookies(); 43 }); 44 45 /** 46 * Listens to event of a user wanting to change their cookies consent. 47 */ 48 $window.on(renewConsentTriggerEventName, function () { 49 if (typeof Cookiebot === 'undefined') { 50 return; 51 } 52 53 Cookiebot.renew(); 54 }); 55 56 /** 57 * Attach Cookiebot renew click event listener. 58 * 59 * @type {Drupal~behavior} 60 */ 61 Drupal.behaviors.cookiebot = { 62 attach: function attach(context) { 63 Drupal.cookiebot.updateCookies(); 64 65 $('.cookiebot-renew', context).on('click', (event) => { 66 event.preventDefault(); 67 $window.trigger(renewConsentTriggerEventName); 68 }); 69 } 70 }; 71 72 /** 73 * Updates cookies for Cookiebot. 74 * 75 * We set our own cookies to be able to provide integration with other Drupal 76 * modules, without relying on the cookies of Cookiebot, since those are not 77 * part of the public API. 78 */ 79 Drupal.cookiebot = { 80 updateCookies: function updateCookies() { 81 var cookieNames = [ 82 'necessary', 83 'preferences', 84 'statistics', 85 'marketing' 86 ]; 87 88 if (typeof Cookiebot === 'undefined' || Cookiebot.consent === void (0)) { 89 return; 90 } 91 92 $.each(cookieNames, function (index, cookieName) { 93 if (Cookiebot.consent[cookieName] === true && cookies.get('cookiebot-consent--' + cookieName) !== '1') { 94 cookies.set('cookiebot-consent--' + cookieName, '1', JSON.stringify({ 95 path: '/' 96 })); 97 $window.trigger('cookiebotConsentAccept' + capitalizeFirstCharacter(cookieName)); 98 return; 99 } 100 101 if (Cookiebot.consent[cookieName] === false && cookies.get('cookiebot-consent--' + cookieName) !== '0') { 102 cookies.set('cookiebot-consent--' + cookieName, '0', JSON.stringify({ 103 path: '/' 104 })); 105 $window.trigger('cookiebotConsentDecline' + capitalizeFirstCharacter(cookieName)); 106 } 107 }); 108 109 if (drupalSettings.cookiebot.message_placeholder_cookieconsent_optout_marketing_show && drupalSettings.cookiebot.message_placeholder_cookieconsent_optout_marketing.length > 0) { 110 var message_placeholder_cookieconsent_optout_marketing = drupalSettings.cookiebot.message_placeholder_cookieconsent_optout_marketing.replace('!cookiebot_renew', 'javascript:Cookiebot.renew()'); 111 $('[data-cookieconsent="marketing"][data-src]').each(function () { 112 var cookiebot_from_src_url = ''; 113 if ($(this).attr('data-src').length) { 114 cookiebot_from_src_url = $(this).attr('data-src'); 115 } 116 $(once('cb-message-placeholder-cookieconsent-optout-marketing', this)).after(message_placeholder_cookieconsent_optout_marketing.replace(new RegExp('!cookiebot_from_src_url', 'g'), cookiebot_from_src_url)); 117 }); 118 } 119 } 120 }; 121 122})(jQuery, Drupal, window.Cookies, 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.