PageSourceSearch

https://wikiprepa.fr/wp-content/uploads/tarteaucitron/tarteaucitron.js

js wikiprepa.fr collected 2026-10-08 05:31:53 UTC 141,965 bytes, 2,723 lines download raw bytes

vendor: 141,965 bytes, lines 1-2723
1/*jslint browser: true, evil: true */
2/* min ready */
3
4var tarteaucitronScriptsDiscover = document.getElementsByTagName('script'),
5    tarteaucitronCurrentScript = document.currentScript instanceof HTMLScriptElement
6        ? document.currentScript
7        : tarteaucitronScriptsDiscover[tarteaucitronScriptsDiscover.length - 1],
8    tarteaucitronPath = tarteaucitronCurrentScript.src.split('?')[0],
9    tarteaucitronForceCDN = (tarteaucitronForceCDN === undefined) ? '' : tarteaucitronForceCDN,
10    tarteaucitronUseMin = (tarteaucitronUseMin === undefined) ? '' : tarteaucitronUseMin,
11    cdn = (tarteaucitronForceCDN === '') ? tarteaucitronPath.split('/').slice(0, -1).join('/') + '/' : tarteaucitronForceCDN,
12    alreadyLaunch = (alreadyLaunch === undefined) ? 0 : alreadyLaunch,
13    tarteaucitronForceLanguage = (tarteaucitronForceLanguage === undefined) ? '' : tarteaucitronForceLanguage,
14    tarteaucitronForceExpire = (tarteaucitronForceExpire === undefined) ? '' : tarteaucitronForceExpire,
15    tarteaucitronCustomText = (tarteaucitronCustomText === undefined) ? '' : tarteaucitronCustomText,
16    // tarteaucitronExpireInDay: true for day(s) value - false for hour(s) value
17    tarteaucitronExpireInDay = (tarteaucitronExpireInDay === undefined || typeof tarteaucitronExpireInDay !== "boolean") ? true : tarteaucitronExpireInDay,
18    timeExpire = 31536000000,
19    tarteaucitronProLoadServices,
20    tarteaucitronNoAdBlocker = false,
21    tarteaucitronIsLoaded = false;
22
23
24var tarteaucitron = {
25    "version": "1.35.0",
26    "cdn": cdn,
27    "user": {},
28    "lang": {},
29    "services": {},
30    "added": [],
31    "idprocessed": [],
32    "state": {},
33    "launch": [],
34    "parameters": {},
35    "isAjax": false,
36    "reloadThePage": false,
37    "events": {
38        "init": function () {},
39        "load": function () {},
40    },
41    "init": function (params) {
42        "use strict";
43        var origOpen;
44
45        tarteaucitron.parameters = params;
46        if (alreadyLaunch === 0) {
47            alreadyLaunch = 1;
48            if (window.addEventListener) {
49                if( document.readyState === "complete" ) {
50                    tarteaucitron.initEvents.loadEvent(false);
51                } else {
52                    window.addEventListener("load", function () {
53                        tarteaucitron.initEvents.loadEvent(false);
54                    }, false);
55                }
56                window.addEventListener("scroll", function () {
57                    tarteaucitron.initEvents.scrollEvent();
58                }, false);
59
60                window.addEventListener("keydown", function (evt) {
61                    tarteaucitron.initEvents.keydownEvent(false, evt);
62                }, false);
63                window.addEventListener("hashchange", function () {
64                    tarteaucitron.initEvents.hashchangeEvent();
65                }, false);
66                window.addEventListener("resize", function () {
67                    tarteaucitron.initEvents.resizeEvent();
68                }, false);
69            } else {
70                if( document.readyState === "complete" ) {
71                    tarteaucitron.initEvents.loadEvent(true);
72                } else {
73                    window.attachEvent("onload", function () {
74                        tarteaucitron.initEvents.loadEvent(true);
75                    });
76                }
77                window.attachEvent("onscroll", function () {
78                    tarteaucitron.initEvents.scrollEvent();
79                });
80                window.attachEvent("onkeydown", function (evt) {
81                    tarteaucitron.initEvents.keydownEvent(true, evt);
82
83                });
84                window.attachEvent("onhashchange", function () {
85                    tarteaucitron.initEvents.hashchangeEvent();
86                });
87                window.attachEvent("onresize", function () {
88                    tarteaucitron.initEvents.resizeEvent();
89                });
90            }
91
92            if (typeof XMLHttpRequest !== 'undefined') {
93                origOpen = XMLHttpRequest.prototype.open;
94                XMLHttpRequest.prototype.open = function () {
95
96                    if (window.addEventListener) {
97                        this.addEventListener("load", function () {
98                            if (typeof tarteaucitronProLoadServices === 'function') {
99                                tarteaucitronProLoadServices();
100                            }
101                        }, false);
102                    } else if (typeof this.attachEvent !== 'undefined') {
103                        this.attachEvent("onload", function () {
104                            if (typeof tarteaucitronProLoadServices === 'function') {
105                                tarteaucitronProLoadServices();
106                            }
107                        });
108                    } else {
109                        if (typeof tarteaucitronProLoadServices === 'function') {
110                            setTimeout(tarteaucitronProLoadServices, 1000);
111                        }
112                    }
113
114                    try {
115                        origOpen.apply(this, arguments);
116                    } catch (err) {}
117                };
118            }
119        }
120
121        if(tarteaucitron.events.init) {
122            tarteaucitron.events.init();
123        }
124    },
125    "initEvents": {
126        "loadEvent": function (isOldBrowser) {
127            tarteaucitron.load();
128            tarteaucitron.fallback(['tarteaucitronOpenPanel'], function (elem) {
129                if (isOldBrowser) {
130                    elem.attachEvent("onclick", function (event) {
131                        tarteaucitron.userInterface.openPanel();
132                        event.preventDefault();
133                    });
134                } else {
135                    elem.addEventListener("click", function (event) {
136                        tarteaucitron.userInterface.openPanel();
137                        event.preventDefault();
138                    }, false);
139                }
140            }, true);
141        },
142        "keydownEvent": function (isOldBrowser, evt) {
143            if (evt.keyCode === 27) {
144                tarteaucitron.userInterface.closePanel();
145            }
146
147            if (isOldBrowser) {
148                if ( evt.keyCode === 9 && focusableEls.indexOf(evt.target) >= 0) {
149                    if ( evt.shiftKey ) /* shift + tab */ {
150                        if (document.activeElement === firstFocusableEl) {
151                            lastFocusableEl.focus();
152                            evt.preventDefault();
153                        }
154                    } else /* tab */ {
155                        if (document.activeElement === lastFocusableEl) {
156                            firstFocusableEl.focus();
157                            evt.preventDefault();
158                        }
159                    }
160                }
161            }
162        },
163        "hashchangeEvent": function () {
164            if (document.location.hash === tarteaucitron.hashtag && tarteaucitron.hashtag !== '') {
165                tarteaucitron.userInterface.openPanel();
166            }
167        },
168        "resizeEvent": function () {
169            var tacElem = document.getElementById('tarteaucitron');
170            var tacCookieContainer = document.getElementById('tarteaucitronCookiesListContainer');
171
172            if (tacElem && tacElem.style.display === 'block') {
173                tarteaucitron.userInterface.jsSizing('main');
174            }
175
176            if (tacCookieContainer && tacCookieContainer.style.display === 'block') {
177                tarteaucitron.userInterface.jsSizing('cookie');
178            }
179        },
180        "scrollEvent": function () {
181            var scrollPos = window.pageYOffset || document.documentElement.scrollTop;
182            var heightPosition;
183            var tacPercentage = document.getElementById('tarteaucitronPercentage');
184            var tacAlertBig = document.getElementById('tarteaucitronAlertBig');
185
186            if (tacAlertBig && !tarteaucitron.highPrivacy) {
187                if (tacAlertBig.style.display === 'block') {
188                    heightPosition = tacAlertBig.offsetHeight + 'px';
189
190                    if (scrollPos > (screen.height * 2)) {
191                        tarteaucitron.userInterface.respondAll(true);
192                    } else if (scrollPos > (screen.height / 2)) {
193                        document.getElementById('tarteaucitronDisclaimerAlert').innerHTML = '<strong>' + tarteaucitron.lang.alertBigScroll + '</strong> ' + tarteaucitron.lang.alertBig;
194                    }
195
196                    if (tacPercentage) {
197                        if (tarteaucitron.orientation === 'top') {
198                            tacPercentage.style.top = heightPosition;
199                        } else {
200                            tacPercentage.style.bottom = heightPosition;
201                        }
202                        tacPercentage.style.width = ((100 / (screen.height * 2)) * scrollPos) + '%';
203                    }
204                }
205            }
206        },
207    },
208    "load": function () {
209        "use strict";
210
211        if (tarteaucitronIsLoaded === true) {
212            return;
213        }
214
215        var cdn = tarteaucitron.cdn,
216            language = tarteaucitron.getLanguage(),
217            useMinifiedJS = ((new URL(cdn,tarteaucitronPath).host == 'cdn.jsdelivr.net') || (tarteaucitronPath.indexOf('.min.') >= 0) || (tarteaucitronUseMin !== '')),
218            pathToLang = cdn + 'lang/tarteaucitron.' + language + (useMinifiedJS ? '.min' : '') + '.js?v=' + tarteaucitron.version,
219            pathToServices = cdn + 'tarteaucitron.services' + (useMinifiedJS ? '.min' : '') + '.js?v=' + tarteaucitron.version,
220            linkElement = document.createElement('link'),
221            defaults = {
222                "adblocker": false,
223                "hashtag": '#tarteaucitron',
224                "cookieName": 'tarteaucitron',
225                "highPrivacy": true,
226                "orientation": "middle",
227                "bodyPosition": "bottom",
228                "removeCredit": false,
229                "showAlertSmall": false,
230                "showTitleBanner": false,
231                "showDetailsOnClick": true,
232                "showIcon": true,
233                "iconPosition": "BottomRight",
234                "cookieslist": false,
235                "cookieslistEmbed": false,
236                "handleBrowserDNTRequest": false,
237                "DenyAllCta": true,
238                "AcceptAllCta" : true,
239                "moreInfoLink": true,
240                "privacyUrl": "",
241                "useExternalCss": false,
242                "useExternalJs": false,
243                "mandatory": true,
244                "mandatoryCta": true,
245                "closePopup": false,
246                "groupServices": false,
247                "serviceDefaultState": 'wait',
248                "googleConsentMode": true,
249                "pianoConsentMode": true,
250                "pianoConsentModeEssential": false,
251                "bingConsentMode": true,
252                "piwikConsentMode": true,
253                "softConsentMode": false,
254                "dataLayer": false,
255                "serverSide": false,
256                "partnersList": false,
257                "alwaysNeedConsent": false
258            },
259            params = tarteaucitron.parameters;
260
261        // flag the tac load
262        tarteaucitronIsLoaded = true;
263
264        // Don't show the middle bar if we are on the privacy policy or more page
265        if (((tarteaucitron.parameters.readmoreLink !== undefined && window.location.href == tarteaucitron.parameters.readmoreLink) || window.location.href == tarteaucitron.parameters.privacyUrl) && tarteaucitron.parameters.orientation == "middle") {
266            tarteaucitron.parameters.orientation = "bottom";
267        }
268
269        // Step -1
270        if (typeof tarteaucitronCustomPremium !== 'undefined') {
271            tarteaucitronCustomPremium();
272        }
273
274        // Step 0: get params
275        if (params !== undefined) {
276
277            for (var k in defaults) {
278                if(!tarteaucitron.parameters.hasOwnProperty(k)) {
279                    tarteaucitron.parameters[k] = defaults[k];
280                }
281            }
282        }
283
284        // global
285        tarteaucitron.orientation = tarteaucitron.parameters.orientation;
286        tarteaucitron.hashtag = tarteaucitron.parameters.hashtag;
287        tarteaucitron.highPrivacy = tarteaucitron.parameters.highPrivacy;
288        tarteaucitron.handleBrowserDNTRequest = tarteaucitron.parameters.handleBrowserDNTRequest;
289        tarteaucitron.customCloserId = tarteaucitron.parameters.customCloserId;
290
291        // update dataLayer when consent is updated
292        if (tarteaucitron.parameters.dataLayer === true) {
293            window.addEventListener('tac.root_available', function() {
294                setTimeout(function() {
295                    window.dataLayer = window.dataLayer || [];
296                    tarteaucitron.job.filter(job => tarteaucitron.state[job] === true).length > 0 &&
297                    window.dataLayer.push({
298                        event: 'tac_consent_update',
299                        tacAuthorizedVendors: tarteaucitron.job.filter(job => tarteaucitron.state[job] === true)
300                    });
301                }, 200);
302            });
303            document.addEventListener('tac.consent_updated', function () {
304                window.dataLayer = window.dataLayer || [];
305                tarteaucitron.job.filter(job => tarteaucitron.state[job] === true).length > 0 &&
306                window.dataLayer.push({
307                    event: 'tac_consent_update',
308                    tacAuthorizedVendors: tarteaucitron.job.filter(job => tarteaucitron.state[job] === true)
309                });
310            });
311        }
312
313        // piano consent mode
314        if (tarteaucitron.parameters.pianoConsentMode === true) {
315            window.pdl = window.pdl || {};
316            window.pdl.requireConsent = "v2";
317
318            if(tarteaucitron.parameters.pianoConsentModeEssential === true) {
319                window.pdl.consent = {
320                    products: ["PA"],
321                    defaultPreset: {
322                        PA: "essential",
323                    },
324                };
325            } else {
326                window.pdl.consent = {
327                    products: ["PA"],
328                    defaultPreset: {
329                        PA: "opt-out",
330                    },
331                };
332            }
333
334            document.addEventListener("pianoanalytics_consentModeOk",function () {
335                window.pdl.consent = {
336                    products: ["PA"],
337                    defaultPreset: {
338                        PA: "opt-in",
339                    },
340                };
341
342                if (window.pa && window.pa.consent && typeof window.pa.consent.setMode === "function") {
343                    window.pa.consent.setMode("opt-in");
344                }
345            }, { once: true });
346            document.addEventListener("pianoanalytics_consentModeKo",function () {
347                window.pdl.consent = {
348                    products: ["PA"],
349                    defaultPreset: {
350                        PA: "opt-out",
351                    },
352                };
353
354                if (window.pa && window.pa.consent && typeof window.pa.consent.setMode === "function") {
355                    window.pa.consent.setMode("opt-out");
356                }
357            }, { once: true });
358
359            if (tarteaucitron.parameters.softConsentMode === false) {
360                window.addEventListener('tac.root_available', function () {
361                    if (typeof tarteaucitron_block !== 'undefined') {
362                        tarteaucitron_block.unblock(/piano-analytics\.js/);
363                    }
364                });
365            }
366        }
367        
368        // bing consent mode
369        if (tarteaucitron.parameters.bingConsentMode === true) {
370            window.uetq = window.uetq || [];
371            window.uetq.push('consent', 'default', {'ad_storage': 'denied'});
372
373            window.clarity = window.clarity || function () {
374                (window.clarity.q = window.clarity.q || []).push(arguments);
375            };
376
377            document.addEventListener('clarity_consentModeOk', function () {
378                window.clarity('consentv2', {
379                    ad_Storage: "granted",
380                    analytics_Storage: "granted"
381                });
382            }, { once: true });
383            document.addEventListener('clarity_consentModeKo', function () {
384                window.clarity('consent', false);
385            }, { once: true });
386            document.addEventListener('bingads_consentModeOk', function () {
387                window.uetq.push('consent', 'update', {'ad_storage': 'granted'});
388            }, { once: true });
389            document.addEventListener('bingads_consentModeKo', function () {
390                window.uetq.push('consent', 'update', {'ad_storage': 'denied'});
391            }, { once: true });
392
393            if (tarteaucitron.parameters.softConsentMode === false) {
394                window.addEventListener('tac.root_available', function () {
395                    if (typeof tarteaucitron_block !== 'undefined') {
396                        tarteaucitron_block.unblock(/clarity\.ms/);
397                        tarteaucitron_block.unblock(/bat\.bing\.com/);
398                    }
399                });
400            }
401        }
402
403        // google consent mode
404        if (tarteaucitron.parameters.googleConsentMode === true) {
405
406            // set the dataLayer and a function to update
407            window.dataLayer = window.dataLayer || [];
408            window.tac_gtag = function tac_gtag() {
409                dataLayer.push(arguments);
410            };
411
412            // default consent to denied
413            window.tac_gtag('consent', 'default', {
414                ad_storage: 'denied',
415                analytics_storage: 'denied',
416                ad_user_data: 'denied',
417                ad_personalization: 'denied',
418                wait_for_update: 800
419            });
420
421            // if google ads, add a service for personalized ads
422            document.addEventListener('googleads_added', function() {
423
424                // skip if already added
425                if (tarteaucitron.added["gcmads"] === true) {
426                    return;
427                }
428
429                // simple service to control gcm with event
430                tarteaucitron.services.gcmads = {
431                    "key": "gcmads",
432                    "type": "ads",
433                    "name": "Google Ads (personalized ads)",
434                    "uri": "https://support.google.com/analytics/answer/9976101",
435                    "needConsent": true,
436                    "cookies": [],
437                    "js": function() {},
438                    "fallback": function() {}
439                };
440                tarteaucitron.job.push('gcmads');
441
442                // fix the event handler on the buttons
443                var i,
444                    allowBtns = document.getElementsByClassName("tarteaucitronAllow"),
445                    denyBtns = document.getElementsByClassName("tarteaucitronDeny");
446                for (i = 0; i < allowBtns.length; i++) {
447                    tarteaucitron.addClickEventToElement(allowBtns[i], function() {
448                        tarteaucitron.userInterface.respond(this, true);
449                    });
450                }
451                for (i = 0; i < denyBtns.length; i++) {
452                    tarteaucitron.addClickEventToElement(denyBtns[i], function() {
453                        tarteaucitron.userInterface.respond(this, false);
454                    });
455                }
456            });
457
458            // when personalized ads are accepted, accept googleads
459            document.addEventListener('gcmads_allowed', function() {
460                tarteaucitron.setConsent('googleads', true);
461            });
462
463            // personalized ads loaded/allowed, set gcm to granted
464            document.addEventListener('gcmads_consentModeOk', function() {
465                window.tac_gtag('consent', 'update', {
466                    ad_user_data: 'granted',
467                    ad_personalization: 'granted'
468                });
469            }, { once: true });
470
471            // personalized ads disallowed, set gcm to denied
472            document.addEventListener('gcmads_consentModeKo', function() {
473                window.tac_gtag('consent', 'update', {
474                    ad_user_data: 'denied',
475                    ad_personalization: 'denied'
476                });
477            }, { once: true });
478
479            // google ads loaded/allowed, set gcm to granted
480            document.addEventListener('googleads_consentModeOk', function() {
481                window.tac_gtag('consent', 'update', {
482                    ad_storage: 'granted'
483                });
484            }, { once: true });
485
486            // google ads disallowed, disable personalized ads and update gcm
487            document.addEventListener('googleads_consentModeKo', function() {
488                tarteaucitron.setConsent('gcmads', false);
489                window.tac_gtag('consent', 'update', {
490                    ad_storage: 'denied'
491                });
492            }, { once: true });
493
494            // ga4 loaded/allowed, set gcm to granted
495            document.addEventListener('gtag_consentModeOk', function() {
496                window.tac_gtag('consent', 'update', {
497                    analytics_storage: 'granted'
498                });
499            }, { once: true });
500
501            // ga4 disallowed, update gcm
502            document.addEventListener('gtag_consentModeKo', function() {
503                window.tac_gtag('consent', 'update', {
504                    analytics_storage: 'denied'
505                });
506            }, { once: true });
507
508            // multiple ga4 loaded/allowed, set gcm to granted
509            document.addEventListener('multiplegtag_consentModeOk', function() {
510                window.tac_gtag('consent', 'update', {
511                    analytics_storage: 'granted'
512                });
513            }, { once: true });
514
515            // multiple ga4 disallowed, update gcm
516            document.addEventListener('multiplegtag_consentModeKo', function() {
517                window.tac_gtag('consent', 'update', {
518                    analytics_storage: 'denied'
519                });
520            }, { once: true });
521
522            // allow gtag/googleads by default if consent mode is on
523            if (tarteaucitron.parameters.softConsentMode === false) {
524                window.addEventListener('tac.root_available', function () {
525                    if (typeof tarteaucitron_block !== 'undefined') {
526                        tarteaucitron_block.unblock(/www\.googletagmanager\.com\/gtag\/js/);
527                        tarteaucitron_block.unblock(/www\.googleadservices\.com\/pagead\/conversion/);
528                        tarteaucitron_block.unblock(/AW-/);
529                        tarteaucitron_block.unblock(/google-analytics\.com\/analytics\.js/);
530                        tarteaucitron_block.unblock(/google-analytics\.com\/ga\.js/);
531                    }
532                });
533            }
534        }
535
536        // piwik consent mode
537        if (tarteaucitron.parameters.piwikConsentMode === true) {
538            document.addEventListener('piwikpro_consentModeOk', function () {
539                if (typeof ppms !== 'undefined' && typeof ppms?.cm?.api === 'function') {
540                    ppms.cm.api(
541                        "setComplianceSettings",
542                        {
543                            consents: {
544                                analytics: {
545                                    status: 1,
546                                },
547                            },
548                        },
549                        console.log,
550                        console.error
551                    );
552                }
553            }, { once: true });
554            document.addEventListener('piwikpro_consentModeKo', function () {
555                if (typeof ppms !== 'undefined' && typeof ppms?.cm?.api === 'function') {
556                    ppms.cm.api(
557                        "setInitialComplianceSettings",
558                        {
559                            consents: ["analytics"],
560                        },
561                        console.log,
562                        console.error
563                    );
564                }
565            }, { once: true });
566
567            if (tarteaucitron.parameters.softConsentMode === false) {
568                window.addEventListener('tac.root_available', function () {
569                    if (typeof tarteaucitron_block !== 'undefined') {
570                        tarteaucitron_block.unblock(/\.piwik\.pro/);
571                    }
572                });
573            }
574        }
575
576        // Step 1: load css
577        if ( !tarteaucitron.parameters.useExternalCss ) {
578            linkElement.rel = 'stylesheet';
579            linkElement.type = 'text/css';
580            linkElement.href = cdn + 'css/tarteaucitron' + (useMinifiedJS ? '.min' : '') + '.css?v=' + tarteaucitron.version;
581            document.getElementsByTagName('head')[0].appendChild(linkElement);
582        }
583        // Step 2: load language and services
584        tarteaucitron.addInternalScript(pathToLang, '', function () {
585
586            if(tarteaucitronCustomText !== ''){
587                tarteaucitron.lang = tarteaucitron.AddOrUpdate(tarteaucitron.lang, tarteaucitronCustomText);
588            }
589
590            document.documentElement.style.setProperty(
591                "--tacTitleBanner",
592                JSON.stringify(tarteaucitron.lang.middleBarHead)
593            );
594
595            tarteaucitron.addInternalScript(pathToServices, '', function () {
596
597                // disable the expand option if services grouped by category
598                if (tarteaucitron.parameters.groupServices == true) {
599                    tarteaucitron.parameters.showDetailsOnClick = true;
600                }
601                
602                var body = document.body,
603                    div = document.createElement('div'),
604                    html = '',
605                    index,
606                    orientation = 'Top',
607                    modalAttrs = '',
608                    cat = ['ads', 'analytic', 'api', 'comment', 'social', 'support', 'video', 'other', 'google'],
609                    i;
610
611                cat = cat.sort(function (a, b) {
612                    if (tarteaucitron.lang[a].title > tarteaucitron.lang[b].title) { return 1; }
613                    if (tarteaucitron.lang[a].title < tarteaucitron.lang[b].title) { return -1; }
614                    return 0;
615                });
616
617                if(!/^<\s*(p|ul)(\s|>)/i.test(tarteaucitron.lang.disclaimer)) {
618                    tarteaucitron.lang.disclaimer = '<p>'+tarteaucitron.lang.disclaimer+'</p>'
619                }
620
621                // Step 3: prepare the html
622                html += '<div role="heading" aria-level="2" id="tac_title" class="tac_visually-hidden">' + tarteaucitron.lang.title + '</div>';
623                html += '<div id="tarteaucitronPremium"></div>';
624                if (tarteaucitron.reloadThePage) {
625                    html += '<button type="button" id="tarteaucitronBack" aria-label="' + tarteaucitron.lang.close + ' (' + tarteaucitron.lang.reload + ')" title="' + tarteaucitron.lang.close + ' (' + tarteaucitron.lang.reload + ')"></button>';
626                } else {
627                    html += '<button type="button" id="tarteaucitronBack" aria-label="' + tarteaucitron.lang.close + '" title="' + tarteaucitron.lang.close + '"></button>';
628                }
629                html += '<div id="tarteaucitron" role="dialog" aria-modal="true" aria-labelledby="dialogTitle" tabindex="-1">';
630                if (tarteaucitron.reloadThePage) {
631                    html += '   <button type="button" id="tarteaucitronClosePanel" aria-describedby="dialogTitle" aria-label="' + tarteaucitron.lang.close + ' (' + tarteaucitron.lang.reload + ')" title="' + tarteaucitron.lang.close + ' (' + tarteaucitron.lang.reload + ')">';
632                } else {
633                    html += '   <button type="button" id="tarteaucitronClosePanel" aria-describedby="dialogTitle" >';
634                }
635                html += '       ' + tarteaucitron.lang.close;
636                html += '   </button>';
637                html += '   <div id="tarteaucitronServices">';
638                html += '      <div class="tarteaucitronLine tarteaucitronMainLine" id="tarteaucitronMainLineOffset">';
639                html += '         <span class="tarteaucitronH1" role="heading" aria-level="2" id="dialogTitle">'+ tarteaucitron.lang.title + '</span>';
640                html += '         <div id="tarteaucitronInfo">';
641                html += '         ' + tarteaucitron.lang.disclaimer;
642                if (tarteaucitron.parameters.privacyUrl !== "") {
643                    html += '   <br aria-hidden="true" /><br aria-hidden="true" />';
644                    html += '   <button type="button" id="tarteaucitronPrivacyUrlDialog" role="link">';
645                    html += '       ' + tarteaucitron.lang.privacyUrl;
646                    html += '   </button>';
647                }
648                html += '         </div>';
649                html += '         <div class="tarteaucitronName">';
650                html += '            <span class="tarteaucitronH2" role="heading" aria-level="3">' + tarteaucitron.lang.all + '</span>';
651                html += '         </div>';
652                html += '         <div class="tarteaucitronAsk" id="tarteaucitronScrollbarAdjust">';
653                html += '            <button aria-label="' + tarteaucitron.lang.icon + ' : ' + tarteaucitron.lang.allowAll + '" type="button" id="tarteaucitronAllAllowed" class="tarteaucitronAllow">';
654                html += '               <span class="tarteaucitronCheck" aria-hidden="true"></span> ' + tarteaucitron.lang.allowAll;
655                html += '            </button> ';
656                html += '            <button aria-label="' + tarteaucitron.lang.icon + ' : ' + tarteaucitron.lang.denyAll + '" type="button" id="tarteaucitronAllDenied" class="tarteaucitronDeny">';
657                html += '               <span class="tarteaucitronCross" aria-hidden="true"></span> ' + tarteaucitron.lang.denyAll;
658                html += '            </button>';
659                html += '         </div>';
660                html += '      </div>';
661                html += '      <div class="tarteaucitronBorder">';
662                html += '         <div class="clear"></div><ul>';
663
664
665                if (tarteaucitron.parameters.mandatory == true) {
666                   html += '<li id="tarteaucitronServicesTitle_mandatory">';
667                   html += '<div class="tarteaucitronTitle">';
668                    if(tarteaucitron.parameters.showDetailsOnClick){
669                        html += '   <button type="button" tabindex="-1"><span class="tarteaucitronPlus" aria-hidden="true"></span> ' + tarteaucitron.lang.mandatoryTitle + '</button>';
670                    }else{
671                        html += '   <span class="asCatToggleBtn">' + tarteaucitron.lang.mandatoryTitle + '</span>';
672                    }
673                   html += '</div>';
674                   html += '<ul id="tarteaucitronServices_mandatory">';
675                   html += '<li class="tarteaucitronLine">';
676                   html += '   <div class="tarteaucitronName">';
677                   html += '       <span class="tarteaucitronH3" role="heading" aria-level="4">' + tarteaucitron.lang.mandatoryText + '</span>';
678                   html += '       <span class="tarteaucitronListCookies" aria-hidden="true"></span><br/>';
679                   html += '   </div>';
680                   if (tarteaucitron.parameters.mandatoryCta == true) {
681                       html += '   <div class="tarteaucitronAsk">';
682                       html += '       <button type="button" class="tarteaucitronAllow" tabindex="-1" disabled>';
683                       html += '           <span class="tarteaucitronCheck" aria-hidden="true"></span> ' + tarteaucitron.lang.allow;
684                       html += '       </button> ';
685                       html += '       <button type="button" class="tarteaucitronDeny" tabindex="-1">';
686                       html += '           <span class="tarteaucitronCross" aria-hidden="true"></span> ' + tarteaucitron.lang.deny;
687                       html += '       </button> ';
688                       html += '   </div>';
689                   }
690                   html += '</li>';
691                   html += '</ul></li>';
692                }
693
694                if (tarteaucitron.parameters.cookieslist === false && tarteaucitron.parameters.cookieslistEmbed === true) {
695                    setTimeout(function() {
696                        tarteaucitron.addClickEventToId("tarteaucitron-toggle-group-cookies", function () {
697                            tarteaucitron.userInterface.toggle('tarteaucitronServices_cookies');
698                            if (document.getElementById('tarteaucitronServices_cookies').style.display == 'block') {
699                                tarteaucitron.userInterface.addClass('tarteaucitronServicesTitle_cookies', 'tarteaucitronIsExpanded');
700                                document.getElementById('tarteaucitron-toggle-group-cookies').setAttribute('aria-expanded', 'true');
701                            } else {
702                                tarteaucitron.userInterface.removeClass('tarteaucitronServicesTitle_cookies', 'tarteaucitronIsExpanded');
703                                document.getElementById('tarteaucitron-toggle-group-cookies').setAttribute('aria-expanded', 'false');
704                            }
705                        });
706                    }, 800);
707
708                    html += '         <li id="tarteaucitronServicesnoTitle_cookies" class="tarteaucitronHidden" style="display:block">';
709                    html += '            <ul>' +
710                        '<li class="tarteaucitronLine" style="background:transparent">' +
711                        '   <div class="tarteaucitronName">' +
712                        '       <span class="tarteaucitronH3" role="heading" aria-level="3" id="tarteaucitronCookiesNumberBis">0 cookie</span>' +
713                        '      <button type="button" aria-expanded="false" class="tarteaucitron-toggle-group" id="tarteaucitron-toggle-group-cookies">' + tarteaucitron.lang.cookieDetail + ' ' + window.location.hostname + '</button>' +
714                        '    </div>' +
715                        '</li>' +
716                        '</ul>';
717                    html += '         <ul id="tarteaucitronServices_cookies" style="display:none"><div id="tarteaucitronCookiesList"></div></ul></li>';
718                }
719
720                for (i = 0; i < cat.length; i += 1) {
721                    html += '         <li id="tarteaucitronServicesTitle_' + cat[i] + '" class="tarteaucitronHidden">';
722                    html += '            <div class="tarteaucitronTitle" role="heading" aria-level="3">';
723                    if(tarteaucitron.parameters.showDetailsOnClick)
724                    {
725                        html += '               <button type="button" class="catToggleBtn" aria-expanded="false" data-cat="tarteaucitronDetails' + cat[i] + '"><span class="tarteaucitronPlus" aria-hidden="true"></span> ' + tarteaucitron.lang[cat[i]].title + '</button>';
726                    }else{
727                        html += '               <span class="asCatToggleBtn" data-cat="tarteaucitronInlineDetails' + cat[i] + '">' + tarteaucitron.lang[cat[i]].title + '</span>';
728                    }
729                    html += '            </div>';
730                    html += '            <div id="tarteaucitronDetails' + cat[i] + '" class="tarteaucitronDetails '+ (tarteaucitron.parameters.showDetailsOnClick ? 'tarteaucitronInfoBox' : 'tarteaucitronDetailsInline')+'" role="paragraph">';
731                    html += '               ' + tarteaucitron.lang[cat[i]].details;
732                    html += '            </div>';
733                    html += '         <ul id="tarteaucitronServices_' + cat[i] + '"></ul></li>';
734                }
735                html += '             <li id="tarteaucitronNoServicesTitle" class="tarteaucitronLine">' + tarteaucitron.lang.noServices + '</li>';
736                html += '         </ul>';
737                html += '         <div class="tarteaucitronHidden tarteaucitron-spacer-20" id="tarteaucitronScrollbarChild"></div>';
738                if (tarteaucitron.parameters.removeCredit === false) {
739                    html += '     <a class="tarteaucitronSelfLink" href="https://tarteaucitron.io/" rel="nofollow noreferrer noopener" target="_blank" title="tarteaucitron ' + tarteaucitron.lang.newWindow + '"><img src="data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAHcAAAAeCAYAAAAWwoEYAAADl0lEQVRoge1Y0W3bQAx9CjKARlC+9GVUmqDJBHEmiDyB6wkcTxBngtgTxJ0gzgQW4C/9aYOmE6g4lTQo+k6y3Rb94QOERNQd+cjj8XiGwWAwGAwGg8FgMBgMBoPB8F8RNRXe+whEKe7c36ZCAeCRxC9Rig2PUd8kPgAsoxSfQ3YAzAA8D/HwYYCb05kBKKO0teFkmbC1jlKsAnq/Abjn+QBqAIsoRS30ttwG/HNz1wH/XIxWTicLdvtW7xTAGEAMtP685CNsBTe2d/BLydfXAG57SEnMAST0zgYZSUCPk02bCvkJduIzuJzDLfPolbY+tLKmar+/8+IRePy4qdpE03qHuH8fipFb4N2+XdA3AJ/0vaQxt7s9FvkIS2XvtqnwM0rxpOQfbnE5G2LhTCmUO2fHIngOmcv+KG3HafDchB6ntwjYqenR2PqC7sOZ3E7FXHB0vqxoFyUyLh7OEH7LOGouvhhN3eIBeKXv0n5MsufdHqXcwYR5U2EbpV35lSspVPJmQj4TcgRK7jTg5IzmPUhhwM5a2WHUFCx+NgiDucmgh7idikLovHFlL0pxQ9xzX+IIP9Y6FrJsqhjlQpZRAkFVDCjZfcCHt6bqJDmuh5ylCWx0RVnk3oumaknqTH5sqrY0fBWyULaHUIgAgxb46MxV3DbieAhxOxUxjSuljig9lMQ/Bcfoi9BTEv9aLORSndVxYOH525sUDC6u2gWxcNzBNRxPanyh3ktKinOgy3WoxPbtUM0t6RkbQnzBnFPgi9GCOEubY9UffIryz9iKRe8s/FUfEWosJJGxagp85bpUO3VywQ46lOtAWfNxKwa4JXQ+628+bpxYGXXMzp5rXH401VEyXwIdowXFaKWSMFHvMTVmGnc+P3oXV2QOiBCfgex8QtcQCbcQE/H+eoHzrkFo1KM7zVO4jVVj5s6lRiWF7zyXyfRMc97J3tzj87mYqZ7E2YjzUct9GUi4tjHLR8dVkBLjQcuHFleWvQfRNEhFR7uX7pkctOwvZXsft7sAtyldEUIN2UTeLxnEfxKYswzdi88BdbZ8hifUoSMftQvP+muRwN6+Q3DeqqRExP9QmTtcheiHh0Ot1x2i2km1bP9pbufw5zZdyWsOrh7vQae5OZWbsMv30pi7cd/CKj3coPEVaCP4Zhx4eQWhOZ1Y9MTXGyP8/iGjEyfa1T4fO/4Lea9vBoPBYDAYDAaDwWAwGAwGwz8GgF8siXCCbrSRhgAAAABJRU5ErkJggg==" alt="tarteaucitron.io" /></a>';
740                }
741                html += '       </div>';
742                html += '   </div>';
743                html += '</div>';
744
745                if (tarteaucitron.parameters.orientation === 'bottom') {
746                    orientation = 'Bottom';
747                }
748
749                if (tarteaucitron.parameters.orientation === 'middle' || tarteaucitron.parameters.orientation === 'popup') {
750                    modalAttrs = ' role="dialog" aria-modal="true" aria-labelledby="tac_title"';
751                }
752
753                if (tarteaucitron.parameters.highPrivacy && !tarteaucitron.parameters.AcceptAllCta) {
754                    html += '<div tabindex="-1" id="tarteaucitronAlertBig" class="tarteaucitronAlertBig' + orientation + '"' + modalAttrs + '>';
755                    //html += '<div class="tarteaucitronAlertBigWrapper">';
756                    html += '   <span id="tarteaucitronDisclaimerAlert" role="paragraph">';
757                    html += '       ' + tarteaucitron.lang.alertBigPrivacy;
758                    html += '   </span>';
759                    //html += '   <span class="tarteaucitronAlertBigBtnWrapper">';
760                    html += '   <button type="button" id="tarteaucitronPersonalize" aria-label="' + tarteaucitron.lang.personalize + ' ' + tarteaucitron.lang.modalWindow + '" title="' + tarteaucitron.lang.personalize + ' ' + tarteaucitron.lang.modalWindow + '">';
761                    html += '       ' + tarteaucitron.lang.personalize;
762                    html += '   </button>';
763
764                    if (tarteaucitron.parameters.privacyUrl !== "") {
765                        html += '   <button role="link" type="button" id="tarteaucitronPrivacyUrl">';
766                        html += '       ' + tarteaucitron.lang.privacyUrl;
767                        html += '   </button>';
768                    }
769
770                    //html += '   </span>';
771                    //html += '</div>';
772                    html += '</div>';
773                } else {
774                    html += '<div tabindex="-1" id="tarteaucitronAlertBig" class="tarteaucitronAlertBig' + orientation + '"' + modalAttrs + '>';
775                    //html += '<div class="tarteaucitronAlertBigWrapper">';
776                    html += '   <span id="tarteaucitronDisclaimerAlert" role="paragraph">';
777
778                    if (tarteaucitron.parameters.highPrivacy) {
779                        html += '       ' + tarteaucitron.lang.alertBigPrivacy;
780                    } else {
781                        html += '       ' + tarteaucitron.lang.alertBigClick + ' ' + tarteaucitron.lang.alertBig;
782                    }
783
784                    html += '   </span>';
785                    //html += '   <span class="tarteaucitronAlertBigBtnWrapper">';
786                    html += '   <button aria-label="' + tarteaucitron.lang.icon + ' : ' + tarteaucitron.lang.acceptAll + '" type="button" class="tarteaucitronCTAButton tarteaucitronAllow" id="tarteaucitronPersonalize2" aria-describedby="tarteaucitronDisclaimerAlert" >';
787                    html += '       <span class="tarteaucitronCheck" aria-hidden="true"></span> ' + tarteaucitron.lang.acceptAll;
788                    html += '   </button>';
789
790
791                    if (tarteaucitron.parameters.DenyAllCta) {
792                        if (tarteaucitron.reloadThePage) {
793                                    html += '   <button type="button" class="tarteaucitronCTAButton tarteaucitronDeny" id="tarteaucitronAllDenied2" aria-describedby="tarteaucitronDisclaimerAlert" aria-label="' + tarteaucitron.lang.icon + ' : ' + tarteaucitron.lang.denyAll + ' (' + tarteaucitron.lang.reload + ')" title="' + tarteaucitron.lang.denyAll + ' (' + tarteaucitron.lang.reload + ')">';
794                        } else {
795                                    html += '   <button type="button" class="tarteaucitronCTAButton tarteaucitronDeny" id="tarteaucitronAllDenied2" aria-describedby="tarteaucitronDisclaimerAlert" aria-label="' + tarteaucitron.lang.icon + ' : ' + tarteaucitron.lang.denyAll + '">';
796                        }
797                                    html += '       <span class="tarteaucitronCross" aria-hidden="true"></span> ' + tarteaucitron.lang.denyAll;
798                                    html += '   </button>';
799                                    //html += '   <br/><br/>';
800                    }
801
802                    html += '   <button type="button" id="tarteaucitronCloseAlert"  aria-describedby="tarteaucitronDisclaimerAlert" aria-label="' + tarteaucitron.lang.personalize + ' ' + tarteaucitron.lang.modalWindow + '" title="' + tarteaucitron.lang.personalize + ' ' + tarteaucitron.lang.modalWindow + '">';
803                    html += '       ' + tarteaucitron.lang.personalize;
804                    html += '   </button>';
805
806                    if (tarteaucitron.parameters.privacyUrl !== "") {
807                        html += '   <button type="button" id="tarteaucitronPrivacyUrl" role="link">';
808                        html += '       ' + tarteaucitron.lang.privacyUrl;
809                        html += '   </button>';
810                    }
811
812                    //html += '   </span>';
813                    //html += '</div>';
814                    html += '</div>';
815                    html += '<div id="tarteaucitronPercentage"></div>';
816                }
817
818                if (tarteaucitron.parameters.showIcon === true) {
819                    html += '<div id="tarteaucitronIcon" class="tarteaucitronIcon' + tarteaucitron.parameters.iconPosition + '">';
820                    html += '   <button type="button" id="tarteaucitronManager" aria-label="' + tarteaucitron.lang.icon + ' ' + tarteaucitron.lang.modalWindow + '" title="' + tarteaucitron.lang.icon + ' ' + tarteaucitron.lang.modalWindow + '">';
821                    html += '       <img src="' + (tarteaucitron.parameters.iconSrc ? tarteaucitron.parameters.iconSrc : 'data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAADIAAAAyCAYAAAAeP4ixAAAGA0lEQVRoge1a207bWBRdBtJwLYZhKDMVmlSK1LxNkPo+ZH6g8B6p5AuALwC+APoFoVLeoT8whPeRSt+CZKmZVu3AiIsRlEtCktGyjy8xzuXYhvahS0JJHJ/4rLP3XnuffcAPfGdQ7mM6jRLSAF4BxqsbewB2lRS2o35mpEQaJcwCyANIdLi1DGBNSWEzqmdHRqRRwjqAJclhtExOSUEP+/xIiDRKhhUWfL7ShTtBuJnqcw+/z4Ql0xNmMEwSSz4kuNIzSgpjSsqYJP/GeE185wYJroedRyiLNEpGLLzzrHSuk+83SgbxvOcyyRaDziWsRVZkSRDinpzPbwVGWIucuohsKynMS47fAQyls/BMSRmKJo3AFhG5wm2N1wF+Zs3zebbFfR0RxrXcJHQlgH+LMW616pR/WiIMEXfW3mtzXyeEGWsjKot8c4TOI98L+iKaR5PS6IUk88RLAO9F8UjrbYoYMOosNavpfmODIiwRXRR/G3ohaWVo1RU/c30jV8ab2mV8qVGzHWBOLyTLZiWs5Rolg/C3ySOi0tXP/k4aEwOwSBKPJs7Rp16ABJTe+p1xVX0It/owqqdDEMRoqd3RFxqDPh20Ig6VEPVC0i5RSCD+6wl6HlW7GksSlUMV11/GrUs5NasFLusDE9ELSVphXemtJwaT/8JyIRvxNNCfBmIiNdR04LII3DSrbe0yjqvyJF/ppptqVlt+MCLCEh/oOkPPP6N38Mb5cnQBGFsEqmXg5j3QMwoMzwGnr4HYbybBq13gZAOom/FO63zdf2qQArCsZrUN2TlJy69eSDKYV+6Q4MpP75ivHzPA53ngaBW4eGuSOt0A/lsGPmXMz0+3TFJcTfFbPfFbfnwlhON+iQhlWmA82CQ4ocQ7c6KcfL3DHuls0yT6Sx4YnLXJDCQOIRRv5yGIJBgP8Sdisj2qubpc5UGJmo+W49ifVmzL8HcpGhQPvZCUKiCliIhEN0tr2OCqHuSA8gwQ/92MkU7gxEmeVqGrTTgpxPXbUrtGWYus0I9thRIraagRQUIDf7Qn4yZhKRiFQIyhfMfUr3yblokVWSJ6k8xSnc7eNN/RjowfCYiFoDUFer1S3gW6JiJ8Nt30EMbEhU+vzSIztuRYjRLsR8IHLjlf7HZ+MrWWEXxNmbvapt4jGSqZRYSkGUetSNTPzHsui5YMQ2ajJUNks6mw4wT54Ok2ShnzzIPCUGshzawCRKy5FqvrTZe0RWzQGvw79m67XZjKmxJrLsICjtZa55gxXy+6F4sYsEtxTqhXdRTLC8ulSDaWoCLsolfN+8YUhOsJV709H7Cudr0LlVEtzqBcN+shEyThdR941OnAbF8pirKJqXyupTRTtQSReiVmXW1j7oBErB0d9xM2WEd5J9ZKYtuR4WKwwBSoORbpGrJ5ZI9lt71irJmGX1px0JYE26uNErawr2zfIcP4OHEKXm66PA3wjpCNEfpJunI4muifPjKvsFCkGjExTq63yxMJsZNMYF/J4HmDC5A3Yq36jy0ClePHVhwuu/b1HSFlEfHD5ZtD1bEK44Qu1mWys6tbWmZyPWckzlPTGiRw/XHCuk+q4Rek+mVrVL/UppwrdDEGNV2kpyuhccgc5Oxm9vWnn+19vJrVpLor0kTUrGacMplb1CfOFyTD4o9uNrHqr2Z+ZMSp1c2XcVSORnh9Q81q3k599ETgkNnjg0nGzi10K7rX+bZpHbrblPcY5A4Zxk2xcjzCvTpd9027Aa0QtouyyrKFRR6D/04DwkFGvHPXM3Qda/Jb4nPgI7hQLVM1q5HIBt2MzQNa57Z1DiiLAGa5Mi+O4Sz3Mpp6laPHO6InII3ITnX1QtI+EOX+m9ZxleOZ/j9PiuKoLi3aqXPuEoSye/Vhkm+LalbLtHhMS0R6zu7aZ3vP2jOjL7QVv4McxhcDnZIelAQibGIbULOapf3PuE1Vs9qeaOTdkVKr00gCQiw4NlBzDvf1Lxx+uP5r3Dgv5KQZRzWn+GRwz8jmDS8itUg7iB6vLuJCF5Uty4A9mVKkFR6MiJDachST/oHvHgD+B4SoUIitpF05AAAAAElFTkSuQmCC') + '" alt="' + tarteaucitron.lang.icon + ' ' + tarteaucitron.lang.modalWindow + '" title="' + tarteaucitron.lang.icon + ' ' + tarteaucitron.lang.modalWindow + '">';
822                    html += '   </button>';
823                    html += '</div>';
824                }
825
826                if (tarteaucitron.parameters.showAlertSmall === true) {
827                    html += '<div id="tarteaucitronAlertSmall" class="tarteaucitronAlertSmall' + orientation + '">';
828                    html += '   <button type="button" id="tarteaucitronManager" aria-label="' + tarteaucitron.lang.alertSmall + ' ' + tarteaucitron.lang.modalWindow + '" title="' + tarteaucitron.lang.alertSmall + ' ' + tarteaucitron.lang.modalWindow + '">';
829                    html += '       ' + tarteaucitron.lang.alertSmall;
830                    html += '       <span id="tarteaucitronDot">';
831                    html += '           <span id="tarteaucitronDotGreen"></span>';
832                    html += '           <span id="tarteaucitronDotYellow"></span>';
833                    html += '           <span id="tarteaucitronDotRed"></span>';
834                    html += '       </span>';
835                    if (tarteaucitron.parameters.cookieslist === true) {
836                        html += '   </button><!-- @whitespace';
837                        html += '   --><button type="button" id="tarteaucitronCookiesNumber" aria-expanded="false" aria-controls="tarteaucitronCookiesListContainer">0</button>';
838                        html += '   <div id="tarteaucitronCookiesListContainer">';
839                        if (tarteaucitron.reloadThePage) {
840                            html += '       <button type="button" id="tarteaucitronClosePanelCookie" aria-label="' + tarteaucitron.lang.close + ' (' + tarteaucitron.lang.reload + ')" title="' + tarteaucitron.lang.close + ' (' + tarteaucitron.lang.reload + ')">';
841                        } else {
842                            html += '       <button type="button" id="tarteaucitronClosePanelCookie">';
843                        }
844                        html += '           ' + tarteaucitron.lang.close;
845                        html += '       </button>';
846                        html += '       <div class="tarteaucitronCookiesListMain" id="tarteaucitronCookiesTitle">';
847                        html += '            <span class="tarteaucitronH2" role="heading" aria-level="3" id="tarteaucitronCookiesNumberBis">0 cookie</span>';
848                        html += '       </div>';
849                        html += '       <div id="tarteaucitronCookiesList"></div>';
850                        html += '    </div>';
851                    } else {
852                        html += '   </div>';
853                    }
854                    html += '</div>';
855                }
856
857                tarteaucitron.addInternalScript(tarteaucitron.cdn + 'advertising' + (useMinifiedJS ? '.min' : '') + '.js', '', function () {
858                    if (tarteaucitronNoAdBlocker === true || tarteaucitron.parameters.adblocker === false) {
859
860                        // create a wrapper container at the same level than tarteaucitron so we can add an aria-hidden when tarteaucitron is opened
861                        /*var wrapper = document.createElement('div');
862                        wrapper.id = "tarteaucitronContentWrapper";
863
864                        while (document.body.firstChild)
865                        {
866                            wrapper.appendChild(document.body.firstChild);
867                        }
868
869                        // Append the wrapper to the body
870                        document.body.appendChild(wrapper);*/
871
872                        div.id = 'tarteaucitronRoot';
873                        if (tarteaucitron.parameters.bodyPosition === 'top') {
874                            // Prepend tarteaucitron: #tarteaucitronRoot first-child of the body for better accessibility
875                            var bodyFirstChild = body.firstChild;
876                            body.insertBefore(div, bodyFirstChild);
877                        }
878                        else {
879                            // Append tarteaucitron: #tarteaucitronRoot last-child of the body
880                            body.appendChild(div, body);
881                        }
882
883                        tarteaucitron.userInterface.addClass("tarteaucitronRoot", "tarteaucitronSize-" + tarteaucitron.parameters.orientation);
884
885                        // optionally show the title banner (middleBarHead) on the top/bottom bars too
886                        if (tarteaucitron.parameters.showTitleBanner === true) {
887                            tarteaucitron.userInterface.addClass("tarteaucitronRoot", "tarteaucitronTitleBanner");
888                        }
889
890                        div.setAttribute('data-nosnippet', 'true');
891                        div.setAttribute('lang', language);
892                        div.setAttribute('role', 'region');
893                        div.setAttribute('aria-labelledby', 'tac_title');
894
895                        div.innerHTML = html;
896
897                        //ie compatibility
898                        var tacRootAvailableEvent;
899                        if(typeof(Event) === 'function') {
900                            tacRootAvailableEvent = new Event("tac.root_available");
901                        }else if (typeof(document.createEvent) === 'function'){
902                            tacRootAvailableEvent = document.createEvent('Event');
903                            tacRootAvailableEvent.initEvent("tac.root_available", true, true);
904                        }
905                        //end ie compatibility
906
907                        if (typeof(window.dispatchEvent) === 'function') {window.dispatchEvent(tacRootAvailableEvent);}
908
909                        if (tarteaucitron.job !== undefined) {
910                            tarteaucitron.job = tarteaucitron.cleanArray(tarteaucitron.job);
911                            for (index = 0; index < tarteaucitron.job.length; index += 1) {
912                                tarteaucitron.addService(tarteaucitron.job[index]);
913                            }
914                        } else {
915                            tarteaucitron.job = [];
916                        }
917
918                        if (tarteaucitron.job.length === 0) {
919                            tarteaucitron.userInterface.closeAlert();
920                        }
921
922                        tarteaucitron.isAjax = true;
923
924                        tarteaucitron.job.push = function (id) {
925
926                            // ie <9 hack
927                            if (typeof tarteaucitron.job.indexOf === 'undefined') {
928                                tarteaucitron.job.indexOf = function (obj, start) {
929                                    var i,
930                                        j = this.length;
931                                    for (i = (start || 0); i < j; i += 1) {
932                                        if (this[i] === obj) { return i; }
933                                    }
934                                    return -1;
935                                };
936                            }
937
938                            if (tarteaucitron.job.indexOf(id) === -1) {
939                                Array.prototype.push.call(this, id);
940                                tarteaucitron.launch[id] = false;
941                                tarteaucitron.addService(id);
942                            }
943                        };
944
945                        if (document.location.hash === tarteaucitron.hashtag && tarteaucitron.hashtag !== '') {
946                            tarteaucitron.userInterface.openPanel();
947                        }
948
949                        tarteaucitron.cookie.number();
950                        setInterval(tarteaucitron.cookie.number, 60000);
951                    }
952                }, tarteaucitron.parameters.adblocker);
953
954                if (tarteaucitron.parameters.adblocker === true) {
955                    setTimeout(function () {
956                        if (tarteaucitronNoAdBlocker === false) {
957                            html = '<div id="tarteaucitronAlertBig" class="tarteaucitronAlertBig' + orientation + ' tarteaucitron-display-block" role="alert" aria-live="polite">';
958                            html += '   <p id="tarteaucitronDisclaimerAlert">';
959                            html += '       ' + tarteaucitron.lang.adblock + '<br/>';
960                            html += '       <strong>' + tarteaucitron.lang.adblock_call + '</strong>';
961                            html += '   </p>';
962                            html += '   <button type="button" class="tarteaucitronCTAButton" id="tarteaucitronCTAButton">';
963                            html += '       ' + tarteaucitron.lang.reload;
964                            html += '   </button>';
965                            html += '</div>';
966                            html += '<div role="heading" aria-level="2" id="tac_title" class="tac_visually-hidden">' + tarteaucitron.lang.title + '</div>';
967                            html += '<div id="tarteaucitronPremium"></div>';
968
969                            div.id = 'tarteaucitronRoot';
970                            if (tarteaucitron.parameters.bodyPosition === 'top') {
971                                // Prepend tarteaucitron: #tarteaucitronRoot first-child of the body for better accessibility
972                                var bodyFirstChild = body.firstChild;
973                                body.insertBefore(div, bodyFirstChild);
974                            }
975                            else {
976                                // Append tarteaucitron: #tarteaucitronRoot last-child of the body
977                                body.appendChild(div, body);
978                            }
979
980                            div.setAttribute('data-nosnippet', 'true');
981                            div.setAttribute('lang', language);
982                            div.setAttribute('role', 'region');
983                            div.setAttribute('aria-labelledby', 'tac_title');
984
985                            div.innerHTML = html;
986                        }
987                    }, 1500);
988                }
989                if(tarteaucitron.parameters.closePopup === true){
990                    setTimeout(function() {
991                        var closeElement = document.getElementById('tarteaucitronAlertBig'),
992                            closeButton = document.createElement('button');
993                        if (closeElement) {
994                            closeButton.innerHTML = '<span aria-hidden="true">X</span><span class="tac_visually-hidden">' + tarteaucitron.lang.closeBanner + '</span>';
995                            closeButton.setAttribute('id', 'tarteaucitronCloseCross');
996                            closeElement.insertAdjacentElement('beforeend', closeButton);
997                        }
998                    }, 100);
999                }
1000
1001                if(tarteaucitron.parameters.groupServices === true) {
1002                    var tac_group_style = document.createElement('style');
1003                    tac_group_style.innerHTML = '.tarteaucitronTitle{display:none}';
1004                    document.head.appendChild(tac_group_style);
1005                    var cats = document.querySelectorAll('[id^="tarteaucitronServicesTitle_"]')
1006                    Array.prototype.forEach.call(cats, function(item) {
1007                        var cat = item.getAttribute('id').replace(/^(tarteaucitronServicesTitle_)/, "");
1008                        if (cat !== "mandatory") {
1009                            var html = '';
1010                            html += '<li  class="tarteaucitronLine">';
1011                            html += '   <div class="tarteaucitronName">';
1012                            html += '       <span class="tarteaucitronH3" role="heading" aria-level="3">'+tarteaucitron.lang[cat].title+'</span>';
1013                            html += '       <span>'+tarteaucitron.lang[cat].details+'</span>';
1014                            html += '   <button type="button" aria-expanded="false" class="tarteaucitron-toggle-group" id="tarteaucitron-toggle-group-'+cat+'">'+tarteaucitron.lang.alertSmall+' <span id="tarteaucitronCounter-'+cat+'"></span></button>';
1015                            html += '   </div>';
1016                            html += '   <div class="tarteaucitronAsk" id="tarteaucitron-group-'+cat+'">';
1017                            html += '       <button type="button" aria-label="' + tarteaucitron.lang.allow + ' ' + tarteaucitron.lang[cat].title + '" class="tarteaucitronAllow" id="tarteaucitron-accept-group-'+cat+'">';
1018                            html += '           <span class="tarteaucitronCheck" aria-hidden="true"></span> ' + tarteaucitron.lang.allow;
1019                            html += '       </button> ';
1020                            html += '       <button type="button" aria-label="' + tarteaucitron.lang.deny + ' ' + tarteaucitron.lang[cat].title + '" class="tarteaucitronDeny" id="tarteaucitron-reject-group-'+cat+'">';
1021                            html += '           <span class="tarteaucitronCross" aria-hidden="true"></span> ' + tarteaucitron.lang.deny;
1022                            html += '       </button>';
1023                            html += '   </div>';
1024                            html += '</li>';
1025                            var ul = document.createElement('ul');
1026                            ul.innerHTML = html;
1027                            item.insertBefore(ul, item.querySelector('#tarteaucitronServices_'+cat+''));
1028                            document.querySelector('#tarteaucitronServices_' + cat).style.display = 'none';
1029                            tarteaucitron.addClickEventToId("tarteaucitron-toggle-group-" + cat, function () {
1030                                tarteaucitron.userInterface.toggle('tarteaucitronServices_' + cat);
1031                               if (document.getElementById('tarteaucitronServices_' + cat).style.display == 'block') {
1032                                    tarteaucitron.userInterface.addClass('tarteaucitronServicesTitle_' + cat, 'tarteaucitronIsExpanded');
1033                                    document.getElementById('tarteaucitron-toggle-group-'+cat).setAttribute('aria-expanded', 'true');
1034                                } else {
1035                                    tarteaucitron.userInterface.removeClass('tarteaucitronServicesTitle_' + cat, 'tarteaucitronIsExpanded');
1036                                    document.getElementById('tarteaucitron-toggle-group-'+cat).setAttribute('aria-expanded', 'false');
1037                                }
1038                                //tarteaucitron.initEvents.resizeEvent();
1039                            });
1040                            tarteaucitron.addClickEventToId("tarteaucitron-accept-group-" + cat, function () {
1041                                tarteaucitron.userInterface.respondAll(true, cat);
1042                            });
1043                            tarteaucitron.addClickEventToId("tarteaucitron-reject-group-" + cat, function () {
1044                                tarteaucitron.userInterface.respondAll(false, cat);
1045                            });
1046                        }
1047                    });
1048                }
1049
1050                // add info about the services on the main banner
1051                if (tarteaucitron.parameters.partnersList === true && (tarteaucitron.parameters.orientation === "middle" || tarteaucitron.parameters.orientation === "popup")) {
1052                    setTimeout(function() {
1053                        var tacPartnersInfoParent = document.getElementById('tarteaucitronDisclaimerAlert');
1054                        if (tacPartnersInfoParent !== null) {
1055                            tacPartnersInfoParent.insertAdjacentHTML('beforeend', '<div class="tarteaucitronPartnersList"><b>' + tarteaucitron.lang.ourpartners + ' <span id="tarteaucitronCounter-all"></span></b> <ul id="tarteaucitronCounter-list"></ul></div>');
1056                        }
1057                    }, 100);
1058                }
1059
1060                // add a save button
1061                setTimeout(function() {
1062                    var tacSaveButtonParent = document.getElementById('tarteaucitronServices');
1063                    if (tacSaveButtonParent !== null) {
1064                        tacSaveButtonParent.insertAdjacentHTML('beforeend', '<div id="tarteaucitronSave"><button class="tarteaucitronAllow" id="tarteaucitronSaveButton">' + tarteaucitron.lang.save + '</button></div>');
1065                    }
1066                }, 100);
1067
1068                tarteaucitron.userInterface.color("", true);
1069
1070                // add a little timeout to be sure everything is accessible
1071                setTimeout(function () {
1072
1073                    // Setup events
1074                    tarteaucitron.addClickEventToId("tarteaucitronCloseCross", function () {
1075                        tarteaucitron.userInterface.closeAlert();
1076                    });
1077                    tarteaucitron.addClickEventToId("tarteaucitronPersonalize", function () {
1078                        tarteaucitron.userInterface.openPanel();
1079                    });
1080                    tarteaucitron.addClickEventToId("tarteaucitronPersonalize2", function () {
1081                        tarteaucitron.userInterface.respondAll(true);
1082                    });
1083                    tarteaucitron.addClickEventToId("tarteaucitronManager", function () {
1084                        tarteaucitron.userInterface.openPanel();
1085                    });
1086                    tarteaucitron.addClickEventToId("tarteaucitronBack", function () {
1087                        tarteaucitron.userInterface.closePanel();
1088                    });
1089                    tarteaucitron.addClickEventToId("tarteaucitronClosePanel", function () {
1090                        tarteaucitron.userInterface.closePanel();
1091                    });
1092                    tarteaucitron.addClickEventToId("tarteaucitronClosePanelCookie", function () {
1093                        tarteaucitron.userInterface.closePanel();
1094                    });
1095                    tarteaucitron.addClickEventToId("tarteaucitronPrivacyUrl", function () {
1096                        document.location = tarteaucitron.userInterface.cleanUrl(tarteaucitron.parameters.privacyUrl);
1097                    });
1098                    tarteaucitron.addClickEventToId("tarteaucitronPrivacyUrlDialog", function () {
1099                        document.location = tarteaucitron.userInterface.cleanUrl(tarteaucitron.parameters.privacyUrl);
1100                    });
1101                    tarteaucitron.addClickEventToId("tarteaucitronCookiesNumber", function () {
1102                        tarteaucitron.userInterface.toggleCookiesList();
1103                    });
1104                    tarteaucitron.addClickEventToId("tarteaucitronAllAllowed", function () {
1105                        tarteaucitron.userInterface.respondAll(true);
1106                    });
1107                    tarteaucitron.addClickEventToId("tarteaucitronAllDenied", function () {
1108                        tarteaucitron.userInterface.respondAll(false);
1109                    });
1110                    tarteaucitron.addClickEventToId("tarteaucitronAllDenied2", function () {
1111                        tarteaucitron.userInterface.respondAll(false, '', true);
1112                        if (tarteaucitron.reloadThePage === true) {
1113                            window.location.reload();
1114                        }
1115                    });
1116                    tarteaucitron.addClickEventToId("tarteaucitronCloseAlert", function () {
1117                        tarteaucitron.userInterface.openPanel();
1118                    });
1119                    tarteaucitron.addClickEventToId("tarteaucitronCTAButton", function () {
1120                        location.reload();
1121                    });
1122                    tarteaucitron.addClickEventToId("tarteaucitronSaveButton", function () {
1123                        var timeoutSaveButton = 0;
1124                        tarteaucitron.job.forEach(function(id) {
1125                            if (tarteaucitron.state[id] !== true && tarteaucitron.state[id] !== false) {
1126                                timeoutSaveButton = 500;
1127                                tarteaucitron.setConsent(id, false);
1128                            }
1129                        });
1130                        setTimeout(tarteaucitron.userInterface.closePanel, timeoutSaveButton);
1131                    });
1132                    var toggleBtns = document.getElementsByClassName("catToggleBtn"), i;
1133                    for (i = 0; i < toggleBtns.length; i++) {
1134                        toggleBtns[i].dataset.index = i;
1135                        tarteaucitron.addClickEventToElement(toggleBtns[i], function () {
1136                            if(!tarteaucitron.parameters.showDetailsOnClick) return false;
1137                            tarteaucitron.userInterface.toggle('tarteaucitronDetails' + cat[this.dataset.index], 'tarteaucitronInfoBox');
1138                            if (document.getElementById('tarteaucitronDetails' + cat[this.dataset.index]).style.display === 'block') {
1139                                this.setAttribute('aria-expanded', 'true');
1140                            } else {
1141                                this.setAttribute('aria-expanded', 'false');
1142                            }
1143                            return false;
1144                        });
1145                    }
1146
1147                    // accessibility: on click on "Allow" in the site (not in TAC module), move focus to the loaded service's parent 
1148                    var allowBtnsInSite = document.querySelectorAll(".tac_activate .tarteaucitronAllow");
1149                    for (i = 0; i < allowBtnsInSite.length; i++) {
1150                        tarteaucitron.addClickEventToElement(allowBtnsInSite[i], function () {
1151                            if(this.closest('.tac_activate') !== null && this.closest('.tac_activate').parentNode !== null) {
1152                                this.closest('.tac_activate').parentNode.setAttribute("tabindex", "-1");
1153                                this.closest('.tac_activate').parentNode.focus();
1154                            }
1155                        });
1156                    }
1157
1158                    var allowBtns = document.getElementsByClassName("tarteaucitronAllow");
1159                    for (i = 0; i < allowBtns.length; i++) {
1160                        tarteaucitron.addClickEventToElement(allowBtns[i], function () {
1161                            tarteaucitron.userInterface.respond(this, true);
1162                        });
1163                    }
1164                    var denyBtns = document.getElementsByClassName("tarteaucitronDeny");
1165                    for (i = 0; i < denyBtns.length; i++) {
1166                        tarteaucitron.addClickEventToElement(denyBtns[i], function () {
1167                            tarteaucitron.userInterface.respond(this, false);
1168                        });
1169                    }
1170                    if(tarteaucitron.events.load) {
1171                        tarteaucitron.events.load();
1172                    }
1173
1174                }, 500);
1175
1176            });
1177        });
1178    },
1179    "addService": function (serviceId) {
1180        "use strict";
1181        var html = '',
1182            s = tarteaucitron.services,
1183            service = s[serviceId];
1184
1185        if (typeof service === "undefined") {
1186
1187            var serviceToRemoveIndex = tarteaucitron.job.indexOf(serviceId);
1188            if (serviceToRemoveIndex !== -1) {
1189                tarteaucitron.job.splice(serviceToRemoveIndex, 1);
1190            }
1191            return;
1192        }
1193
1194        if (tarteaucitron.parameters.alwaysNeedConsent === true) {
1195            service.needConsent = true;
1196        }
1197
1198        var cookie = tarteaucitron.cookie.read(),
1199            hostname = document.location.hostname,
1200            hostRef = document.referrer.split('/')[2],
1201            isNavigating = (hostRef === hostname && window.location.href !== tarteaucitron.parameters.privacyUrl),
1202            isAutostart = (!service.needConsent),
1203            isWaiting = (cookie.indexOf(service.key + '=wait') >= 0),
1204            isDenied = (cookie.indexOf(service.key + '=false') >= 0),
1205            isAllowed = ((cookie.indexOf(service.key + '=true') >= 0) || (!service.needConsent && cookie.indexOf(service.key + '=false') < 0)),
1206            isResponded = (cookie.indexOf(service.key + '=false') >= 0 || cookie.indexOf(service.key + '=true') >= 0),
1207            isDNTRequested = (navigator.doNotTrack === "1" || navigator.doNotTrack === "yes" || navigator.msDoNotTrack === "1" || window.doNotTrack === "1"),
1208            currentStatus = (isAllowed) ? tarteaucitron.lang.allowed : tarteaucitron.lang.disallowed,
1209            state = (undefined !== service.defaultState) ? service.defaultState :
1210                    (undefined !== tarteaucitron.parameters.serviceDefaultState ? tarteaucitron.parameters.serviceDefaultState : 'wait'),
1211            serviceDesc = tarteaucitron.lang['desc-' + service.key] || '';
1212
1213
1214        if (tarteaucitron.added[service.key] !== true) {
1215            tarteaucitron.added[service.key] = true;
1216
1217            html += '<li id="' + service.key + 'Line" class="tarteaucitronLine">';
1218            html += '   <div class="tarteaucitronName">';
1219            html += '       <span class="tarteaucitronH3" role="heading" aria-level="4">' + service.name + '</span>';
1220            if (serviceDesc !== '') {
1221                html += '       <span class="tarteaucitronServiceDescription">' + serviceDesc + '</span>';
1222            }
1223            html += '       <div class="tarteaucitronStatusInfo">';
1224            html += '          <span class="tacCurrentStatus" id="tacCurrentStatus' + service.key + '">'+currentStatus+'</span>';
1225            html += '          <span class="tarteaucitronReadmoreSeparator"> - </span>';
1226            html += '          <span id="tacCL' + service.key + '" class="tarteaucitronListCookies"></span>';
1227            html += '       </div>';
1228            if (tarteaucitron.parameters.moreInfoLink == true) {
1229
1230                var link;
1231                if (tarteaucitron.getLanguage() === 'fr') {
1232                    link = 'https://tarteaucitron.io/service/' + service.key + '/';
1233                } else {
1234                    link = 'https://tarteaucitron.io/en/service-details/' + service.key + '/';
1235                }
1236                if (service.readmoreLink !== undefined && service.readmoreLink !== '') {
1237                    link = service.readmoreLink;
1238                }
1239                if (tarteaucitron.parameters.readmoreLink !== undefined && tarteaucitron.parameters.readmoreLink !== '') {
1240                    link = tarteaucitron.parameters.readmoreLink;
1241                }
1242                html += '       <a href="' + tarteaucitron.userInterface.cleanUrl(link) + '" target="_blank" rel="noreferrer noopener nofollow" title="' + tarteaucitron.lang.more + ' : '+ tarteaucitron.lang.cookieDetail + ' ' + service.name + ' ' + tarteaucitron.lang.ourSite + ' ' + tarteaucitron.lang.newWindow +'" class="tarteaucitronReadmoreInfo">' + tarteaucitron.lang.more + '</a>';
1243                html += '       <span class="tarteaucitronReadmoreSeparator"> - </span>';
1244                html += '       <a href="' + tarteaucitron.userInterface.cleanUrl(service.uri) + '" target="_blank" rel="noreferrer noopener" title="' + tarteaucitron.lang.source + ' ' + service.name + ' ' + tarteaucitron.lang.newWindow + '" class="tarteaucitronReadmoreOfficial">' + tarteaucitron.lang.source + '</a>';
1245            }
1246
1247            html += '   </div>';
1248            html += '   <div class="tarteaucitronAsk">';
1249            html += '       <button type="button" aria-label="' + tarteaucitron.lang.allow + ' ' + service.name + '" id="' + service.key + 'Allowed" class="tarteaucitronAllow">';
1250            html += '           <span class="tarteaucitronCheck" aria-hidden="true"></span> ' + tarteaucitron.lang.allow;
1251            html += '       </button> ';
1252            html += '       <button type="button" aria-label="' + tarteaucitron.lang.deny + ' ' + service.name + '" id="' + service.key + 'Denied" class="tarteaucitronDeny">';
1253            html += '           <span class="tarteaucitronCross" aria-hidden="true"></span> ' + tarteaucitron.lang.deny;
1254            html += '       </button>';
1255            html += '   </div>';
1256            html += '</li>';
1257
1258            tarteaucitron.userInterface.css('tarteaucitronServicesTitle_' + service.type, 'display', 'block');
1259
1260            if (document.getElementById('tarteaucitronServices_' + service.type) !== null) {
1261                document.getElementById('tarteaucitronServices_' + service.type).innerHTML += html;
1262            }
1263
1264            tarteaucitron.userInterface.css('tarteaucitronNoServicesTitle', 'display', 'none');
1265
1266            tarteaucitron.userInterface.order(service.type);
1267
1268            tarteaucitron.addClickEventToId(service.key + 'Allowed', function () {
1269                tarteaucitron.userInterface.respond(this, true);
1270            });
1271
1272            tarteaucitron.addClickEventToId(service.key + 'Denied', function () {
1273                tarteaucitron.userInterface.respond(this, false);
1274            });
1275        }
1276
1277        tarteaucitron.pro('!' + service.key + '=' + isAllowed);
1278
1279        // allow by default for non EU
1280        if (isResponded === false && tarteaucitron.user.bypass === true) {
1281            isAllowed = true;
1282            tarteaucitron.cookie.create(service.key, true);
1283        }
1284
1285        if ((!isResponded && (isAutostart || (isNavigating && isWaiting)) && !tarteaucitron.highPrivacy) || isAllowed) {
1286            if (!isAllowed || (!service.needConsent && cookie.indexOf(service.key + '=false') < 0)) {
1287                tarteaucitron.cookie.create(service.key, true);
1288            }
1289            if (tarteaucitron.launch[service.key] !== true) {
1290                tarteaucitron.launch[service.key] = true;
1291                tarteaucitron.sendEvent(service.key + '_consentModeOk');
1292                if ((typeof tarteaucitronMagic === 'undefined' || tarteaucitronMagic.indexOf("_" + service.key + "_") < 0) && (tarteaucitron.parameters.serverSide !== true || (typeof tarteaucitronServerSideExclude !== 'undefined' && Array.isArray(tarteaucitronServerSideExclude) && tarteaucitronServerSideExclude.indexOf(service.key) !== -1))) { service.js(); }
1293                tarteaucitron.sendEvent(service.key + '_loaded');
1294            }
1295            tarteaucitron.state[service.key] = true;
1296            tarteaucitron.userInterface.color(service.key, true);
1297        } else if (isDenied) {
1298            if (typeof service.fallback === 'function') {
1299                if ((typeof tarteaucitronMagic === 'undefined' || tarteaucitronMagic.indexOf("_" + service.key + "_") < 0) && (tarteaucitron.parameters.serverSide !== true || (typeof tarteaucitronServerSideExclude !== 'undefined' && Array.isArray(tarteaucitronServerSideExclude) && tarteaucitronServerSideExclude.indexOf(service.key) !== -1))) { service.fallback(); }
1300            }
1301            tarteaucitron.state[service.key] = false;
1302            tarteaucitron.userInterface.color(service.key, false);
1303        } else if (!isResponded && isDNTRequested && tarteaucitron.handleBrowserDNTRequest) {
1304            tarteaucitron.cookie.create(service.key, 'false');
1305            if (typeof service.fallback === 'function') {
1306                if ((typeof tarteaucitronMagic === 'undefined' || tarteaucitronMagic.indexOf("_" + service.key + "_") < 0) && (tarteaucitron.parameters.serverSide !== true || (typeof tarteaucitronServerSideExclude !== 'undefined' && Array.isArray(tarteaucitronServerSideExclude) && tarteaucitronServerSideExclude.indexOf(service.key) !== -1))) { service.fallback(); }
1307            }
1308            tarteaucitron.state[service.key] = false;
1309            tarteaucitron.userInterface.color(service.key, false);
1310        } else if (!isResponded) {
1311            tarteaucitron.cookie.create(service.key, state);
1312
1313            if (true === state) {
1314                tarteaucitron.sendEvent(service.key + '_consentModeOk');
1315            }
1316
1317            if ((typeof tarteaucitronMagic === 'undefined' || tarteaucitronMagic.indexOf("_" + service.key + "_") < 0) && (tarteaucitron.parameters.serverSide !== true || (typeof tarteaucitronServerSideExclude !== 'undefined' && Array.isArray(tarteaucitronServerSideExclude) && tarteaucitronServerSideExclude.indexOf(service.key) !== -1))) {
1318                if(true === state && typeof service.js === 'function') {
1319                    service.js();
1320                } else if (typeof service.fallback === 'function') {
1321                    service.fallback();
1322                }
1323            }
1324
1325            if (true === state) {
1326                tarteaucitron.sendEvent(service.key + '_loaded');
1327            }
1328
1329            if (true === state || false === state) {
1330                tarteaucitron.state[service.key] = state;
1331            }
1332            tarteaucitron.userInterface.color(service.key, state);
1333
1334            if( 'wait' === state ) {
1335                tarteaucitron.userInterface.openAlert();
1336            }
1337        }
1338
1339        tarteaucitron.cookie.checkCount(service.key);
1340        tarteaucitron.sendEvent(service.key + '_added');
1341    },
1342    "sendEvent" : function(event_key) {
1343        if(event_key !== undefined) {
1344            //ie compatibility
1345            var send_event_item;
1346            if(typeof(Event) === 'function') {
1347                send_event_item = new Event(event_key);
1348            }else if (typeof(document.createEvent) === 'function'){
1349                send_event_item = document.createEvent('Event');
1350                send_event_item.initEvent(event_key, true, true);
1351            }
1352            //end ie compatibility
1353
1354            document.dispatchEvent(send_event_item);
1355        }
1356    },
1357    "cleanArray": function cleanArray(arr) {
1358        "use strict";
1359        var i,
1360            len = arr.length,
1361            out = [],
1362            obj = {},
1363            s = tarteaucitron.services;
1364
1365        for (i = 0; i < len; i += 1) {
1366            if (!obj[arr[i]]) {
1367                obj[arr[i]] = {};
1368                if (tarteaucitron.services[arr[i]] !== undefined) {
1369                    out.push(arr[i]);
1370                }
1371            }
1372        }
1373
1374        out = out.sort(function (a, b) {
1375            if (s[a].type + s[a].key > s[b].type + s[b].key) { return 1; }
1376            if (s[a].type + s[a].key < s[b].type + s[b].key) { return -1; }
1377            return 0;
1378        });
1379
1380        return out;
1381    },
1382    "setConsent": function (id, status) {
1383        if (status === true) {
1384            tarteaucitron.userInterface.respond(document.getElementById(id + 'Allowed'), true);
1385        } else if (status === false) {
1386            tarteaucitron.userInterface.respond(document.getElementById(id + 'Denied'), false);
1387        }
1388    },
1389    "userInterface": {
1390        "css": function (id, property, value) {
1391            "use strict";
1392            if (document.getElementById(id) !== null) {
1393
1394                if (property == "display" && value == "none" && (id == "tarteaucitron" || id == "tarteaucitronBack" || id == "tarteaucitronAlertBig")) {
1395                    document.getElementById(id).style["opacity"] = "0";
1396
1397                    /*setTimeout(function() {*/document.getElementById(id).style[property] = value;/*}, 200);*/
1398                } else {
1399
1400                    document.getElementById(id).style[property] = value;
1401
1402                    if (property == "display" && value == "block" && (id == "tarteaucitron" || id == "tarteaucitronAlertBig")) {
1403                        document.getElementById(id).style["opacity"] = "1";
1404                    }
1405
1406                    if (property == "display" && value == "block" && id == "tarteaucitronBack") {
1407                        document.getElementById(id).style["opacity"] = "0.7";
1408                    }
1409
1410                    if (property == "display" && value == "block" && id == "tarteaucitronAlertBig" && (tarteaucitron.parameters.orientation == "middle"|| tarteaucitron.parameters.orientation == "popup")) {
1411                        tarteaucitron.userInterface.focusTrap('tarteaucitronAlertBig');
1412                    }
1413                }
1414            }
1415        },
1416        "addClass": function (id, className) {
1417            "use strict";
1418            if (document.getElementById(id) !== null && document.getElementById(id).classList !== undefined) {
1419                document.getElementById(id).classList.add(className);
1420            }
1421        },
1422        "removeClass": function (id, className) {
1423            "use strict";
1424            if (document.getElementById(id) !== null && document.getElementById(id).classList !== undefined) {
1425                document.getElementById(id).classList.remove(className);
1426            }
1427        },
1428        "respondAll": function (status, type, allowSafeAnalytics) {
1429            "use strict";
1430            var s = tarteaucitron.services,
1431                service,
1432                key,
1433                index = 0;
1434
1435            for (index = 0; index < tarteaucitron.job.length; index += 1) {
1436
1437                if (typeof type !== 'undefined' && type !== '' && s[tarteaucitron.job[index]].type !== type) {
1438                    continue;
1439                }
1440
1441                if (allowSafeAnalytics && typeof s[tarteaucitron.job[index]].safeanalytic !== "undefined" && s[tarteaucitron.job[index]].safeanalytic === true) {
1442                    continue;
1443                }
1444
1445                service = s[tarteaucitron.job[index]];
1446                key = service.key;
1447                if (tarteaucitron.state[key] !== status) {
1448
1449                    if (status == true) {
1450                        tarteaucitron.sendEvent(key + '_consentModeOk');
1451                    } else {
1452                        tarteaucitron.sendEvent(key + '_consentModeKo');
1453                    }
1454
1455                    if (status === false && tarteaucitron.launch[key] === true) {
1456                        tarteaucitron.reloadThePage = true;
1457                        if (tarteaucitron.checkIfExist('tarteaucitronClosePanel')) {
1458                            var ariaCloseValue = document.getElementById('tarteaucitronClosePanel').textContent.trim() + ' (' + tarteaucitron.lang.reload + ')';
1459                            document.getElementById('tarteaucitronClosePanel').setAttribute("aria-label", ariaCloseValue);
1460                            document.getElementById('tarteaucitronClosePanel').setAttribute("title", ariaCloseValue);
1461                        }
1462                    }
1463                    if (tarteaucitron.launch[key] !== true && status === true) {
1464                        tarteaucitron.pro('!' + key + '=engage');
1465
1466                        tarteaucitron.launch[key] = true;
1467                        if ((typeof tarteaucitronMagic === 'undefined' || tarteaucitronMagic.indexOf("_" + key + "_") < 0) && (tarteaucitron.parameters.serverSide !== true || (typeof tarteaucitronServerSideExclude !== 'undefined' && Array.isArray(tarteaucitronServerSideExclude) && tarteaucitronServerSideExclude.indexOf(key) !== -1))) { tarteaucitron.services[key].js(); }
1468                        tarteaucitron.sendEvent(key + '_loaded');
1469                    }
1470                    var itemStatusElem = document.getElementById('tacCurrentStatus'+key);
1471                    tarteaucitron.state[key] = status;
1472                    tarteaucitron.cookie.create(key, status);
1473                    tarteaucitron.userInterface.color(key, status);
1474                    if (status == true) {
1475                        itemStatusElem.innerHTML = tarteaucitron.lang.allowed;
1476                        tarteaucitron.sendEvent(key + '_allowed');
1477                    } else {
1478                        itemStatusElem.innerHTML = tarteaucitron.lang.disallowed;
1479                        tarteaucitron.sendEvent(key + '_disallowed');
1480                    }
1481                }
1482            }
1483        },
1484        "respond": function (el, status) {
1485            "use strict";
1486            if (el.id === '') {
1487                return;
1488            }
1489            var key = el.id.replace(new RegExp("(Eng[0-9]+|Allow|Deni)ed", "g"), '');
1490
1491            if (key.substring(0, 13) === 'tarteaucitron' || key === '') {return;}
1492
1493            // return if same state
1494            if (tarteaucitron.state[key] === status) {
1495                return;
1496            }
1497
1498            if (status == true) {
1499                tarteaucitron.sendEvent(key + '_consentModeOk');
1500            } else {
1501                tarteaucitron.sendEvent(key + '_consentModeKo');
1502            }
1503
1504            if (status === false && tarteaucitron.launch[key] === true) {
1505                tarteaucitron.reloadThePage = true;
1506                if (tarteaucitron.checkIfExist('tarteaucitronClosePanel')) {
1507                    var ariaCloseValue = document.getElementById('tarteaucitronClosePanel').textContent.trim() + ' (' + tarteaucitron.lang.reload + ')';
1508                    document.getElementById('tarteaucitronClosePanel').setAttribute("aria-label", ariaCloseValue);
1509                    document.getElementById('tarteaucitronClosePanel').setAttribute("title", ariaCloseValue);
1510                }
1511            }
1512
1513            // if not already launched... launch the service
1514            if (status === true) {
1515                if (tarteaucitron.launch[key] !== true) {
1516                    tarteaucitron.pro('!' + key + '=engage');
1517
1518                    tarteaucitron.launch[key] = true;
1519                    tarteaucitron.sendEvent(key + '_consentModeOk');
1520                    if ((typeof tarteaucitronMagic === 'undefined' || tarteaucitronMagic.indexOf("_" + key + "_") < 0) && (tarteaucitron.parameters.serverSide !== true || (typeof tarteaucitronServerSideExclude !== 'undefined' && Array.isArray(tarteaucitronServerSideExclude) && tarteaucitronServerSideExclude.indexOf(key) !== -1))) { tarteaucitron.services[key].js(); }
1521                    tarteaucitron.sendEvent(key + '_loaded');
1522                }
1523            }
1524            var itemStatusElem = document.getElementById('tacCurrentStatus'+key);
1525            tarteaucitron.state[key] = status;
1526            tarteaucitron.cookie.create(key, status);
1527            tarteaucitron.userInterface.color(key, status);
1528            if (status == true) {
1529                itemStatusElem.innerHTML = tarteaucitron.lang.allowed;
1530                tarteaucitron.sendEvent(key + '_allowed');
1531            } else {
1532                itemStatusElem.innerHTML = tarteaucitron.lang.disallowed;
1533                tarteaucitron.sendEvent(key + '_disallowed');
1534            }
1535        },
1536        "color": function (key, status) {
1537            "use strict";
1538            var c = 'tarteaucitron',
1539                nbDenied = 0,
1540                nbPending = 0,
1541                nbAllowed = 0,
1542                sum = tarteaucitron.job.length,
1543                index,
1544                s = tarteaucitron.services;
1545
1546            if (key !== "") {
1547
1548                tarteaucitron.cookie.checkCount(key);
1549
1550            if (status === true) {
1551                tarteaucitron.userInterface.addClass(key + 'Line', 'tarteaucitronIsAllowed');
1552                tarteaucitron.userInterface.removeClass(key + 'Line', 'tarteaucitronIsDenied');
1553                document.getElementById(key + 'Allowed').setAttribute('aria-pressed', 'true');
1554                document.getElementById(key + 'Denied').setAttribute('aria-pressed', 'false');
1555            } else if (status === false) {
1556                tarteaucitron.userInterface.removeClass(key + 'Line', 'tarteaucitronIsAllowed');
1557                tarteaucitron.userInterface.addClass(key + 'Line', 'tarteaucitronIsDenied');
1558                document.getElementById(key + 'Allowed').setAttribute('aria-pressed', 'false');
1559                document.getElementById(key + 'Denied').setAttribute('aria-pressed', 'true');
1560            } else {
1561                document.getElementById(key + 'Allowed').setAttribute('aria-pressed', 'false');
1562                document.getElementById(key + 'Denied').setAttribute('aria-pressed', 'false');
1563            }
1564
1565            // check if all services are allowed
1566            var sumToRemove = 0;
1567            for (index = 0; index < sum; index += 1) {
1568
1569                if (typeof s[tarteaucitron.job[index]].safeanalytic !== "undefined" && s[tarteaucitron.job[index]].safeanalytic === true) {
1570                    sumToRemove += 1;
1571                    continue;
1572                }
1573
1574                if (tarteaucitron.state[tarteaucitron.job[index]] === false) {
1575                    nbDenied += 1;
1576                } else if (tarteaucitron.state[tarteaucitron.job[index]] === undefined) {
1577                    nbPending += 1;
1578                } else if (tarteaucitron.state[tarteaucitron.job[index]] === true) {
1579                    nbAllowed += 1;
1580                }
1581            }
1582            sum -= sumToRemove;
1583
1584            const percentages = {
1585                DotGreen: (100 / sum) * nbAllowed,
1586                DotYellow: (100 / sum) * nbPending,
1587                DotRed: (100 / sum) * nbDenied
1588            };
1589
1590            for (const [colorKey, value] of Object.entries(percentages)) {
1591                tarteaucitron.userInterface.css(c + colorKey, 'width', value + '%');
1592            }
1593
1594            if (tarteaucitron.parameters.showAlertSmall === true) {
1595                const percentAllowed = percentages.DotGreen;
1596                const label = tarteaucitron.lang.alertSmall + " - " + percentAllowed + "% " + tarteaucitron.lang.allowed + " " + tarteaucitron.lang.modalWindow;
1597                const managerEl = document.getElementById(c + 'Manager');
1598                managerEl.setAttribute('aria-label', label);
1599                managerEl.setAttribute('title', label);
1600            }
1601
1602            if (nbDenied === 0 && nbPending === 0) {
1603                tarteaucitron.userInterface.removeClass(c + 'AllDenied', c + 'IsSelected');
1604                tarteaucitron.userInterface.addClass(c + 'AllAllowed', c + 'IsSelected');
1605
1606                tarteaucitron.userInterface.addClass(c + 'MainLineOffset', c + 'IsAllowed');
1607                tarteaucitron.userInterface.removeClass(c + 'MainLineOffset', c + 'IsDenied');
1608
1609                document.getElementById(c + 'AllDenied').setAttribute('aria-pressed', 'false');
1610                document.getElementById(c + 'AllAllowed').setAttribute('aria-pressed', 'true');
1611
1612            } else if (nbAllowed === 0 && nbPending === 0) {
1613                tarteaucitron.userInterface.removeClass(c + 'AllAllowed', c + 'IsSelected');
1614                tarteaucitron.userInterface.addClass(c + 'AllDenied', c + 'IsSelected');
1615
1616                tarteaucitron.userInterface.removeClass(c + 'MainLineOffset', c + 'IsAllowed');
1617                tarteaucitron.userInterface.addClass(c + 'MainLineOffset', c + 'IsDenied');
1618
1619                document.getElementById(c + 'AllDenied').setAttribute('aria-pressed', 'true');
1620                document.getElementById(c + 'AllAllowed').setAttribute('aria-pressed', 'false');
1621
1622            } else {
1623                tarteaucitron.userInterface.removeClass(c + 'AllAllowed', c + 'IsSelected');
1624                tarteaucitron.userInterface.removeClass(c + 'AllDenied', c + 'IsSelected');
1625
1626                tarteaucitron.userInterface.removeClass(c + 'MainLineOffset', c + 'IsAllowed');
1627                tarteaucitron.userInterface.removeClass(c + 'MainLineOffset', c + 'IsDenied');
1628
1629                document.getElementById(c + 'AllDenied').setAttribute('aria-pressed', 'false');
1630                document.getElementById(c + 'AllAllowed').setAttribute('aria-pressed', 'false');
1631            }
1632
1633            // close the alert if all service have been reviewed
1634            if (nbPending === 0) {
1635                tarteaucitron.userInterface.closeAlert();
1636            }
1637
1638            if (tarteaucitron.services[key].cookies.length > 0 && status === false) {
1639                tarteaucitron.cookie.purge(tarteaucitron.services[key].cookies);
1640            }
1641
1642            if (status === true) {
1643                if (document.getElementById('tacCL' + key) !== null) {
1644                    document.getElementById('tacCL' + key).innerHTML = '...';
1645                }
1646                setTimeout(function () {
1647                    tarteaucitron.cookie.checkCount(key);
1648                }, 2500);
1649            } else {
1650                tarteaucitron.cookie.checkCount(key);
1651            }
1652
1653            }
1654
1655	        // groups
1656            var cats = document.querySelectorAll('[id^="tarteaucitronServicesTitle_"]')
1657            Array.prototype.forEach.call(cats, function(item) {
1658                var cat = item.getAttribute('id').replace(/^(tarteaucitronServicesTitle_)/, ""),
1659                    total = document.getElementById("tarteaucitronServices_"+cat).childElementCount;
1660                var doc = document.getElementById("tarteaucitronServices_"+cat),
1661                    groupdenied = 0,
1662                    groupallowed = 0;
1663                for (var ii = 0; ii < doc.children.length; ii++) {
1664                    if (doc.children[ii].className == "tarteaucitronLine tarteaucitronIsDenied") {
1665                        groupdenied++;
1666                    }
1667                    if (doc.children[ii].className == "tarteaucitronLine tarteaucitronIsAllowed") {
1668                        groupallowed++;
1669                    }
1670                }
1671                if (total === groupallowed) {
1672                    tarteaucitron.userInterface.removeClass('tarteaucitron-group-'+cat, 'tarteaucitronIsDenied');
1673                    tarteaucitron.userInterface.addClass('tarteaucitron-group-'+cat, 'tarteaucitronIsAllowed');
1674
1675                    if (document.getElementById('tarteaucitron-reject-group-'+cat)) {
1676                        document.getElementById('tarteaucitron-reject-group-'+cat).setAttribute('aria-pressed', 'false');
1677                        document.getElementById('tarteaucitron-accept-group-'+cat).setAttribute('aria-pressed', 'true');
1678                    }
1679                }
1680                if (total === groupdenied) {
1681                    tarteaucitron.userInterface.addClass('tarteaucitron-group-'+cat, 'tarteaucitronIsDenied');
1682                    tarteaucitron.userInterface.removeClass('tarteaucitron-group-'+cat, 'tarteaucitronIsAllowed');
1683
1684                    if (document.getElementById('tarteaucitron-reject-group-'+cat)) {
1685                        document.getElementById('tarteaucitron-reject-group-'+cat).setAttribute('aria-pressed', 'true');
1686                        document.getElementById('tarteaucitron-accept-group-'+cat).setAttribute('aria-pressed', 'false');
1687                    }
1688                }
1689                if (total !== groupdenied && total !== groupallowed) {
1690                    tarteaucitron.userInterface.removeClass('tarteaucitron-group-'+cat, 'tarteaucitronIsDenied');
1691                    tarteaucitron.userInterface.removeClass('tarteaucitron-group-'+cat, 'tarteaucitronIsAllowed');
1692
1693                    if (document.getElementById('tarteaucitron-reject-group-'+cat)) {
1694                        document.getElementById('tarteaucitron-reject-group-'+cat).setAttribute('aria-pressed', 'false');
1695                        document.getElementById('tarteaucitron-accept-group-'+cat).setAttribute('aria-pressed', 'false');
1696                    }
1697                }
1698                groupdenied = 0;
1699                groupallowed = 0;
1700
1701                if (document.getElementById('tarteaucitronCounter-'+cat)) {
1702                    document.getElementById('tarteaucitronCounter-'+cat).innerHTML = '('+document.getElementById("tarteaucitronServices_"+cat).childElementCount+')';
1703                }
1704            });
1705
1706            setTimeout(function() {
1707                if (document.getElementById('tarteaucitronCounter-all')) {
1708                    document.getElementById('tarteaucitronCounter-all').innerHTML = '('+tarteaucitron.job.length+')';
1709                }
1710                if (document.getElementById('tarteaucitronCounter-list')) {
1711
1712                    var liPartners = "";
1713                    var tarteaucitronPartnersCat = [];
1714                    var titles = [];
1715
1716                    tarteaucitron.job.forEach(function (id) {
1717                        if (tarteaucitronPartnersCat[tarteaucitron.services[id].type] === undefined) {
1718                            tarteaucitronPartnersCat[tarteaucitron.services[id].type] = true;
1719                            titles.push(tarteaucitron.lang[tarteaucitron.services[id].type].title);
1720                        }
1721                    });
1722                    titles.sort();
1723                    titles.forEach(function (title) {
1724                        liPartners += "<li>" + title + "</li>";
1725                    });
1726
1727                    document.getElementById('tarteaucitronCounter-list').innerHTML = liPartners;
1728                }
1729            }, 120);
1730        },
1731        "openPanel": function () {
1732            "use strict";
1733
1734            tarteaucitron.userInterface.css('tarteaucitron', 'display', 'block');
1735            tarteaucitron.userInterface.css('tarteaucitronBack', 'display', 'block');
1736            tarteaucitron.userInterface.css('tarteaucitronCookiesListContainer', 'display', 'none');
1737
1738            document.getElementById('tarteaucitronClosePanel').focus();
1739            if (document.getElementsByTagName('html')[0].classList !== undefined) {
1740                document.getElementsByTagName('html')[0].classList.add('tarteaucitron-modal-open-noscroll');
1741            }
1742            if (document.getElementsByTagName('body')[0].classList !== undefined) {
1743                document.getElementsByTagName('body')[0].classList.add('tarteaucitron-modal-open');
1744            }
1745            tarteaucitron.userInterface.focusTrap('tarteaucitron');
1746            tarteaucitron.userInterface.jsSizing('main');
1747
1748            //ie compatibility
1749            var tacOpenPanelEvent;
1750            if(typeof(Event) === 'function') {
1751                tacOpenPanelEvent = new Event("tac.open_panel");
1752            }else if (typeof(document.createEvent) === 'function'){
1753                tacOpenPanelEvent = document.createEvent('Event');
1754                tacOpenPanelEvent.initEvent("tac.open_panel", true, true);
1755            }
1756            //end ie compatibility
1757
1758            if (typeof(window.dispatchEvent) === 'function') {window.dispatchEvent(tacOpenPanelEvent);}
1759        },
1760        "closePanel": function () {
1761            "use strict";
1762
1763            if (document.location.hash === tarteaucitron.hashtag) {
1764                if (window.history) {
1765                    window.history.replaceState('', document.title, window.location.pathname + window.location.search);
1766                } else {
1767                    document.location.hash = '';
1768                }
1769            }
1770            if (tarteaucitron.checkIfExist('tarteaucitron')) {
1771                // accessibility: manage focus on close panel
1772                if (tarteaucitron.checkIfExist('tarteaucitronCloseAlert')) {
1773                    document.getElementById('tarteaucitronCloseAlert').focus();
1774                } else if (tarteaucitron.checkIfExist('tarteaucitronManager')) {
1775                    document.getElementById('tarteaucitronManager').focus();
1776                } else if (tarteaucitron.customCloserId && tarteaucitron.checkIfExist(tarteaucitron.customCloserId)) {
1777                    document.getElementById(tarteaucitron.customCloserId).focus();
1778                }
1779                tarteaucitron.userInterface.css('tarteaucitron', 'display', 'none');
1780            }
1781
1782            if (tarteaucitron.checkIfExist('tarteaucitronCookiesListContainer') && tarteaucitron.checkIfExist('tarteaucitronCookiesNumber')) {
1783                // accessibility: manage focus on close cookies list
1784                document.getElementById('tarteaucitronCookiesNumber').focus();
1785                document.getElementById('tarteaucitronCookiesNumber').setAttribute("aria-expanded", "false");
1786                tarteaucitron.userInterface.css('tarteaucitronCookiesListContainer', 'display', 'none');
1787            }
1788
1789            tarteaucitron.fallback(['tarteaucitronInfoBox'], function (elem) {
1790                elem.style.display = 'none';
1791            }, true);
1792
1793            if (tarteaucitron.reloadThePage === true) {
1794                window.location.reload();
1795            } else {
1796                tarteaucitron.userInterface.css('tarteaucitronBack', 'display', 'none');
1797            }
1798
1799            if (!(tarteaucitron.parameters.orientation === 'middle' && document.getElementById('tarteaucitronAlertBig').style.display === 'block')) {
1800                if (document.getElementsByTagName('html')[0].classList !== undefined) {
1801                    document.getElementsByTagName('html')[0].classList.remove('tarteaucitron-modal-open-noscroll');
1802                }
1803            }
1804            if (document.getElementsByTagName('body')[0].classList !== undefined) {
1805                document.getElementsByTagName('body')[0].classList.remove('tarteaucitron-modal-open');
1806            }
1807
1808            //ie compatibility
1809            var tacClosePanelEvent;
1810            if(typeof(Event) === 'function') {
1811                tacClosePanelEvent = new Event("tac.close_panel");
1812            }else if (typeof(document.createEvent) === 'function'){
1813                tacClosePanelEvent = document.createEvent('Event');
1814                tacClosePanelEvent.initEvent("tac.close_panel", true, true);
1815            }
1816            //end ie compatibility
1817
1818            if (typeof(window.dispatchEvent) === 'function') {window.dispatchEvent(tacClosePanelEvent);}
1819        },
1820        "focusTrap": function(parentElement) {
1821            "use strict";
1822
1823            var focusableEls,
1824                firstFocusableEl,
1825                lastFocusableEl,
1826                filtered;
1827
1828            focusableEls = document.getElementById(parentElement).querySelectorAll('a[href], button');
1829            filtered = [];
1830
1831            // get only visible items
1832            for (var i = 0, max = focusableEls.length; i < max; i++) {
1833                if (focusableEls[i].offsetHeight > 0) {
1834                   filtered.push(focusableEls[i]);
1835                }
1836            }
1837
1838            firstFocusableEl = filtered[0];
1839            lastFocusableEl = filtered[filtered.length - 1];
1840
1841            //loop focus inside tarteaucitron
1842            document.getElementById(parentElement).addEventListener("keydown", function (evt) {
1843
1844                if ( evt.key === 'Tab' || evt.keyCode === 9 ) {
1845
1846                    if ( evt.shiftKey ) /* shift + tab */ {
1847                        if (document.activeElement === firstFocusableEl) {
1848                            lastFocusableEl.focus();
1849                            evt.preventDefault();
1850                        }
1851                    } else /* tab */ {
1852                        if (document.activeElement === lastFocusableEl) {
1853                            firstFocusableEl.focus();
1854                            evt.preventDefault();
1855                        }
1856                    }
1857                }
1858            })
1859        },
1860        "openAlert": function () {
1861            "use strict";
1862            var c = 'tarteaucitron';
1863            tarteaucitron.userInterface.css(c + 'Percentage', 'display', 'block');
1864            tarteaucitron.userInterface.css(c + 'AlertSmall', 'display', 'none');
1865            tarteaucitron.userInterface.css(c + 'Icon', 'display', 'none');
1866            tarteaucitron.userInterface.css(c + 'AlertBig',   'display', 'block');
1867            tarteaucitron.userInterface.addClass(c + 'Root',   'tarteaucitronBeforeVisible');
1868            tarteaucitron.userInterface.css('tac_title', 'display', 'block');
1869
1870            //ie compatibility
1871            var tacOpenAlertEvent;
1872            if(typeof(Event) === 'function') {
1873                tacOpenAlertEvent = new Event("tac.open_alert");
1874            }else if (typeof(document.createEvent) === 'function'){
1875                tacOpenAlertEvent = document.createEvent('Event');
1876                tacOpenAlertEvent.initEvent("tac.open_alert", true, true);
1877            }
1878            //end ie compatibility
1879
1880            if (document.getElementById('tarteaucitronAlertBig') !== null && tarteaucitron.parameters.orientation === 'middle') {
1881                document.getElementById('tarteaucitronAlertBig').focus();
1882                if (document.getElementsByTagName('html')[0].classList !== undefined) {
1883                    document.getElementsByTagName('html')[0].classList.add('tarteaucitron-modal-open-noscroll');
1884                }
1885            }
1886
1887            if (typeof(window.dispatchEvent) === 'function') {window.dispatchEvent(tacOpenAlertEvent);}
1888        },
1889        "closeAlert": function () {
1890            "use strict";
1891            var c = 'tarteaucitron';
1892            tarteaucitron.userInterface.css(c + 'Percentage', 'display', 'none');
1893            tarteaucitron.userInterface.css(c + 'AlertSmall', 'display', 'block');
1894            tarteaucitron.userInterface.css(c + 'Icon', 'display', 'block');
1895            tarteaucitron.userInterface.css(c + 'AlertBig',   'display', 'none');
1896            tarteaucitron.userInterface.removeClass(c + 'Root',   'tarteaucitronBeforeVisible');
1897            tarteaucitron.userInterface.jsSizing('box');
1898
1899            //ie compatibility
1900            var tacCloseAlertEvent;
1901            if(typeof(Event) === 'function') {
1902                tacCloseAlertEvent = new Event("tac.close_alert");
1903            }else if (typeof(document.createEvent) === 'function'){
1904                tacCloseAlertEvent = document.createEvent('Event');
1905                tacCloseAlertEvent.initEvent("tac.close_alert", true, true);
1906            }
1907            //end ie compatibility
1908
1909            if (tarteaucitron.parameters.showAlertSmall === false && tarteaucitron.parameters.showIcon === false) {
1910                tarteaucitron.userInterface.css('tac_title', 'display', 'none');
1911            }
1912
1913            if (document.getElementsByTagName('html')[0].classList !== undefined) {
1914                document.getElementsByTagName('html')[0].classList.remove('tarteaucitron-modal-open-noscroll');
1915            }
1916
1917            if (typeof(window.dispatchEvent) === 'function') {window.dispatchEvent(tacCloseAlertEvent);}
1918        },
1919        "toggleCookiesList": function () {
1920            "use strict";
1921            var div = document.getElementById('tarteaucitronCookiesListContainer'),
1922                togglediv = document.getElementById('tarteaucitronCookiesNumber');
1923
1924            if (div === null) {
1925                return;
1926            }
1927
1928            if (div.style.display !== 'block') {
1929                tarteaucitron.cookie.number();
1930                div.style.display = 'block';
1931                togglediv.setAttribute("aria-expanded", "true");
1932                tarteaucitron.userInterface.jsSizing('cookie');
1933                tarteaucitron.userInterface.css('tarteaucitron', 'display', 'none');
1934                tarteaucitron.userInterface.css('tarteaucitronBack', 'display', 'block');
1935                tarteaucitron.fallback(['tarteaucitronInfoBox'], function (elem) {
1936                    elem.style.display = 'none';
1937                }, true);
1938            } else {
1939                div.style.display = 'none';
1940                togglediv.setAttribute("aria-expanded", "false");
1941                tarteaucitron.userInterface.css('tarteaucitron', 'display', 'none');
1942                tarteaucitron.userInterface.css('tarteaucitronBack', 'display', 'none');
1943            }
1944        },
1945        "toggle": function (id, closeClass) {
1946            "use strict";
1947            var div = document.getElementById(id);
1948
1949            if (div === null) {
1950                return;
1951            }
1952
1953            if (closeClass !== undefined) {
1954                tarteaucitron.fallback([closeClass], function (elem) {
1955                    if (elem.id !== id) {
1956                        elem.style.display = 'none';
1957                    }
1958                }, true);
1959            }
1960
1961            if (div.style.display !== 'block') {
1962                div.style.display = 'block';
1963            } else {
1964                div.style.display = 'none';
1965            }
1966        },
1967        "order": function (id) {
1968            "use strict";
1969            var main = document.getElementById('tarteaucitronServices_' + id),
1970                allDivs,
1971                store = [],
1972                i;
1973
1974            if (main === null) {
1975                return;
1976            }
1977
1978            allDivs = main.childNodes;
1979
1980            if (typeof Array.prototype.map === 'function' && typeof Enumerable === 'undefined') {
1981                Array.prototype.map.call(main.children, Object).sort(function (a, b) {
1982                //var mainChildren = Array.from(main.children);
1983                //mainChildren.sort(function (a, b) {
1984                    if (tarteaucitron.services[a.id.replace(/Line/g, '')].name > tarteaucitron.services[b.id.replace(/Line/g, '')].name) { return 1; }
1985                    if (tarteaucitron.services[a.id.replace(/Line/g, '')].name < tarteaucitron.services[b.id.replace(/Line/g, '')].name) { return -1; }
1986                    return 0;
1987                }).forEach(function (element) {
1988                    main.appendChild(element);
1989                });
1990            }
1991        },
1992        "taclayoutPending": false,
1993        "jsSizing": function (type) {
1994            "use strict";
1995
1996            if (tarteaucitron.taclayoutPending) return;
1997            tarteaucitron.taclayoutPending = true;
1998
1999            if (type === 'box') {
2000                var elCookiesNumber = document.getElementById('tarteaucitronCookiesNumber');
2001                if (elCookiesNumber) tarteaucitron.userInterface.css('tarteaucitronCookiesNumber', 'padding', '0px 10px');
2002            } else if (type === 'main') {
2003                var elServices = document.getElementById('tarteaucitronServices');
2004                if (elServices) tarteaucitron.userInterface.css('tarteaucitronServices', 'height', 'auto');
2005            } else if (type === 'cookie') {
2006                var elCookiesList = document.getElementById('tarteaucitronCookiesList');
2007                if (elCookiesList) tarteaucitron.userInterface.css('tarteaucitronCookiesList', 'height', 'auto');
2008            }
2009
2010            window.requestAnimationFrame(function() {
2011                tarteaucitron.taclayoutPending = false;
2012
2013                var winH = window.innerHeight || document.documentElement.clientHeight || document.body.clientHeight;
2014                var winW = window.innerWidth || document.documentElement.clientWidth;
2015
2016                if (type === 'box') {
2017                    var elAlertSmall = document.getElementById('tarteaucitronAlertSmall');
2018                    var elCookiesNumber = document.getElementById('tarteaucitronCookiesNumber');
2019                    if (elAlertSmall && elCookiesNumber) {
2020                        var paddingBox = (elAlertSmall.offsetHeight - elCookiesNumber.offsetHeight) / 2;
2021                        tarteaucitron.userInterface.css('tarteaucitronCookiesNumber', 'padding', paddingBox + 'px 10px');
2022                    }
2023                }
2024
2025                else if (type === 'main') {
2026                    var elMain = document.getElementById('tarteaucitron');
2027                    var elClose = document.getElementById('tarteaucitronClosePanel');
2028                    var elServices = document.getElementById('tarteaucitronServices');
2029
2030                    if (elMain && elClose && elServices) {
2031                        var hMain = elMain.offsetHeight;
2032                        var hClose = elClose.offsetHeight;
2033
2034                        tarteaucitron.userInterface.css('tarteaucitronServices', 'height', (hMain - hClose + 4) + 'px');
2035                        tarteaucitron.userInterface.css('tarteaucitronServices', 'overflow-x', 'auto');
2036
2037                        var mTop = (winW <= 767) ? 0 : ((winH - hMain) / 2) - 21;
2038                        var elOffset = document.getElementById('tarteaucitronMainLineOffset');
2039                        if (hMain < (winH / 2) && elOffset) {
2040                            mTop -= elOffset.offsetHeight;
2041                        }
2042                        tarteaucitron.userInterface.css('tarteaucitron', 'top', Math.max(0, mTop) + 'px');
2043                    }
2044                }
2045
2046                else if (type === 'cookie') {
2047                    var elAlertSmall = document.getElementById('tarteaucitronAlertSmall');
2048                    var elCont = document.getElementById('tarteaucitronCookiesListContainer');
2049                    if (elAlertSmall && elCont) {
2050                        tarteaucitron.userInterface.css('tarteaucitronCookiesListContainer', 'bottom', elAlertSmall.offsetHeight + 'px');
2051
2052                        var elCloseC = document.getElementById('tarteaucitronClosePanelCookie');
2053                        var elTitleC = document.getElementById('tarteaucitronCookiesTitle');
2054                        var elListC = document.getElementById('tarteaucitronCookiesList');
2055                        if (elCloseC && elTitleC && elListC) {
2056                            var hList = elCont.offsetHeight - elCloseC.offsetHeight - elTitleC.offsetHeight - 2;
2057                            tarteaucitron.userInterface.css('tarteaucitronCookiesList', 'height', hList + 'px');
2058                        }
2059                    }
2060                }
2061            });
2062        },
2063        "cleanUrl": function (url) {
2064            try {
2065                const u = new URL(url, document.baseURI);
2066
2067                if (
2068                    u.protocol === 'http:' ||
2069                    u.protocol === 'https:'
2070                ) {
2071                    return u.href;
2072                }
2073            } catch(e) {}
2074
2075            return '';
2076        }
2077    },
2078    "cookie": {
2079        "owner": {},
2080        "create": function (key, status) {
2081            "use strict";
2082
2083            if (tarteaucitronForceExpire !== '') {
2084                // The number of day(s)/hour(s) can't be higher than 1 year
2085                if ((tarteaucitronExpireInDay && tarteaucitronForceExpire < 365) || (!tarteaucitronExpireInDay && tarteaucitronForceExpire < 8760)) {
2086                    if (tarteaucitronExpireInDay) {
2087                        // Multiplication to tranform the number of days to milliseconds
2088                        timeExpire = tarteaucitronForceExpire * 86400000;
2089                    } else {
2090                        // Multiplication to tranform the number of hours to milliseconds
2091                        timeExpire = tarteaucitronForceExpire * 3600000;
2092                    }
2093                }
2094            }
2095
2096            var d = new Date(),
2097                time = d.getTime(),
2098                expireTime = time + timeExpire, // 365 days
2099                regex = new RegExp("!" + key + "=(wait|true|false)", "g"),
2100                cookie = tarteaucitron.cookie.read().replace(regex, ""),
2101                value = tarteaucitron.parameters.cookieName + '=' + cookie + '!' + key + '=' + status,
2102                domain = (tarteaucitron.parameters.cookieDomain !== undefined && tarteaucitron.parameters.cookieDomain !== '') ? '; domain=' + tarteaucitron.parameters.cookieDomain : '',
2103                secure = location.protocol === 'https:' ? '; Secure' : '';
2104
2105            d.setTime(expireTime);
2106            document.cookie = value + '; expires=' + d.toGMTString() + '; path=/' + domain + secure + '; samesite=lax';
2107
2108            tarteaucitron.sendEvent('tac.consent_updated');
2109        },
2110        "read": function () {
2111            "use strict";
2112            var nameEQ = tarteaucitron.parameters.cookieName + "=",
2113                ca = document.cookie.split(';'),
2114                i,
2115                c;
2116
2117            for (i = 0; i < ca.length; i += 1) {
2118                c = ca[i];
2119                while (c.charAt(0) === ' ') {
2120                    c = c.substring(1, c.length);
2121                }
2122                if (c.indexOf(nameEQ) === 0) {
2123                    return c.substring(nameEQ.length, c.length);
2124                }
2125            }
2126            return '';
2127        },
2128        "purge": function (arr) {
2129            "use strict";
2130
2131            var i,
2132                j,
2133                k,
2134                service,
2135                allowed,
2136                rgxpCookie;
2137
2138            for (i = 0; i < arr.length; i += 1) {
2139
2140                allowed = false;
2141
2142                if (tarteaucitron.parameters.cookieslist !== true && tarteaucitron.parameters.cookieslistEmbed !== true) {
2143
2144                    for (j = 0; j < tarteaucitron.job.length; j += 1) {
2145
2146                        service = tarteaucitron.services[tarteaucitron.job[j]];
2147
2148                        if (service !== undefined && service.cookies !== undefined) {
2149
2150                            for (k = 0; k < service.cookies.length; k += 1) {
2151
2152                                if (service.cookies[k] === arr[i]) {
2153                                    allowed = true;
2154                                    break;
2155                                }
2156                            }
2157                        }
2158
2159                        if (allowed) {
2160                            break;
2161                        }
2162                    }
2163
2164                    if (!allowed) {
2165                        continue;
2166                    }
2167                }
2168
2169                rgxpCookie = new RegExp("^(.*;)?\\s*" + arr[i] + "\\s*=\\s*[^;]+(.*)?$");
2170
2171                if (document.cookie.match(rgxpCookie)) {
2172                    document.cookie = arr[i] + '=; expires=Thu, 01 Jan 2000 00:00:00 GMT; path=/;';
2173                    document.cookie = arr[i] + '=; expires=Thu, 01 Jan 2000 00:00:00 GMT; path=/; domain=.' + location.hostname + ';';
2174                    document.cookie = arr[i] + '=; expires=Thu, 01 Jan 2000 00:00:00 GMT; path=/; domain=.' + location.hostname.split('.').slice(-2).join('.') + ';';
2175                }
2176            }
2177        },
2178        "checkCount": function (key) {
2179            "use strict";
2180            var arr = tarteaucitron.services[key].cookies,
2181                nb = arr.length,
2182                nbCurrent = 0,
2183                html = '',
2184                i,
2185                status = document.cookie.indexOf(key + '=true'),
2186                cookieLabel = "cookie";
2187
2188            if (tarteaucitron.getLanguage() === "de") {
2189                cookieLabel = "Cookie";
2190            }
2191
2192            if (status >= 0 && nb === 0) {
2193                html += tarteaucitron.lang.useNoCookie;
2194            } else if (nb > 0) {
2195                for (i = 0; i < nb; i += 1) {
2196                    if (document.cookie.indexOf(arr[i] + '=') !== -1) {
2197                        nbCurrent += 1;
2198                        if (tarteaucitron.cookie.owner[arr[i]] === undefined) {
2199                            tarteaucitron.cookie.owner[arr[i]] = [];
2200                        }
2201                        if (tarteaucitron.cookie.crossIndexOf(tarteaucitron.cookie.owner[arr[i]], tarteaucitron.services[key].name) === false) {
2202                            tarteaucitron.cookie.owner[arr[i]].push(tarteaucitron.services[key].name);
2203                        }
2204                    }
2205                }
2206
2207                if (nbCurrent > 0) {
2208                    html += tarteaucitron.lang.useCookieCurrent + ' ' + nbCurrent + ' ' + cookieLabel;
2209                    if (nbCurrent > 1) {
2210                        html += 's';
2211                    }
2212                    html += '.';
2213                } else {
2214                    html += tarteaucitron.lang.useNoCookie;
2215                }
2216            } else if (nb === 0) {
2217                html = tarteaucitron.lang.noCookie;
2218            } else {
2219                html += tarteaucitron.lang.useCookie + ' ' + nb + ' ' + cookieLabel;
2220                if (nb > 1) {
2221                    html += 's';
2222                }
2223                html += '.';
2224            }
2225
2226            if (document.getElementById('tacCL' + key) !== null) {
2227                document.getElementById('tacCL' + key).innerHTML = html;
2228            }
2229        },
2230        "crossIndexOf": function (arr, match) {
2231            "use strict";
2232            var i;
2233            for (i = 0; i < arr.length; i += 1) {
2234                if (arr[i] === match) {
2235                    return true;
2236                }
2237            }
2238            return false;
2239        },
2240        "number": function () {
2241            "use strict";
2242            var cookies = document.cookie.split(';'),
2243                nb = (document.cookie !== '') ? cookies.length : 0,
2244                html = '',
2245                i,
2246                name,
2247                namea,
2248                nameb,
2249                c,
2250                d,
2251                s = (nb > 1) ? 's' : '',
2252                savedname,
2253                regex = /^https?\:\/\/([^\/?#]+)(?:[\/?#]|$)/i,
2254                regexedDomain = (tarteaucitron.cdn.match(regex) !== null) ? tarteaucitron.cdn.match(regex)[1] : tarteaucitron.cdn,
2255                host = (tarteaucitron.domain !== undefined) ? tarteaucitron.domain : regexedDomain;
2256
2257            cookies = cookies.sort(function (a, b) {
2258                namea = a.split('=', 1).toString().replace(/ /g, '');
2259                nameb = b.split('=', 1).toString().replace(/ /g, '');
2260                c = (tarteaucitron.cookie.owner[namea] !== undefined) ? tarteaucitron.cookie.owner[namea] : '0';
2261                d = (tarteaucitron.cookie.owner[nameb] !== undefined) ? tarteaucitron.cookie.owner[nameb] : '0';
2262                if (c + a > d + b) { return 1; }
2263                if (c + a < d + b) { return -1; }
2264                return 0;
2265            });
2266
2267            if (document.cookie !== '') {
2268                for (i = 0; i < nb; i += 1) {
2269                    name = cookies[i].split('=', 1).toString().replace(/ /g, '');
2270                    if (tarteaucitron.cookie.owner[name] !== undefined && tarteaucitron.cookie.owner[name].join(' // ') !== savedname) {
2271                        savedname = tarteaucitron.cookie.owner[name].join(' // ');
2272                        html += '<div class="tarteaucitronHidden">';
2273                        html += '     <span class="tarteaucitronH3" role="heading" aria-level="4">';
2274                        html += '        ' + tarteaucitron.cookie.owner[name].join(' // ');
2275                        html += '    </span>';
2276                        html += '</div><ul class="cookie-list">';
2277                    } else if (tarteaucitron.cookie.owner[name] === undefined && host !== savedname) {
2278                        savedname = host;
2279                        html += '<div class="tarteaucitronHidden">';
2280                        html += '     <span class="tarteaucitronH3" role="heading" aria-level="4">';
2281                        html += '        ' + host;
2282                        html += '    </span>';
2283                        html += '</div><ul class="cookie-list">';
2284                    }
2285                    html += '<li class="tarteaucitronCookiesListMain">';
2286                    html += '    <div class="tarteaucitronCookiesListLeft"><button type="button" class="purgeBtn" data-cookie="' + tarteaucitron.fixSelfXSS(cookies[i].split('=', 1)) + '"><strong>&times;</strong></button> <strong>' + tarteaucitron.fixSelfXSS(name) + '</strong>';
2287                    html += '    </div>';
2288                    html += '    <div class="tarteaucitronCookiesListRight">' + tarteaucitron.cookie.beautify(cookies[i].split('=').slice(1).join('=')) + '</div>';
2289                    html += '</li>';
2290                }
2291                html += '</ul>';
2292            } else {
2293                html += '<div class="tarteaucitronCookiesListMain">';
2294                html += '    <div class="tarteaucitronCookiesListLeft"><strong>-</strong></div>';
2295                html += '    <div class="tarteaucitronCookiesListRight"></div>';
2296                html += '</div>';
2297            }
2298
2299            html += '<div class="tarteaucitronHidden tarteaucitron-spacer-20"></div>';
2300
2301            if (document.getElementById('tarteaucitronCookiesList') !== null) {
2302                document.getElementById('tarteaucitronCookiesList').innerHTML = html;
2303            }
2304
2305            if (document.getElementById('tarteaucitronCookiesNumber') !== null) {
2306                document.getElementById('tarteaucitronCookiesNumber').innerHTML = nb;
2307                document.getElementById('tarteaucitronCookiesNumber').setAttribute("aria-label", nb + ' cookie' + s + " - " + tarteaucitron.lang.toggleInfoBox);
2308                document.getElementById('tarteaucitronCookiesNumber').setAttribute("title", nb + ' cookie' + s + " - " + tarteaucitron.lang.toggleInfoBox);
2309            }
2310
2311            if (document.getElementById('tarteaucitronCookiesNumberBis') !== null) {
2312                document.getElementById('tarteaucitronCookiesNumberBis').innerHTML = nb + ' cookie' + s;
2313            }
2314
2315            var purgeBtns = document.getElementsByClassName("purgeBtn");
2316            for (i = 0; i < purgeBtns.length; i++) {
2317                tarteaucitron.addClickEventToElement(purgeBtns[i], function () {
2318                    tarteaucitron.cookie.purge([this.dataset.cookie]);
2319                    tarteaucitron.cookie.number();
2320                    tarteaucitron.userInterface.jsSizing('cookie');
2321                    return false;
2322                });
2323            }
2324
2325            for (i = 0; i < tarteaucitron.job.length; i += 1) {
2326                tarteaucitron.cookie.checkCount(tarteaucitron.job[i]);
2327            }
2328        },
2329        "beautify": function(v) {
2330            let beautiful = v;
2331            try {
2332                beautiful = decodeURIComponent(decodeURI(v));
2333            } catch {}
2334            return tarteaucitron.fixSelfXSS(beautiful);
2335        }
2336    },
2337    "fixSelfXSS": function(html) {
2338        return html.toString().replace(/&/g, "&amp;").replace(/</g, "&lt;").replace(/>/g, "&gt;").replace(/"/g, "&quot;").replace(/'/g, "&#039;");
2339    },
2340    "getLanguage": function () {
2341        "use strict";
2342
2343        var availableLanguages = 'ar,bg,ca,cn,cs,da,de,et,el,en,es,fi,fr,hr,hu,it,ja,ko,lb,lt,lv,nl,no,oc,pl,pt,ro,ru,se,sk,sq,sv,tr,uk,vi,zh',
2344            defaultLanguage = 'en';
2345
2346        if (tarteaucitronForceLanguage !== '') {
2347            if (availableLanguages.indexOf(tarteaucitronForceLanguage) !== -1) {
2348                return tarteaucitronForceLanguage;
2349            }
2350        }
2351
2352        // get the html lang
2353        if (document.documentElement.getAttribute("lang") !== undefined && document.documentElement.getAttribute("lang") !== null && document.documentElement.getAttribute("lang") !== "") {
2354            if (availableLanguages.indexOf(document.documentElement.getAttribute("lang").substr(0, 2)) !== -1) {
2355                return document.documentElement.getAttribute("lang").substr(0, 2);
2356            }
2357        }
2358
2359        if (!navigator) { return defaultLanguage; }
2360
2361        var lang = navigator.language || navigator.browserLanguage ||
2362                navigator.systemLanguage || navigator.userLang || null,
2363            userLanguage = lang ? lang.substr(0, 2) : null;
2364
2365        if (availableLanguages.indexOf(userLanguage) !== -1) {
2366            return userLanguage;
2367        }
2368
2369        return defaultLanguage;
2370    },
2371    "getLocale": function () {
2372        "use strict";
2373        if (!navigator) { return 'en_US'; }
2374
2375        var lang = navigator.language || navigator.browserLanguage ||
2376                navigator.systemLanguage || navigator.userLang || null,
2377            userLanguage = lang ? lang.substr(0, 2) : null;
2378
2379        if (userLanguage === 'fr') {
2380            return 'fr_FR';
2381        } else if (userLanguage === 'en') {
2382            return 'en_US';
2383        } else if (userLanguage === 'de') {
2384            return 'de_DE';
2385        } else if (userLanguage === 'es') {
2386            return 'es_ES';
2387        } else if (userLanguage === 'it') {
2388            return 'it_IT';
2389        } else if (userLanguage === 'pt') {
2390            return 'pt_PT';
2391        } else if (userLanguage === 'nl') {
2392            return 'nl_NL';
2393        } else if (userLanguage === 'el') {
2394            return 'el_EL';
2395        } else {
2396            return 'en_US';
2397        }
2398    },
2399    "addScript": function (url, id, callback, execute, attrName, attrVal, internal) {
2400        "use strict";
2401        var script,
2402            done = false;
2403
2404        if (execute === false) {
2405            if (typeof callback === 'function') {
2406                callback();
2407            }
2408        } else {
2409            script = document.createElement('script');
2410            if (id !== undefined && id !== "") {
2411                script.id = id;
2412            }
2413            script.async = true;
2414            script.src = url;
2415
2416            if (attrName !== undefined && attrVal !== undefined) {
2417                script.setAttribute(attrName, attrVal);
2418            }
2419
2420            if (typeof callback === 'function') {
2421                if ( !tarteaucitron.parameters.useExternalJs || !internal ) {
2422                    script.onreadystatechange = script.onload = function () {
2423                        var state = script.readyState;
2424                        if (!done && (!state || /loaded|complete/.test(state))) {
2425                            done = true;
2426                            callback();
2427                        }
2428                    };
2429                } else {
2430                    callback();
2431                }
2432            }
2433
2434            if ( !tarteaucitron.parameters.useExternalJs || !internal ) {
2435                document.getElementsByTagName('head')[0].appendChild(script);
2436            }
2437        }
2438    },
2439    "addInternalScript": function (url, id, callback, execute, attrName, attrVal) {
2440        tarteaucitron.addScript(url, id, callback, execute, attrName, attrVal, true);
2441    },
2442    "checkIfExist": function (elemId) {
2443        "use strict";
2444        return document.getElementById(elemId) !== null && document.getElementById(elemId).offsetWidth !== 0 && document.getElementById(elemId).offsetHeight !== 0;
2445    },
2446    "makeAsync": {
2447        "antiGhost": 0,
2448        "buffer": '',
2449        "init": function (url, id) {
2450            "use strict";
2451            var savedWrite = document.write,
2452                savedWriteln = document.writeln;
2453
2454            document.write = function (content) {
2455                tarteaucitron.makeAsync.buffer += content;
2456            };
2457            document.writeln = function (content) {
2458                tarteaucitron.makeAsync.buffer += content.concat("\n");
2459            };
2460
2461            setTimeout(function () {
2462                document.write = savedWrite;
2463                document.writeln = savedWriteln;
2464            }, 20000);
2465
2466            tarteaucitron.makeAsync.getAndParse(url, id);
2467        },
2468        "getAndParse": function (url, id) {
2469            "use strict";
2470            if (tarteaucitron.makeAsync.antiGhost > 9) {
2471                tarteaucitron.makeAsync.antiGhost = 0;
2472                return;
2473            }
2474            tarteaucitron.makeAsync.antiGhost += 1;
2475            tarteaucitron.addInternalScript(url, '', function () {
2476                if (document.getElementById(id) !== null) {
2477                    document.getElementById(id).innerHTML += "<span class='tarteaucitron-display-none'>&nbsp;</span>" + tarteaucitron.makeAsync.buffer;
2478                    tarteaucitron.makeAsync.buffer = '';
2479                    tarteaucitron.makeAsync.execJS(id);
2480                }
2481            });
2482        },
2483        "execJS": function (id) {
2484            /* not strict because third party scripts may have errors */
2485            var i,
2486                scripts,
2487                childId,
2488                type;
2489
2490            if (document.getElementById(id) === null) {
2491                return;
2492            }
2493
2494            scripts = document.getElementById(id).getElementsByTagName('script');
2495            for (i = 0; i < scripts.length; i += 1) {
2496                type = (scripts[i].getAttribute('type') !== null) ? scripts[i].getAttribute('type') : '';
2497                if (type === '') {
2498                    type = (scripts[i].getAttribute('language') !== null) ? scripts[i].getAttribute('language') : '';
2499                }
2500                if (scripts[i].getAttribute('src') !== null && scripts[i].getAttribute('src') !== '') {
2501                    childId = id + Math.floor(Math.random() * 99999999999);
2502                    document.getElementById(id).innerHTML += '<div id="' + childId + '"></div>';
2503                    tarteaucitron.makeAsync.getAndParse(scripts[i].getAttribute('src'), childId);
2504                } else if (type.indexOf('javascript') !== -1 || type === '') {
2505                    eval(scripts[i].innerHTML);
2506                }
2507            }
2508        }
2509    },
2510    "fallback": function (matchClass, content, noInner) {
2511        "use strict";
2512        var selector = matchClass.map(function(cls) {
2513            return '.' + cls;
2514        }).join(', ');
2515
2516        var elems = document.querySelectorAll(selector);
2517
2518        for (var i = 0; i < elems.length; i++) {
2519            var elem = elems[i];
2520
2521            var width = tarteaucitron.getElemAttr(elem, 'width'),
2522                height = tarteaucitron.getElemAttr(elem, 'height');
2523
2524            if (width !== "") {
2525                elem.style.width = tarteaucitron.getStyleSize(width);
2526            }
2527            if (height !== "") {
2528                elem.style.height = tarteaucitron.getStyleSize(height);
2529            }
2530
2531            if (typeof content === 'function') {
2532                if (noInner === true) {
2533                    content(elem);
2534                } else {
2535                    elem.innerHTML = content(elem);
2536                }
2537            } else {
2538                elem.innerHTML = content;
2539            }
2540        }
2541    },
2542    "engage": function (id) {
2543        "use strict";
2544        var html = '',
2545            r = Math.floor(Math.random() * 100000),
2546            engage = tarteaucitron.services[id].name + ' ' + tarteaucitron.lang.fallback;
2547
2548        if (tarteaucitron.lang['engage-' + id] !== undefined) {
2549            engage = tarteaucitron.lang['engage-' + id];
2550        }
2551
2552        html += '<div class="tac_activate tac_activate_' + id + '">';
2553        html += '   <div class="tac_float">';
2554        html += '      <span role="paragraph">' + engage + '</span>';
2555        html += '      <button aria-label="' + tarteaucitron.lang.allow + ' ' + tarteaucitron.services[id].name + '" type="button" class="tarteaucitronAllow" id="Eng' + r + 'ed' + id + '">';
2556        html += '          <span class="tarteaucitronCheck" aria-hidden="true"></span> ' + tarteaucitron.lang.allow;
2557        html += '       </button>';
2558        html += '   </div>';
2559        html += '</div>';
2560
2561        return html;
2562    },
2563    "extend": function (a, b) {
2564        "use strict";
2565        var prop;
2566        for (prop in b) {
2567            if (b.hasOwnProperty(prop)) {
2568                a[prop] = b[prop];
2569            }
2570        }
2571    },
2572    "proTemp": '',
2573    "proTimer": function () {
2574        "use strict";
2575        setTimeout(tarteaucitron.proPing, (Math.floor(Math.random() * (1200 - 500 + 1)) + 500));
2576    },
2577    "pro": function (list) {
2578        "use strict";
2579        tarteaucitron.proTemp += list;
2580        clearTimeout(tarteaucitron.proTimer);
2581        tarteaucitron.proTimer = setTimeout(tarteaucitron.proPing, (Math.floor(Math.random() * (1200 - 500 + 1)) + 500));
2582    },
2583    "proPing": function () {
2584        "use strict";
2585        if (tarteaucitron.uuid !== '' && tarteaucitron.uuid !== undefined && tarteaucitron.proTemp !== '' && tarteaucitronStatsEnabled) {
2586            var div = document.getElementById('tarteaucitronPremium'),
2587                timestamp = new Date().getTime(),
2588                url = 'https://logs.tarteaucitron.io/collect';
2589
2590            if (div === null) {
2591                return;
2592            }
2593
2594            var beaconSent = false;
2595            if (navigator.sendBeacon) {
2596                var data = {
2597                    'uuid': tarteaucitron.uuid,
2598                    'domain': tarteaucitron.domain,
2599                    'status': tarteaucitron.proTemp
2600                };
2601                var params = new URLSearchParams(data);
2602                beaconSent = navigator.sendBeacon(url, params);
2603            }
2604
2605            if (!beaconSent) {
2606                url += '?uuid=' + tarteaucitron.uuid + '&';
2607                url += 'domain=' + tarteaucitron.domain + '&';
2608                url += 'status=' + encodeURIComponent(tarteaucitron.proTemp) + '&';
2609                url += '_time=' + timestamp;
2610
2611                div.innerHTML = '<img src="' + url + '" class="tarteaucitron-display-none" alt="" />';
2612            }
2613
2614            tarteaucitron.proTemp = '';
2615        }
2616
2617        tarteaucitron.cookie.number();
2618    },
2619    "AddOrUpdate" : function(source, custom){
2620        /**
2621         Utility function to Add or update the fields of obj1 with the ones in obj2
2622         */
2623        for(var key in custom){
2624            if (key === "__proto__" || key === "constructor") continue;
2625            if(custom.hasOwnProperty(key)){
2626                if(custom[key] instanceof Object){
2627                    source[key] = tarteaucitron.AddOrUpdate(source[key], custom[key]);
2628                }else{
2629                    source[key] = custom[key];
2630                }
2631            }
2632        }
2633        return source;
2634    },
2635    "getElemWidth": function(elem) {
2636        return tarteaucitron.getElemAttr(elem, 'width') || elem.clientWidth;
2637    },
2638    "getElemHeight": function(elem) {
2639        return tarteaucitron.getElemAttr(elem, 'height') || elem.clientHeight;
2640    },
2641    "getElemAttr": function (elem, attr) {
2642
2643        var attribute = elem.getAttribute('data-' + attr) || elem.getAttribute(attr) || elem.getAttribute(attr.startsWith('data-') ? attr.slice(5) : attr);
2644
2645        // security: only allow real url on the url attr
2646        if ((attr === 'url' || attr === 'data-url' || attr === 'data-src') && !/^https?:\/\/[^\s]+$/.test(elem.getAttribute(attr))) {
2647            return "";
2648        }
2649
2650        // security: disallow data-srcdoc attr to avoid xss
2651        if (attr === 'srcdoc' || attr === 'data-srcdoc') {
2652            attribute = elem.getAttribute('srcdoc');
2653        }
2654
2655        if (typeof attribute === 'string') {
2656            return tarteaucitron.fixSelfXSS(attribute);
2657        }
2658
2659        return "";
2660    },
2661    "getStyleSize": function (value) {
2662        if (value == null) {
2663            return 'auto';
2664        }
2665
2666        value = String(value).trim();
2667
2668        var units = ['px', '%', 'em', 'rem', 'vh', 'vw', 'vmin', 'vmax', 'ch', 'ex', 'pt', 'pc', 'cm', 'mm', 'in', 'q'];
2669        var pattern = new RegExp('^\\d+(\\.\\d+)?(' + units.join('|') + ')$');
2670
2671        if (pattern.test(value)) {
2672            return value;
2673        }
2674
2675        if (/^\d+(\.\d+)?$/.test(value)) {
2676            return value + 'px';
2677        }
2678
2679        return 'auto';
2680    },
2681    "addClickEventToId": function (elemId, func) {
2682        tarteaucitron.addClickEventToElement(document.getElementById(elemId), func);
2683    },
2684    "addClickEventToElement": function (e, func) {
2685        if (e) {
2686            if (e.addEventListener) {
2687                e.addEventListener("click", func);
2688            } else {
2689                e.attachEvent("onclick", func);
2690            }
2691        }
2692    },
2693    "triggerJobsAfterAjaxCall": function() {
2694        tarteaucitron.job.forEach(function(e) { tarteaucitron.job.push(e) });
2695        var i;
2696        var allowBtns = document.getElementsByClassName("tarteaucitronAllow");
2697        for (i = 0; i < allowBtns.length; i++) {
2698            tarteaucitron.addClickEventToElement(allowBtns[i], function () {
2699                tarteaucitron.userInterface.respond(this, true);
2700            });
2701        }
2702        var denyBtns = document.getElementsByClassName("tarteaucitronDeny");
2703        for (i = 0; i < denyBtns.length; i++) {
2704            tarteaucitron.addClickEventToElement(denyBtns[i], function () {
2705                tarteaucitron.userInterface.respond(this, false);
2706            });
2707        }
2708    },
2709    "dynamicJobPush": function(id) {
2710        if (tarteaucitron.added[id] !== true) {
2711            tarteaucitron.job.push(id);
2712        } else {
2713            if ((typeof tarteaucitronMagic === 'undefined' || tarteaucitronMagic.indexOf("_" + id + "_") < 0) && (tarteaucitron.parameters.serverSide !== true || (typeof tarteaucitronServerSideExclude !== 'undefined' && Array.isArray(tarteaucitronServerSideExclude) && tarteaucitronServerSideExclude.indexOf(id) !== -1))) {
2714                if(tarteaucitron.state[id] === true && typeof tarteaucitron.services[id].js === 'function') {
2715                    tarteaucitron.services[id].js();
2716                } else if (typeof tarteaucitron.services[id].fallback === 'function') {
2717                    tarteaucitron.services[id].fallback();
2718                }
2719            }
2720        }
2721        tarteaucitron.triggerJobsAfterAjaxCall();
2722    }
2723};

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.