PageSourceSearch

https://www.escandolieres.fr/plugins/lae-cookies/assets/js/lae-cmp-100.js

js escandolieres.fr collected 2026-10-02 21:38:54 UTC 11,616 bytes, 328 lines download raw bytes

1(function () {
2
3  var tarteaucitronForceCDN = window.location.protocol + '//' + window.location.host + '/plugins/lae-cookies/assets/tarteaucitron/'; // pour forcer chemin fichiers langue
4
5  tarteaucitron.init({
6    "privacyUrl": laeCookiesOptions.privacyUrl,
7    "hashtag": "#rgpd",
8    "cookieName": laeCookiesOptions.cookieName ? laeCookiesOptions.cookieName : "lae-rgpd",
9
10    "orientation": "bottom",
11
12    "groupServices": false,
13    "serviceDefaultState": "wait",
14
15    "showAlertSmall": false,
16    "cookieslist": true,
17
18    "showIcon": false,
19    "iconPosition": "BottomLeft",
20    "adblocker": false,
21    "DenyAllCta": true,
22    "AcceptAllCta": true,
23    "highPrivacy": true,
24    "handleBrowserDNTRequest": false,
25    "removeCredit": true,
26    "moreInfoLink": true,
27    "useExternalCss": false,
28    "readmoreLink": laeCookiesOptions.privacyUrl,
29    "mandatory": false,
30    "bodyPosition": "top",
31    "googleConsentMode": false, // laisser à false [QUG]
32    "bingConsentMode": false,
33    "dataLayer": true
34  });
35
36
37
38  var isAdmin = laeCookiesOptions.is_user_logged_in === '1';
39  var lHost = window.location.host;
40  var isLoc = lHost && lHost.endsWith('.loc');
41  var showBanner = false;
42  var tac_ck_name = laeCookiesOptions.cookieName ? laeCookiesOptions.cookieName : 'lae-rgpd';
43  tarteaucitron.job = tarteaucitron.job || [];
44
45  var tacServiceKeys = ['TAC_TIKTOK', 'TAC_SNAPCHAT', 'TAC_GGA', 'TAC_LINKEDIN', 'TAC_ADS', 'TAC_FB', 'TAC_BING', 'TAC_CLARITY', 'TAC_CRITEO', 'TAC_MATOMO'];
46  var hasTacService = tacServiceKeys.some(function (k) { return laeCookiesOptions[k]; });
47  if (hasTacService) {
48    showBanner = true;
49  }
50
51  if (showBanner) {
52    tarteaucitron.addInternalScript('/plugins/lae-cookies/assets/js/custom-services.js', '', function () {
53      tarteaucitron.job = tarteaucitron.job || [];
54      if (!isAdmin && !isLoc) {
55        tacServiceKeys.forEach(function (k) {
56          if (laeCookiesOptions[k]) {
57            tarteaucitron.job.push(k);
58          }
59        });
60      }
61    });
62  }
63
64  if (!isAdmin && !isLoc) {
65
66    if (!laeCookiesOptions.gtmDur && laeCookiesOptions.googletagmanagerId && laeCookiesOptions.googletagmanagerId !== 'GTM-XXXXXXX') {
67      tarteaucitron.user.googletagmanagerId = '' + laeCookiesOptions.googletagmanagerId;
68      tarteaucitron.job.push('googletagmanager');
69      showBanner = true;
70    } else if (laeCookiesOptions.analyticsUa) {
71      if (laeCookiesOptions.analyticsUa.substring(0, 3) === 'UA-') {
72        tarteaucitron.user.analyticsUa = laeCookiesOptions.analyticsUa;
73        tarteaucitron.job.push('analytics');
74        showBanner = true;
75      } else {
76        tarteaucitron.user.gtagUa = laeCookiesOptions.analyticsUa;
77        tarteaucitron.job.push('gtag');
78        showBanner = true;
79      }
80    }
81    if (laeCookiesOptions.facebookpixelId) {
82      tarteaucitron.user.facebookpixelId = '' + laeCookiesOptions.facebookpixelId;
83      tarteaucitron.job.push('facebookpixel');
84      showBanner = true;
85    }
86    if (laeCookiesOptions.tiktokpixelId) {
87      tarteaucitron.user.tiktokId = '' + laeCookiesOptions.tiktokpixelId;
88      tarteaucitron.job.push('tiktok');
89      showBanner = true;
90    }
91    if (laeCookiesOptions.pinterestpixelId) {
92      tarteaucitron.user.pinterestpixelId = '' + laeCookiesOptions.pinterestpixelId;
93      tarteaucitron.job.push('pinterestpixel');
94      showBanner = true;
95    }
96    if (laeCookiesOptions.linkedininsighttag) {
97      tarteaucitron.user.linkedininsighttag = '' + laeCookiesOptions.linkedininsighttag;
98      tarteaucitron.job.push('linkedininsighttag');
99      showBanner = true;
100    }
101    if (laeCookiesOptions.adsensecapub) {
102      tarteaucitron.user.adsensecapub = '' + laeCookiesOptions.adsensecapub;
103      tarteaucitron.job.push('adsenseauto');
104      showBanner = true;
105    }
106  }
107
108  if (laeCookiesOptions.youtube) {
109    tarteaucitron.job.push('youtube');
110    tarteaucitron.job.push('youtubeapi');
111    showBanner = true;
112  }
113
114  if (laeCookiesOptions.vimeo) {
115    tarteaucitron.job.push('vimeo');
116    tarteaucitron.job.push('vimeoapi');
117    showBanner = true;
118  }
119
120  function getCookie(cname) {
121    var name = cname + "=";
122    var decodedCookie;
123    try {
124      decodedCookie = decodeURIComponent(document.cookie);
125    } catch (e) {
126      return "";
127    }
128    var ca = decodedCookie.split(';');
129    for (var i = 0; i < ca.length; i++) {
130      var c = ca[i];
131      while (c.charAt(0) === ' ') {
132        c = c.substring(1);
133      }
134      if (c.indexOf(name) === 0) {
135        return c.substring(name.length, c.length);
136      }
137    }
138    return "";
139  }
140
141  function getFocusables(container) {
142    var sel = 'a[href], button:not([disabled]), [tabindex]:not([tabindex="-1"])';
143    var raw = Array.prototype.slice.call(container.querySelectorAll(sel));
144    // Ne garder que les éléments visibles (exclut .btns--desk en mobile / .btns:not(.btns--desk) en desktop)
145    return raw.filter(function (el) {
146      return el.offsetHeight > 0;
147    });
148  }
149
150  var LaeRgpdPop = function () {
151    this.dom = null;
152    this._focusTrapKeydown = null;
153    var popMasque = localStorage.getItem(tac_ck_name + '-pop');
154    if (!(popMasque && popMasque === 'true')) {
155      this.show();
156      return;
157    }
158    // else verification si tarte au citron en attente
159    // si cookie supprimé à la main ou si internaute utilise bouton personnaliser sans répondre
160    var now = Date.now();
161    var checkCookie = localStorage.getItem(tac_ck_name + '-cookie-check');
162    if (!checkCookie || parseInt(checkCookie, 10) < (now - 24 * 60 * 60 * 1000)) {
163      // verification cookie une seule fois par jour, pas à chaque page
164      var cookieRgpd = getCookie(tac_ck_name);
165      if (!cookieRgpd || cookieRgpd.includes('wait')) {
166        this.show();
167      }
168    }
169  };
170  LaeRgpdPop.prototype.show = function () {
171    var that = this;
172    this.dom = document.createElement('div');
173    if (laeCookiesOptions.alertBigPrivacy && laeCookiesOptions.alertBigPrivacy !== '') {
174      tarteaucitron.lang.alertBigPrivacy = laeCookiesOptions.alertBigPrivacy;
175    }
176    this.dom.innerHTML = '<div class="txt">' + tarteaucitron.lang.alertBigPrivacy + '<p><a target="_blank" href="' + laeCookiesOptions.privacyUrl + '">' + tarteaucitron.lang.privacyUrl + '</a></p></div>';
177
178    this.btns = document.createElement('ul');
179    this.btns.setAttribute('class', 'btns');
180
181    this.denyBtn = document.createElement('button');
182    this.denyBtn.setAttribute('class', 'btn deny');
183    this.denyBtn.innerHTML = tarteaucitron.lang.denyAll;
184    this.denyBtn.onclick = function () {
185      tarteaucitron.userInterface.respondAll(false);
186      that.hide();
187      that.sendStat('deny');
188    };
189
190    this.personalizeBtn = document.createElement('button');
191    this.personalizeBtn.setAttribute('class', 'btn personalize');
192    this.personalizeBtn.innerHTML = tarteaucitron.lang.personalize;
193    this.personalizeBtn.onclick = function () {
194      tarteaucitron.userInterface.openPanel();
195      that.hide(false);
196      that.sendStat('personalize');
197    };
198    if (laeCookiesOptions.allowAll && laeCookiesOptions.allowAll !== '') {
199      tarteaucitron.lang.allowAll = laeCookiesOptions.allowAll;
200    }
201    this.allowBtn = document.createElement('button');
202    this.allowBtn.setAttribute('class', 'btn allow');
203    this.allowBtn.innerHTML = tarteaucitron.lang.allowAll;
204    this.allowBtn.onclick = function () {
205      tarteaucitron.userInterface.respondAll(true);
206      that.hide();
207      that.sendStat('allow');
208    };
209
210    [that.allowBtn, that.personalizeBtn, that.denyBtn].forEach(function (btn) {
211      var li = document.createElement('li');
212      li.appendChild(btn);
213      that.btns.appendChild(li);
214    });
215
216    this.dom.appendChild(that.btns);
217
218    this.btnsD = document.createElement('ul');
219    this.btnsD.setAttribute('class', 'btns btns--desk');
220
221    this.denyBtnD = that.denyBtn.cloneNode(true);
222    this.denyBtnD.onclick = function () {
223      tarteaucitron.userInterface.respondAll(false);
224      that.hide();
225      that.sendStat('deny');
226    };
227
228    this.personalizeBtnD = that.personalizeBtn.cloneNode(true);
229    this.personalizeBtnD.onclick = function () {
230      tarteaucitron.userInterface.openPanel();
231      that.hide(false);
232      that.sendStat('personalize');
233    };
234
235    this.allowBtnD = that.allowBtn.cloneNode(true);
236    this.allowBtnD.onclick = function () {
237      tarteaucitron.userInterface.respondAll(true);
238      that.hide();
239      that.sendStat('allow');
240    };
241
242    [this.denyBtnD, this.personalizeBtnD, this.allowBtnD].forEach(function (btn) {
243      var li = document.createElement('li');
244      li.appendChild(btn);
245      that.btnsD.appendChild(li);
246    });
247
248    this.dom.appendChild(that.btnsD);
249
250    this.dom.id = 'lae-rgpd-pop';
251    document.getElementById('tarteaucitronRoot').appendChild(that.dom);
252    var skipLinksList = document.querySelector('ul.skip-links');
253    if (skipLinksList) {
254      var listItem = document.createElement('li');
255      var anchor = document.createElement('a');
256      anchor.href = '#lae-rgpd-pop';
257      anchor.classList.add('skip-link');
258      anchor.classList.add('screen-reader-text');
259      anchor.textContent = 'Aller au bandeau consentement cookies';
260      listItem.appendChild(anchor);
261      skipLinksList.prepend(listItem);
262      that._skipLinkListItem = listItem;
263    }
264
265    // Focus initial : la popup est focus en premier (conteneur puis premier focusable au Tab)
266    that.dom.setAttribute('tabindex', '-1');
267    var focusables = getFocusables(that.dom);
268    that.dom.focus();
269
270    // Focus trap : Tab / Shift+Tab restent dans #lae-rgpd-pop
271    that._focusTrapKeydown = function (e) {
272      if (e.key !== 'Tab') return;
273      var container = document.getElementById('lae-rgpd-pop');
274      if (!container || !document.body.contains(container)) return;
275      var list = getFocusables(container);
276      if (list.length === 0) return;
277      var current = document.activeElement;
278      var currentIndex = list.indexOf(current);
279      if (currentIndex === -1 && current !== container) return;
280      // currentIndex === -1 quand le focus est sur le conteneur (tabindex="-1")
281      if (e.shiftKey) {
282        if (currentIndex <= 0) {
283          e.preventDefault();
284          list[list.length - 1].focus();
285        }
286      } else {
287        if (currentIndex === list.length - 1 || currentIndex === -1) {
288          e.preventDefault();
289          list[0].focus();
290        }
291      }
292    };
293    document.addEventListener('keydown', that._focusTrapKeydown);
294  };
295  LaeRgpdPop.prototype.sendStat = function (action) {
296    var xhr = new XMLHttpRequest();
297    xhr.withCredentials = true;
298    xhr.open("GET", "https://webservices.laetis.fr/public/rgpd/data-stat-popup/" + action + "--" + window.location.hostname);
299    xhr.send();
300  };
301  LaeRgpdPop.prototype.hide = function (setCookieCheck) {
302    if (setCookieCheck === undefined) setCookieCheck = true;
303    if (this._focusTrapKeydown) {
304      document.removeEventListener('keydown', this._focusTrapKeydown);
305      this._focusTrapKeydown = null;
306    }
307    if (this._skipLinkListItem && this._skipLinkListItem.parentNode) {
308      this._skipLinkListItem.parentNode.removeChild(this._skipLinkListItem);
309      this._skipLinkListItem = null;
310    }
311    localStorage.setItem(tac_ck_name + '-pop', 'true');
312    if (setCookieCheck) {
313      var now = Date.now();
314      localStorage.setItem(tac_ck_name + '-cookie-check', now);
315    }
316    if (this.dom && this.dom.parentNode) {
317      this.dom.parentNode.removeChild(this.dom);
318    }
319  };
320
321
322  if (!isAdmin && !isLoc && showBanner) {
323    window.addEventListener("tac.root_available", function () {
324      new LaeRgpdPop();
325    }, false);
326  }
327
328})();

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.