PageSourceSearch

https://chauffry.fr/modules/extensions/stratis_gdpr/js/tarteaucitron.init.js?v=1.x

js chauffry.fr collected 2026-09-25 09:38:54 UTC 5,954 bytes, 158 lines download raw bytes

1(function ($, Drupal, drupalSettings) {
2  if (drupalSettings.langcode !== undefined) {
3    tarteaucitronForceLanguage = drupalSettings.langcode;
4  }
5
6  if (typeof drupalSettings.stratis_gdpr.tarteaucitron !== 'undefined') {
7    var tart_conf = drupalSettings.stratis_gdpr.tarteaucitron;
8
9    if (tart_conf.settings.tarteaucitronForceExpire !== 'undefined' && tart_conf.settings.tarteaucitronForceExpire !== null) {
10      tarteaucitronForceExpire = parseInt(tart_conf.settings.tarteaucitronForceExpire);
11    }
12
13    if (tart_conf.customText !== 'undefined' && tart_conf.customText !== null) {
14      tarteaucitronCustomText = tart_conf.customText;
15    }
16
17    if (tarteaucitron) {
18
19      var cookiesToObject = function cookiesToObject(cookies) {
20        return cookies.split('!').filter(function (cookie) {
21          return cookie !== '';
22        }).reduce(function (current, next) {
23          var nextSplit = next.split('='),
24              key = nextSplit[0],
25              value = nextSplit[1];
26          current[key] = value;
27          return current;
28        }, {});
29      };
30
31      var handleFancyboxServiceCookies = function handleFancyboxServiceCookies() {
32        var cookies = cookiesToObject(tarteaucitron.cookie.read());
33
34        if (cookies.youtube === 'false' || cookies.vimeo === 'false' || cookies.dailymotion === 'false') {
35          tarteaucitron.cookie.create('fancybox', false);
36        }
37      };
38
39      tarteaucitron.services.fancybox = {
40        key: 'fancybox',
41        type: 'video',
42        name: 'FancyboxService',
43        needConsent: true,
44        cookies: [],
45        js: function js() {},
46        fallback: function fallback() {
47          tarteaucitron.fallback(['js-fancybox-check-cookies'], function (item) {
48            var id = item.href.match(/youtube|youtu|vimeo|dailymotion/ig);
49            if (id) {
50              if(id[0] === 'youtu'){
51                id[0] = 'youtube';
52              }
53              var service = id[0];
54              var cookies = cookiesToObject(tarteaucitron.cookie.read());
55              if (cookies[service] === 'true') {
56                return item;
57              }
58
59              var itemToPaste = document.createElement('button');
60              var tempNode = document.createElement('div');
61
62              tempNode.innerHTML = tarteaucitron.engage(service);
63
64              var childNodes = tempNode.querySelector('.tac_float').childNodes;
65              var text = childNodes[0];
66              var button = childNodes[1];
67
68              itemToPaste.className = `${button.className} ${item.className} cookies-denied`;
69              itemToPaste.id = button.id;
70              itemToPaste.innerHTML = '';
71
72              itemToPaste.appendChild(text);
73
74              itemToPaste.innerHTML = `<span>${itemToPaste.innerHTML.trim()}</span>`;
75              itemToPaste.setAttribute('type', 'button');
76
77              item.parentElement.replaceChild(itemToPaste, item);
78
79              itemToPaste.addEventListener('click', function (e) {
80                e.preventDefault();
81                location.reload();
82              });
83
84              var galleryList = itemToPaste.classList.contains('gallery-item') ? itemToPaste.parentElement.parentElement : itemToPaste.parentElement;
85
86              if (galleryList) {
87                var haveLinks = galleryList.querySelector('a');
88                var hasBlockedElements = galleryList.querySelector('button');
89
90                if (!haveLinks) {
91                  galleryList.classList.add('no-links');
92                }
93
94                if (hasBlockedElements) {
95                  galleryList.classList.add('has-blocked-elements');
96                }
97              }
98
99              return itemToPaste;
100            }
101          }, true);
102        },
103      };
104      tarteaucitron.reloadThePage = true;
105      tarteaucitron.events.load = handleFancyboxServiceCookies;
106      window.addEventListener('tac.root_available', function () {
107        var CTAButtons = [].slice.call(document.querySelectorAll('.tarteaucitronCTAButton'));
108
109        CTAButtons.forEach(function (button) {
110          button.addEventListener('click', function () {
111            location.reload();
112          });
113        });
114      });
115    }
116    window.addEventListener('tac.close_panel', handleFancyboxServiceCookies);
117    tarteaucitron.init(tart_conf.settings);
118
119    // Google Analytics or Matomo.
120    if (typeof statisticsId !== 'undefined' && typeof useMatomoOrGoogleAnalytics !== 'undefined') {
121      if (useMatomoOrGoogleAnalytics === 'google' && typeof tart_conf.services.analytics !== 'undefined') {
122        tarteaucitron.user.analyticsUa = statisticsId;
123        tarteaucitron.user.analyticsMore = function () { /* add here your optionnal ga.push() */};
124      }
125      if (typeof matomoUrl !== 'undefined' && useMatomoOrGoogleAnalytics === 'matomo' && typeof tart_conf.services.matomo !== 'undefined') {
126        tarteaucitron.user.matomoId = statisticsId;
127        tarteaucitron.user.matomoHost = matomoUrl;
128      }
129    }
130
131    $.each(tart_conf.services, function(item, i) {
132      (tarteaucitron.job = tarteaucitron.job || []).push(i);
133    });
134    tarteaucitron.job.push('fancybox');
135
136    if (tarteaucitron.job.length) {
137      var serviceAllowButtonsHandler = function serviceAllowButtonsHandler() {
138        var tacRoot = document.getElementById('tarteaucitronRoot');
139
140        var allowButtons = [].slice.call(document.querySelectorAll('.tarteaucitronAllow:not(.has-listener)')).filter(function (item) {
141          return item && !tacRoot.contains(item);
142        });
143
144        allowButtons.forEach(function (button) {
145          button.classList.add('has-listener');
146          button.addEventListener('click', function () {
147            location.reload();
148          });
149        });
150      };
151
152      tarteaucitron.job.forEach(function (serviceName) {
153        document.addEventListener("".concat(serviceName, "_added"), serviceAllowButtonsHandler);
154      });
155    }
156  }
157
158})(jQuery, Drupal, drupalSettings);

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.