PageSourceSearch

https://www.agglo-saint-louis.fr/utilities/tarteaucitron/tarteaucitron.js

js agglo-saint-louis.fr collected 2026-10-02 16:35:53 UTC 78,378 bytes, 1,667 lines download raw bytes

1/*jslint browser: true, evil: true */
2
3var scripts = document.getElementsByTagName('script'),
4    path = scripts[scripts.length - 1].src.split('?')[0],
5    tarteaucitronForceCDN = (tarteaucitronForceCDN === undefined) ? '' : tarteaucitronForceCDN,
6    cdn = (tarteaucitronForceCDN === '') ? path.split('/').slice(0, -1).join('/') + '/' : tarteaucitronForceCDN,
7    alreadyLaunch = (alreadyLaunch === undefined) ? 0 : alreadyLaunch,
8    tarteaucitronForceLanguage = (tarteaucitronForceLanguage === undefined) ? '' : tarteaucitronForceLanguage,
9    tarteaucitronForceExpire = (tarteaucitronForceExpire === undefined) ? '' : tarteaucitronForceExpire,
10    tarteaucitronCustomText = (tarteaucitronCustomText === undefined) ? '' : tarteaucitronCustomText,
11    // tarteaucitronExpireInDay: true for day(s) value - false for hour(s) value
12    tarteaucitronExpireInDay = (tarteaucitronExpireInDay === undefined || typeof tarteaucitronExpireInDay !== "boolean") ? true : tarteaucitronExpireInDay,
13    timeExpire = 31536000000,
14    tarteaucitronProLoadServices,
15    tarteaucitronNoAdBlocker = false;
16
17
18
19var tarteaucitron = {
20    "version": 20200730,
21    "cdn": cdn,
22    "user": {},
23    "lang": {},
24    "services": {},
25    "added": [],
26    "idprocessed": [],
27    "state": [],
28    "launch": [],
29    "parameters": {},
30    "isAjax": false,
31    "reloadThePage": false,
32    "events": {
33        "init": function () {},
34        "load": function () {},
35    },
36    "init": function (params) {
37        "use strict";
38        var origOpen;
39        params.highPrivacy = true;
40        tarteaucitron.parameters = params;
41        if (alreadyLaunch === 0) {
42            alreadyLaunch = 1;
43            if (window.addEventListener) {
44                window.addEventListener("load", function () {
45                    tarteaucitron.initEvents.loadEvent(false);
46                }, false);
47                window.addEventListener("scroll", function () {
48                    tarteaucitron.initEvents.scrollEvent();
49                }, false);
50
51                window.addEventListener("keydown", function (evt) {
52                    tarteaucitron.initEvents.keydownEvent(false, evt);
53                }, false);
54                window.addEventListener("hashchange", function () {
55                    tarteaucitron.initEvents.hashchangeEvent();
56                }, false);
57                window.addEventListener("resize", function () {
58                    tarteaucitron.initEvents.resizeEvent();
59                }, false);
60            } else {
61                window.attachEvent("onload", function () {
62                    tarteaucitron.initEvents.loadEvent(true);
63                });
vendor: 5,716 bytes, lines 63-196
63
64                window.attachEvent("onscroll", function () {
65                    tarteaucitron.initEvents.scrollEvent();
66                });
67                window.attachEvent("onkeydown", function (evt) {
68                    tarteaucitron.initEvents.keydownEvent(true, evt);
69
70                });
71                window.attachEvent("onhashchange", function () {
72                    tarteaucitron.initEvents.hashchangeEvent();
73                });
74                window.attachEvent("onresize", function () {
75                    tarteaucitron.initEvents.resizeEvent();
76                });
77            }
78
79            if (typeof XMLHttpRequest !== 'undefined') {
80                origOpen = XMLHttpRequest.prototype.open;
81                XMLHttpRequest.prototype.open = function () {
82
83                    if (window.addEventListener) {
84                        this.addEventListener("load", function () {
85                            if (typeof tarteaucitronProLoadServices === 'function') {
86                                tarteaucitronProLoadServices();
87                            }
88                        }, false);
89                    } else if (typeof this.attachEvent !== 'undefined') {
90                        this.attachEvent("onload", function () {
91                            if (typeof tarteaucitronProLoadServices === 'function') {
92                                tarteaucitronProLoadServices();
93                            }
94                        });
95                    } else {
96                        if (typeof tarteaucitronProLoadServices === 'function') {
97                            setTimeout(tarteaucitronProLoadServices, 1000);
98                        }
99                    }
100
101                    try {
102                        origOpen.apply(this, arguments);
103                    } catch (err) {}
104                };
105            }
106        }
107
108        if(tarteaucitron.events.init) {
109            tarteaucitron.events.init();
110        }
111    },
112    "initEvents": {
113        "loadEvent": function (isOldBrowser) {
114            tarteaucitron.load();
115            tarteaucitron.fallback(['tarteaucitronOpenPanel'], function (elem) {
116                if (isOldBrowser) {
117                    elem.attachEvent("onclick", function (event) {
118                        tarteaucitron.userInterface.openPanel();
119                        event.preventDefault();
120                    });
121                } else {
122                    elem.addEventListener("click", function (event) {
123                        tarteaucitron.userInterface.openPanel();
124                        event.preventDefault();
125                    }, false);
126                }
127            }, true);
128        },
129        "keydownEvent": function (isOldBrowser, evt) {
130            if (evt.keyCode === 27) {
131                tarteaucitron.userInterface.closePanel();
132            }
133
134            if (isOldBrowser) {
135                if ( evt.keyCode === 9 && focusableEls.indexOf(evt.target) >= 0) {
136                    if ( evt.shiftKey ) /* shift + tab */ {
137                        if (document.activeElement === firstFocusableEl) {
138                            lastFocusableEl.focus();
139                            evt.preventDefault();
140                        }
141                    } else /* tab */ {
142                        if (document.activeElement === lastFocusableEl) {
143                            firstFocusableEl.focus();
144                            evt.preventDefault();
145                        }
146                    }
147                }
148            }
149        },
150        "hashchangeEvent": function () {
151            if (document.location.hash === tarteaucitron.hashtag && tarteaucitron.hashtag !== '') {
152                tarteaucitron.userInterface.openPanel();
153            }
154        },
155        "resizeEvent": function () {
156            var tacElem = document.getElementById('tarteaucitron');
157            var tacCookieContainer = document.getElementById('tarteaucitronCookiesListContainer');
158
159            if (tacElem && tacElem.style.display === 'block') {
160                tarteaucitron.userInterface.jsSizing('main');
161            }
162
163            if (tacCookieContainer && tacCookieContainer.style.display === 'block') {
164                tarteaucitron.userInterface.jsSizing('cookie');
165            }
166        },
167        "scrollEvent": function () {
168            var scrollPos = window.pageYOffset || document.documentElement.scrollTop;
169            var heightPosition;
170            var tacPercentage = document.getElementById('tarteaucitronPercentage');
171            var tacAlertBig = document.getElementById('tarteaucitronAlertBig');
172
173            if (tacAlertBig && !tarteaucitron.highPrivacy) {
174                if (tacAlertBig.style.display === 'block') {
175                    heightPosition = tacAlertBig.offsetHeight + 'px';
176
177                    if (scrollPos > (screen.height * 2)) {
178                        tarteaucitron.userInterface.respondAll(true);
179                    } else if (scrollPos > (screen.height / 2)) {
180                        document.getElementById('tarteaucitronDisclaimerAlert').innerHTML = '<strong>' + tarteaucitron.lang.alertBigScroll + '</strong> ' + tarteaucitron.lang.alertBig;
181                    }
182
183                    if (tacPercentage) {
184                        if (tarteaucitron.orientation === 'top') {
185                            tacPercentage.style.top = heightPosition;
186                        } else {
187                            tacPercentage.style.bottom = heightPosition;
188                        }
189                        tacPercentage.style.width = ((100 / (screen.height * 2)) * scrollPos) + '%';
190                    }
191                }
192            }
193        },
194    },
195    "load": function () {
196        "use strict";
197        var cdn = tarteaucitron.cdn,
198            language = tarteaucitron.getLanguage(),
199            pathToLang = cdn + 'lang/tarteaucitron.' + language + '.js?v=' + tarteaucitron.version,
200            pathToServices = cdn + 'tarteaucitron.services.js?v=' + tarteaucitron.version,
201            linkElement = document.createElement('link'),
202            defaults = {
203                "adblocker": false,
204                "hashtag": '#tarteaucitron',
205                "cookieName": 'tarteaucitron',
206                "highPrivacy": true,
207                "orientation": "middle",
208                "bodyPosition": "bottom",
209                "removeCredit": false,
210                "showAlertSmall": true,
211                "cookieslist": true,
212                "handleBrowserDNTRequest": false,
213                "DenyAllCta": true,
214                "AcceptAllCta" : true,
215                "moreInfoLink": true,
216                "privacyUrl": "",
217                "useExternalCss": false,
218                "useExternalJs": false,
219                "mandatory": false
220            },
221            params = tarteaucitron.parameters;
222
223        // Don't show the middle bar if we are on the privacy policy or more page
224        if (((tarteaucitron.parameters.readmoreLink !== undefined && window.location.href == tarteaucitron.parameters.readmoreLink) || window.location.href == tarteaucitron.parameters.privacyUrl) && tarteaucitron.parameters.orientation == "middle") {
225            tarteaucitron.parameters.orientation = "bottom";
226        }
227
228        // Step -1
229        if (typeof tarteaucitronCustomPremium !== 'undefined') {
230            tarteaucitronCustomPremium();
231        }
232
233        // Step 0: get params
234        if (params !== undefined) {
235
236            for (var k in defaults) {
237                if(!tarteaucitron.parameters.hasOwnProperty(k)) {
238                    tarteaucitron.parameters[k] = defaults[k];
239                }
240            }
241        }
242
243        // global
244        tarteaucitron.orientation = tarteaucitron.parameters.orientation;
245        tarteaucitron.hashtag = tarteaucitron.parameters.hashtag;
246        tarteaucitron.highPrivacy = tarteaucitron.parameters.highPrivacy;
247        tarteaucitron.handleBrowserDNTRequest = tarteaucitron.parameters.handleBrowserDNTRequest;
248
249        // Step 1: load css
250        if ( !tarteaucitron.parameters.useExternalCss ) {
251            linkElement.rel = 'stylesheet';
252            linkElement.type = 'text/css';
253            linkElement.href = cdn + 'css/tarteaucitron.css?v=' + tarteaucitron.version;
254            document.getElementsByTagName('head')[0].appendChild(linkElement);
255        }
256        // Step 2: load language and services
257        tarteaucitron.addInternalScript(pathToLang, '', function () {
258
259          if(tarteaucitronCustomText !== ''){
260            tarteaucitron.lang = tarteaucitron.AddOrUpdate(tarteaucitron.lang, tarteaucitronCustomText);
261          }
262            tarteaucitron.addInternalScript(pathToServices, '', function () {
263
264
265                // css for new middle bar
266                if (tarteaucitron.orientation === 'middle') {
267                    var customThemeMiddle = document.createElement('style'),
268                        cssRuleMiddle = 'div#tarteaucitronRoot.tarteaucitronBeforeVisible:before {content: \'\';position: fixed;width: 100%;height: 100%;background: white;top: 0;left: 0;z-index: 999;opacity: 0.5;}div#tarteaucitronAlertBig:before {content: \'' + tarteaucitron.lang.middleBarHead + '\';font-size: 50px;}body #tarteaucitronRoot div#tarteaucitronAlertBig {width: 60%;min-width: 285px;height: auto;margin: auto;left: 50%;top: 50%;transform: translate(-50%, -50%);box-shadow: 0 0 9000px #000;border-radius: 20px;padding: 50px 0;}span#tarteaucitronDisclaimerAlert {padding: 0 30px;}#tarteaucitronRoot span#tarteaucitronDisclaimerAlert {margin: 50px 0;display: block;text-align: center;font-size: 21px;}';
269
270                    customThemeMiddle.type = 'text/css';
271                    if (customThemeMiddle.styleSheet) {
272                        customThemeMiddle.styleSheet.cssText = cssRuleMiddle;
273                    } else {
274                        customThemeMiddle.appendChild(document.createTextNode(cssRuleMiddle));
275                    }
276                    document.getElementsByTagName('head')[0].appendChild(customThemeMiddle);
277                }
278
279                var body = document.body,
280                    div = document.createElement('div'),
281                    html = '',
282                    index,
283                    orientation = 'Top',
284                    cat = ['ads', 'analytic', 'api', 'comment', 'social', 'support', 'video', 'other'],
285                    i;
286
287                cat = cat.sort(function (a, b) {
288                    if (tarteaucitron.lang[a].title > tarteaucitron.lang[b].title) { return 1; }
289                    if (tarteaucitron.lang[a].title < tarteaucitron.lang[b].title) { return -1; }
290                    return 0;
291                });
292
293                // Step 3: prepare the html
294                html += '<div id="tarteaucitronPremium"></div>';
295                html += '<button type="button" id="tarteaucitronBack" onclick="tarteaucitron.userInterface.closePanel();" aria-label="' + tarteaucitron.lang.close + '"></button>';
296                html += '<div id="tarteaucitron" role="dialog" aria-labelledby="dialogTitle">';
297                html += '   <button type="button" id="tarteaucitronClosePanel" onclick="tarteaucitron.userInterface.closePanel();">';
298                html += '       ' + tarteaucitron.lang.close;
299                html += '   </button>';
300                html += '   <div id="tarteaucitronServices">';
301                html += '      <div class="tarteaucitronLine tarteaucitronMainLine" id="tarteaucitronMainLineOffset">';
302                html += '         <span class="tarteaucitronH1" role="heading" aria-level="1" id="dialogTitle">'+ tarteaucitron.lang.title + '</span>';
303                html += '         <div id="tarteaucitronInfo">';
304                html += '         ' + tarteaucitron.lang.disclaimer;
305                if (tarteaucitron.parameters.privacyUrl !== "") {
306                    html += '   <br/><br/>';
307                    html += '   <button type="button" id="tarteaucitronPrivacyUrlDialog" onclick="document.location = tarteaucitron.parameters.privacyUrl">';
308                    html += '       ' + tarteaucitron.lang.privacyUrl;
309                    html += '   </button>';
310                }
311                html += '         </div>';
312                html += '         <div class="tarteaucitronName">';
313                html += '            <span class="tarteaucitronH2" role="heading" aria-level="2">' + tarteaucitron.lang.all + '</span>';
314                html += '         </div>';
315                html += '         <div class="tarteaucitronAsk" id="tarteaucitronScrollbarAdjust">';
316                html += '            <button type="button" id="tarteaucitronAllAllowed" class="tarteaucitronAllow" onclick="tarteaucitron.userInterface.respondAll(true);">';
317                html += '               &#10003; ' + tarteaucitron.lang.allowAll;
318                html += '            </button> ';
319                html += '            <button type="button" id="tarteaucitronAllDenied" class="tarteaucitronDeny" onclick="tarteaucitron.userInterface.respondAll(false);">';
320                html += '               &#10007; ' + tarteaucitron.lang.denyAll;
321                html += '            </button>';
322                html += '         </div>';
323                html += '      </div>';
324                html += '      <div class="tarteaucitronBorder">';
325                html += '         <div class="clear"></div><ul>';
326
327
328                if (tarteaucitron.parameters.mandatory == true) {
329                   html += '<li id="tarteaucitronServicesTitle_mandatory">';
330                   html += '<div class="tarteaucitronTitle">';
331                   html += '   <button type="button">&nbsp; ' + tarteaucitron.lang.mandatoryTitle + '</button>';
332                   html += '</div>';
333                   html += '<ul id="tarteaucitronServices_mandatory">';
334                   html += '<li class="tarteaucitronLine">';
335                   html += '   <div class="tarteaucitronName">';
336                   html += '       <span class="tarteaucitronH3" role="heading" aria-level="3">' + tarteaucitron.lang.mandatoryText + '</span>';
337                   html += '       <span class="tarteaucitronListCookies"></span><br/>';
338                   html += '   </div>';
339                   html += '   <div class="tarteaucitronAsk">';
340                   html += '       <button type="button" class="tarteaucitronAllow">';
341                   html += '           &#10003; ' + tarteaucitron.lang.allow;
342                   html += '       </button> ';
343                   html += '   </div>';
344                   html += '</li>';
345                   html += '</ul></li>';
346                }
347
348                for (i = 0; i < cat.length; i += 1) {
349                    html += '         <li id="tarteaucitronServicesTitle_' + cat[i] + '" class="tarteaucitronHidden">';
350                    html += '            <div class="tarteaucitronTitle">';
351                    html += '               <button type="button" onclick="tarteaucitron.userInterface.toggle(\'tarteaucitronDetails' + cat[i] + '\', \'tarteaucitronInfoBox\');return false">&#10011; ' + tarteaucitron.lang[cat[i]].title + '</button>';
352                    html += '            </div>';
353                    html += '            <div id="tarteaucitronDetails' + cat[i] + '" class="tarteaucitronDetails tarteaucitronInfoBox">';
354                    html += '               ' + tarteaucitron.lang[cat[i]].details;
355                    html += '            </div>';
356                    html += '         <ul id="tarteaucitronServices_' + cat[i] + '"></ul></li>';
357                }
358                html += '             <li id="tarteaucitronNoServicesTitle" class="tarteaucitronLine">' + tarteaucitron.lang.noServices + '</li>';
359                html += '         </ul>';
360                html += '         <div class="tarteaucitronHidden" id="tarteaucitronScrollbarChild" style="height:20px;
360display:block"></div>';
361                if (tarteaucitron.parameters.removeCredit === false) {
362                    html += '     <a class="tarteaucitronSelfLink" href="https://tarteaucitron.io/" rel="nofollow noreferrer noopener" target="_blank" title="tarteaucitron ' + tarteaucitron.lang.newWindow + '">🍋 ' + tarteaucitron.lang.credit + '</a>';
363                }
364                html += '       </div>';
365                html += '   </div>';
366                html += '</div>';
367
368                if (tarteaucitron.parameters.orientation === 'bottom') {
369                    orientation = 'Bottom';
370                }
371
372                if (tarteaucitron.parameters.highPrivacy && !tarteaucitron.parameters.AcceptAllCta) {
373                    html += '<div id="tarteaucitronAlertBig" class="tarteaucitronAlertBig' + orientation + '">';
374                    //html += '<div class="tarteaucitronAlertBigWrapper">';
375                    html += '   <span id="tarteaucitronDisclaimerAlert">';
376                    html += '       ' + tarteaucitron.lang.alertBigPrivacy;
377                    html += '   </span>';
378                    //html += '   <span class="tarteaucitronAlertBigBtnWrapper">';
379                    html += '   <button type="button" id="tarteaucitronPersonalize" onclick="tarteaucitron.userInterface.openPanel
379();">';
380                    html += '       ' + tarteaucitron.lang.personalize;
381                    html += '   </button>';
382
383                    if (tarteaucitron.parameters.privacyUrl !== "") {
384                        html += '   <button type="button" id="tarteaucitronPrivacyUrl" onclick="document.location = tarteaucitron.parameters.privacyUrl">';
385                        html += '       ' + tarteaucitron.lang.privacyUrl;
386                        html += '   </button>';
387                    }
388
389                    //html += '   </span>';
390                    //html += '</div>';
391                    html += '</div>';
392                } else {
393                    html += '<div id="tarteaucitronAlertBig" class="tarteaucitronAlertBig' + orientation + '">';
394                    //html += '<div class="tarteaucitronAlertBigWrapper">';
395                    html += '   <span id="tarteaucitronDisclaimerAlert">';
396
397                    if (tarteaucitron.parameters.highPrivacy) {
398                        html += '       ' + tarteaucitron.lang.alertBigPrivacy;
399                    } else {
400                        html += '       ' + tarteaucitron.lang.alertBigClick + ' ' + tarteaucitron.lang.alertBig;
401                    }
402
403                    html += '   </span>';
404                    //html += '   <span class="tarteaucitronAlertBigBtnWrapper">';
405                    html += '   <button type="button" id="tarteaucitronPersonalize" onclick="tarteaucitron.userInterface.respondAll(true);">';
406                    html += '       &#10003; ' + tarteaucitron.lang.acceptAll;
407                    html += '   </button>';
408
409
410                    if (tarteaucitron.parameters.DenyAllCta) {
411                                    html += '   <button type="button" class="tarteaucitronCTAButton tarteaucitronDeny"  onclick="tarteaucitron.userInterface.respondAll(false);">';
412                                    html += '       &#10007; ' + tarteaucitron.lang.denyAll;
413                                    html += '   </button>';
414                                    // html += '   <br/><br/>';
415                    }
416
417                    html += '   <button type="button" id="tarteaucitronCloseAlert" onclick="tarteaucitron.userInterface.openPanel
417();">';
418                    html += '       ' + tarteaucitron.lang.personalize;
419                    html += '   </button>';
420
421                    if (tarteaucitron.parameters.privacyUrl !== "") {
422                        html += '   <button type="button" id="tarteaucitronPrivacyUrl" onclick="document.location = tarteaucitron.parameters.privacyUrl">';
423                        html += '       ' + tarteaucitron.lang.privacyUrl;
424                        html += '   </button>';
425                    }
426
427                    //html += '   </span>';
428                    //html += '</div>';
429                    html += '</div>';
430                    html += '<div id="tarteaucitronPercentage"></div>';
431                }
432
433                if (tarteaucitron.parameters.showAlertSmall === true) {
434                    html += '<div id="tarteaucitronAlertSmall" class="tarteaucitronAlertSmall' + orientation + '">';
435                    html += '   <button type="button" id="tarteaucitronManager" onclick="tarteaucitron.userInterface.openPanel();">';
436                    html += '       ' + tarteaucitron.lang.alertSmall;
437                    html += '       <span id="tarteaucitronDot">';
438                    html += '           <span id="tarteaucitronDotGreen"></span>';
439                    html += '           <span id="tarteaucitronDotYellow"></span>';
440                    html += '           <span id="tarteaucitronDotRed"></span>';
441                    html += '       </span>';
442                    if (tarteaucitron.parameters.cookieslist === true) {
443                        html += '   </button><!-- @whitespace';
444                        html += '   --><button type="button" id="tarteaucitronCookiesNumber" onclick="tarteaucitron.userInterface.toggleCookiesList();">0</button>';
445                        html += '   <div id="tarteaucitronCookiesListContainer">';
446                        html += '       <button type="button" id="tarteaucitronClosePanelCookie" onclick="tarteaucitron.userInterface.closePanel();">';
447                        html += '           ' + tarteaucitron.lang.close;
448                        html += '       </button>';
449                        html += '       <div class="tarteaucitronCookiesListMain" id="tarteaucitronCookiesTitle">';
450                        html += '            <span class="tarteaucitronH2" role="heading" aria-level="2" id="tarteaucitronCookiesNumberBis">0 cookie</span>';
451                        html += '       </div>';
452                        html += '       <div id="tarteaucitronCookiesList"></div>';
453                        html += '    </div>';
454                    } else {
455                        html += '   </div>';
456                    }
457                    html += '</div>';
458                }
459
460                tarteaucitron.addInternalScript(tarteaucitron.cdn + 'advertising.js?v=' + tarteaucitron.version, '', function () {
461                    if (tarteaucitronNoAdBlocker === true || tarteaucitron.parameters.adblocker === false) {
462
463                        // create a wrapper container at the same level than tarteaucitron so we can add an aria-hidden when tarteaucitron is opened
464                        /*var wrapper = document.createElement('div');
465                        wrapper.id = "contentWrapper";
466
467                        while (document.body.firstChild)
468                        {
469                            wrapper.appendChild(document.body.firstChild);
470                        }
471
472                        // Append the wrapper to the body
473                        document.body.appendChild(wrapper);*/
474
475                        div.id = 'tarteaucitronRoot';
476                        if (tarteaucitron.parameters.bodyPosition === 'top') {
477                            // Prepend tarteaucitron: #tarteaucitronRoot first-child of the body for better accessibility
478                            var bodyFirstChild = body.firstChild;
479                            body.insertBefore(div, bodyFirstChild);
480                        }
481                        else {
482                            // Append tarteaucitron: #tarteaucitronRoot last-child of the body
483                            body.appendChild(div, body);
484                        }
485                        div.innerHTML = html;
486
487                        //ie compatibility
488                        var tacRootAvailableEvent;
489                        if(typeof(Event) === 'function') {
490                            tacRootAvailableEvent = new Event("tac.root_available");
491                        }else{
492                            tacRootAvailableEvent = document.createEvent('Event');
493                            tacRootAvailableEvent.initEvent("tac.root_available", true, true);
494                        }
495                        //end ie compatibility
496
497                        window.dispatchEvent(tacRootAvailableEvent);
498
499                        if (tarteaucitron.job !== undefined) {
500                            tarteaucitron.job = tarteaucitron.cleanArray(tarteaucitron.job);
501                            for (index = 0; index < tarteaucitron.job.length; index += 1) {
502                                tarteaucitron.addService(tarteaucitron.job[index]);
503                            }
504                        } else {
505                            tarteaucitron.job = []
506                        }
507
508                        tarteaucitron.isAjax = true;
509
510                        tarteaucitron.job.push = function (id) {
511
512                            // ie <9 hack
513                            if (typeof tarteaucitron.job.indexOf === 'undefined') {
514                                tarteaucitron.job.indexOf = function (obj, start) {
515                                    var i,
516                                        j = this.length;
517                                    for (i = (start || 0); i < j; i += 1) {
518                                        if (this[i] === obj) { return i; }
519                                    }
520                                    return -1;
521                                };
522                            }
523
524                            if (tarteaucitron.job.indexOf(id) === -1) {
525                                Array.prototype.push.call(this, id);
526                            }
527                            tarteaucitron.launch[id] = false;
528                            tarteaucitron.addService(id);
529                        };
530
531                        if (document.location.hash === tarteaucitron.hashtag && tarteaucitron.hashtag !== '') {
532                            tarteaucitron.userInterface.openPanel();
533                        }
534
535                        tarteaucitron.cookie.number();
536                        setInterval(tarteaucitron.cookie.number, 60000);
537                    }
538                }, tarteaucitron.parameters.adblocker);
539
540                if (tarteaucitron.parameters.adblocker === true) {
541                    setTimeout(function () {
542                        if (tarteaucitronNoAdBlocker === false) {
543                            html = '<div id="tarteaucitronAlertBig" class="tarteaucitronAlertBig' + orientation + '" style="display:block" role="alert" aria-live="polite">';
544                            html += '   <p id="tarteaucitronDisclaimerAlert">';
545                            html += '       ' + tarteaucitron.lang.adblock + '<br/>';
546                            html += '       <strong>' + tarteaucitron.lang.adblock_call + '</strong>';
547                            html += '   </p>';
548                            html += '   <button type="button" class="tarteaucitronCTAButton" onclick="location.reload();">';
549                            html += '       ' + tarteaucitron.lang.reload;
550                            html += '   </button>';
551                            html += '</div>';
552                            html += '<div id="tarteaucitronPremium"></div>';
553
554                            div.id = 'tarteaucitronRoot';
555                            if (tarteaucitron.parameters.bodyPosition === 'top') {
556                                // Prepend tarteaucitron: #tarteaucitronRoot first-child of the body for better accessibility
557                                var bodyFirstChild = body.firstChild;
558                                body.insertBefore(div, bodyFirstChild);
559                            }
560                            else {
561                                // Append tarteaucitron: #tarteaucitronRoot last-child of the body
562                                body.appendChild(div, body);
563                            }
564                            div.innerHTML = html;
565                        }
566                    }, 1500);
567                }
568            });
569        });
570
571        if(tarteaucitron.events.load) {
572            tarteaucitron.events.load();
573        }
574    },
575    "addService": function (serviceId) {
576        "use strict";
577        var html = '',
578            s = tarteaucitron.services,
579            service = s[serviceId],
580            cookie = tarteaucitron.cookie.read(),
581            hostname = document.location.hostname,
582            hostRef = document.referrer.split('/')[2],
583            isNavigating = (hostRef === hostname && window.location.href !== tarteaucitron.parameters.privacyUrl),
584            isAutostart = (!service.needConsent),
585            isWaiting = (cookie.indexOf(service.key + '=wait') >= 0),
586            isDenied = (cookie.indexOf(service.key + '=false') >= 0),
587            isAllowed = ((cookie.indexOf(service.key + '=true') >= 0) || (!service.needConsent && cookie.indexOf(service.key + '=false') < 0)),
588            isResponded = (cookie.indexOf(service.key + '=false') >= 0 || cookie.indexOf(service.key + '=true') >= 0),
589            isDNTRequested = (navigator.doNotTrack === "1" || navigator.doNotTrack === "yes" || navigator.msDoNotTrack === "1" || window.doNotTrack === "1");
590
591        if (tarteaucitron.added[service.key] !== true) {
592            tarteaucitron.added[service.key] = true;
593
594            html += '<li id="' + service.key + 'Line" class="tarteaucitronLine">';
595            html += '   <div class="tarteaucitronName">';
596            html += '       <span class="tarteaucitronH3" role="heading" aria-level="3">' + service.name + '</span>';
597            html += '       <span id="tacCL' + service.key + '" class="tarteaucitronListCookies"></span><br/>';
598
599            if (tarteaucitron.parameters.moreInfoLink == true) {
600
601                var link = 'https://tarteaucitron.io/service/' + service.key + '/';
602                if (service.readmoreLink !== undefined && service.readmoreLink !== '') {
603                    link = service.readmoreLink;
604                }
605                if (tarteaucitron.parameters.readmoreLink !== undefined && tarteaucitron.parameters.readmoreLink !== '') {
606                    link = tarteaucitron.parameters.readmoreLink;
607                }
608                html += '       <a href="' + link + '" target="_blank" rel="noreferrer noopener" title="'+ tarteaucitron.lang.cookieDetail + ' ' + service.name + ' ' + tarteaucitron.lang.ourSite + ' ' + tarteaucitron.lang.newWindow +'">';
609                html += '           ' + tarteaucitron.lang.more;
610                html += '       </a>';
611                html += '        - ';
612                html += '       <a href="' + service.uri + '" target="_blank" rel="noreferrer noopener" title="' + service.name + ' ' + tarteaucitron.lang.newWindow + '">';
613                html += '           ' + tarteaucitron.lang.source;
614                html += '       </a>';
615            }
616
617            html += '   </div>';
618            html += '   <div class="tarteaucitronAsk">';
619            html += '       <button type="button" id="' + service.key + 'Allowed" class="tarteaucitronAllow" onclick="tarteaucitron.userInterface.respond(this, true);">';
620            html += '           &#10003; ' + tarteaucitron.lang.allow;
621            html += '       </button> ';
622            html += '       <button type="button" id="' + service.key  + 'Denied" class="tarteaucitronDeny" onclick="tarteaucitron.userInterface.respond(this, false);">';
623            html += '           &#10007; ' + tarteaucitron.lang.deny;
624            html += '       </button>';
625            html += '   </div>';
626            html += '</li>';
627
628            tarteaucitron.userInterface.css('tarteaucitronServicesTitle_' + service.type, 'display', 'block');
629
630            if (document.getElementById('tarteaucitronServices_' + service.type) !== null) {
631                document.getElementById('tarteaucitronServices_' + service.type).innerHTML += html;
632            }
633
634            tarteaucitron.userInterface.css('tarteaucitronNoServicesTitle', 'display', 'none');
635
636            tarteaucitron.userInterface.order(service.type);
637        }
638
639        tarteaucitron.pro('!' + service.key + '=' + isAllowed);
640
641        // allow by default for non EU
642        if (isResponded === false && tarteaucitron.user.bypass === true) {
643            isAllowed = true;
644            tarteaucitron.cookie.create(service.key, true);
645        }
646
647        if ((!isResponded && (isAutostart || (isNavigating && isWaiting)) && !tarteaucitron.highPrivacy) || isAllowed) {
648            if (!isAllowed) {
649                tarteaucitron.cookie.create(service.key, true);
650            }
651            if (tarteaucitron.launch[service.key] !== true) {
652                tarteaucitron.launch[service.key] = true;
653                service.js();
654                tarteaucitron.sendEvent(service.key + '_loaded');
655            }
656            tarteaucitron.state[service.key] = true;
657            tarteaucitron.userInterface.color(service.key, true);
658        } else if (isDenied) {
659            if (typeof service.fallback === 'function') {
660                service.fallback();
661            }
662            tarteaucitron.state[service.key] = false;
663            tarteaucitron.userInterface.color(service.key, false);
664        } else if (!isResponded && isDNTRequested && tarteaucitron.handleBrowserDNTRequest) {
665            tarteaucitron.cookie.create(service.key, 'false');
666            if (typeof service.fallback === 'function') {
667                service.fallback();
668            }
669            tarteaucitron.state[service.key] = false;
670            tarteaucitron.userInterface.color(service.key, false);
671        } else if (!isResponded) {
672            tarteaucitron.cookie.create(service.key, 'wait');
673            if (typeof service.fallback === 'function') {
674                service.fallback();
675            }
676            tarteaucitron.userInterface.color(service.key, 'wait');
677            tarteaucitron.userInterface.openAlert();
678        }
679
680        tarteaucitron.cookie.checkCount(service.key);
681        tarteaucitron.sendEvent(service.key + '_added')
682    },
683    "sendEvent" : function(event_key) {
684        if(event_key !== undefined) {
685            //ie compatibility
686            var send_event_item;
687            if(typeof(Event) === 'function') {
688                send_event_item = new Event(event_key);
689            }else{
690                send_event_item = document.createEvent('Event');
691                send_event_item.initEvent(event_key, true, true);
692            }
693            //end ie compatibility
694
695            document.dispatchEvent(send_event_item);
696        }
697    },
698    "cleanArray": function cleanArray(arr) {
699        "use strict";
700        var i,
701            len = arr.length,
702            out = [],
703            obj = {},
704            s = tarteaucitron.services;
705
706        for (i = 0; i < len; i += 1) {
707            if (!obj[arr[i]]) {
708                obj[arr[i]] = {};
709                if (tarteaucitron.services[arr[i]] !== undefined) {
710                    out.push(arr[i]);
711                }
712            }
713        }
714
715        out = out.sort(function (a, b) {
716            if (s[a].type + s[a].key > s[b].type + s[b].key) { return 1; }
717            if (s[a].type + s[a].key < s[b].type + s[b].key) { return -1; }
718            return 0;
719        });
720
721        return out;
722    },
723    "userInterface": {
724        "css": function (id, property, value) {
725            "use strict";
726            if (document.getElementById(id) !== null) {
727                document.getElementById(id).style[property] = value;
728            }
729        },
730        "addClass": function (id, className) {
731            "use strict";
732            if (document.getElementById(id) !== null) {
733                document.getElementById(id).classList.add(className);
734            }
735        },
736        "removeClass": function (id, className) {
737            "use strict";
738            if (document.getElementById(id) !== null) {
739                document.getElementById(id).classList.remove(className);
740            }
741        },
742        "respondAll": function (status) {
743            "use strict";
744            var s = tarteaucitron.services,
745                service,
746                key,
747                index = 0;
748
749            for (index = 0; index < tarteaucitron.job.length; index += 1) {
750                service = s[tarteaucitron.job[index]];
751                key = service.key;
752                if (tarteaucitron.state[key] !== status) {
753                    if (status === false && tarteaucitron.launch[key] === true) {
754                        tarteaucitron.reloadThePage = true;
755                    }
756                    if (tarteaucitron.launch[key] !== true && status === true) {
757
758                        tarteaucitron.pro('!' + key + '=engage');
759
760                        tarteaucitron.launch[key] = true;
761                        tarteaucitron.services[key].js();
762                    }
763                    tarteaucitron.state[key] = status;
764                    tarteaucitron.cookie.create(key, status);
765                    tarteaucitron.userInterface.color(key, status);
766                }
767            }
768        },
769        "respond": function (el, status) {
770            "use strict";
771            var key = el.id.replace(new RegExp("(Eng[0-9]+|Allow|Deni)ed", "g"), '');
772
773            // return if same state
774            if (tarteaucitron.state[key] === status) {
775                return;
776            }
777
778            if (status === false && tarteaucitron.launch[key] === true) {
779                tarteaucitron.reloadThePage = true;
780            }
781
782            // if not already launched... launch the service
783            if (status === true) {
784                if (tarteaucitron.launch[key] !== true) {
785
786                    tarteaucitron.pro('!' + key + '=engage');
787
788                    tarteaucitron.launch[key] = true;
789                    tarteaucitron.sendEvent(key + '_loaded');
790                    tarteaucitron.services[key].js();
791                }
792            }
793            tarteaucitron.state[key] = status;
794            tarteaucitron.cookie.create(key, status);
795            tarteaucitron.userInterface.color(key, status);
796        },
797        "color": function (key, status) {
798            "use strict";
799            var c = 'tarteaucitron',
800                nbDenied = 0,
801                nbPending = 0,
802                nbAllowed = 0,
803                sum = tarteaucitron.job.length,
804                index;
805
806            if (status === true) {
807                document.getElementById(key + 'Line').classList.add('tarteaucitronIsAllowed');
808                document.getElementById(key + 'Line').classList.remove('tarteaucitronIsDenied');
809            } else if (status === false) {
810                document.getElementById(key + 'Line').classList.remove('tarteaucitronIsAllowed');
811                document.getElementById(key + 'Line').classList.add('tarteaucitronIsDenied');
812            }
813
814            // check if all services are allowed
815            for (index = 0; index < sum; index += 1) {
816                if (tarteaucitron.state[tarteaucitron.job[index]] === false) {
817                    nbDenied += 1;
818                } else if (tarteaucitron.state[tarteaucitron.job[index]] === undefined) {
819                    nbPending += 1;
820                } else if (tarteaucitron.state[tarteaucitron.job[index]] === true) {
821                    nbAllowed += 1;
822                }
823            }
824
825            tarteaucitron.userInterface.css(c + 'DotGreen', 'width', ((100 / sum) * nbAllowed) + '%');
826            tarteaucitron.userInterface.css(c + 'DotYellow', 'width', ((100 / sum) * nbPending) + '%');
827            tarteaucitron.userInterface.css(c + 'DotRed', 'width', ((100 / sum) * nbDenied) + '%');
828
829            if (nbDenied === 0 && nbPending === 0) {
830                tarteaucitron.userInterface.removeClass(c + 'AllDenied', c + 'IsSelected');
831                tarteaucitron.userInterface.addClass(c + 'AllAllowed', c + 'IsSelected');
832
833                tarteaucitron.userInterface.addClass(c + 'MainLineOffset', c + 'IsAllowed');
834                tarteaucitron.userInterface.removeClass(c + 'MainLineOffset', c + 'IsDenied');
835            } else if (nbAllowed === 0 && nbPending === 0) {
836                tarteaucitron.userInterface.removeClass(c + 'AllAllowed', c + 'IsSelected');
837                tarteaucitron.userInterface.addClass(c + 'AllDenied', c + 'IsSelected');
838
839                tarteaucitron.userInterface.removeClass(c + 'MainLineOffset', c + 'IsAllowed');
840                tarteaucitron.userInterface.addClass(c + 'MainLineOffset', c + 'IsDenied');
841            } else {
842                tarteaucitron.userInterface.removeClass(c + 'AllAllowed', c + 'IsSelected');
843                tarteaucitron.userInterface.removeClass(c + 'AllDenied', c + 'IsSelected');
844
845                tarteaucitron.userInterface.removeClass(c + 'MainLineOffset', c + 'IsAllowed');
846                tarteaucitron.userInterface.removeClass(c + 'MainLineOffset', c + 'IsDenied');
847            }
848
849            // close the alert if all service have been reviewed
850            if (nbPending === 0) {
851                tarteaucitron.userInterface.closeAlert();
852            }
853
854            if (tarteaucitron.services[key].cookies.length > 0 && status === false) {
855                tarteaucitron.cookie.purge(tarteaucitron.services[key].cookies);
856            }
857
858            if (status === true) {
859                if (document.getElementById('tacCL' + key) !== null) {
860                    document.getElementById('tacCL' + key).innerHTML = '...';
861                }
862                setTimeout(function () {
863                    tarteaucitron.cookie.checkCount(key);
864                }, 2500);
865            } else {
866                tarteaucitron.cookie.checkCount(key);
867            }
868        },
869        "openPanel": function () {
870            "use strict";
871
872            tarteaucitron.userInterface.css('tarteaucitron', 'display', 'block');
873            tarteaucitron.userInterface.css('tarteaucitronBack', 'display', 'block');
874            tarteaucitron.userInterface.css('tarteaucitronCookiesListContainer', 'display', 'none');
875
876            document.getElementById('tarteaucitronClosePanel').focus();
877            document.getElementsByTagName('body')[0].classList.add('modal-open');
878            tarteaucitron.userInterface.focusTrap();
879            tarteaucitron.userInterface.jsSizing('main');
880
881            //ie compatibility
882            var tacOpenPanelEvent;
883            if(typeof(Event) === 'function') {
884                tacOpenPanelEvent = new Event("tac.open_panel");
885            }else{
886                tacOpenPanelEvent = document.createEvent('Event');
887                tacOpenPanelEvent.initEvent("tac.open_panel", true, true);
888            }
889            //end ie compatibility
890
891            window.dispatchEvent(tacOpenPanelEvent);
892        },
893        "closePanel": function () {
894            "use strict";
895
896            if (document.location.hash === tarteaucitron.hashtag) {
897                if (window.history) {
898                    window.history.replaceState('', document.title, window.location.pathname + window.location.search);
899                } else {
900                    document.location.hash = '';
901                }
902            }
903            tarteaucitron.userInterface.css('tarteaucitron', 'display', 'none');
904            tarteaucitron.userInterface.css('tarteaucitronCookiesListContainer', 'display', 'none');
905
906            tarteaucitron.fallback(['tarteaucitronInfoBox'], function (elem) {
907                elem.style.display = 'none';
908            }, true);
909
910            if (tarteaucitron.reloadThePage === true) {
911                window.location.reload();
912            } else {
913                tarteaucitron.userInterface.css('tarteaucitronBack', 'display', 'none');
914            }
915            if (document.getElementById('tarteaucitronCloseAlert') !== null) {
916                document.getElementById('tarteaucitronCloseAlert').focus();
917            }
918            document.getElementsByTagName('body')[0].classList.remove('modal-open');
919
920            //ie compatibility
921            var tacClosePanelEvent;
922            if(typeof(Event) === 'function') {
923                tacClosePanelEvent = new Event("tac.close_panel");
924            }else{
925                tacClosePanelEvent = document.createEvent('Event');
926                tacClosePanelEvent.initEvent("tac.close_panel", true, true);
927            }
928            //end ie compatibility
929
930            window.dispatchEvent(tacClosePanelEvent);
931        },
932        "focusTrap": function() {
933            "use strict";
934
935            var focusableEls,
936                firstFocusableEl,
937                lastFocusableEl,
938                filtered;
939
940            focusableEls = document.getElementById('tarteaucitron').querySelectorAll('a[href], button');
941            filtered = [];
942
943            // get only visible items
vendor: 5,610 bytes, lines 944-1078
944            for (var i = 0, max = focusableEls.length; i < max; i++) {
945                if (focusableEls[i].offsetHeight > 0) {
946                   filtered.push(focusableEls[i]);
947                }
948            }
949
950            firstFocusableEl = filtered[0];
951            lastFocusableEl = filtered[filtered.length - 1];
952
953            //loop focus inside tarteaucitron
954            document.getElementById('tarteaucitron').addEventListener("keydown", function (evt) {
955
956                if ( evt.key === 'Tab' || evt.keyCode === 9 ) {
957
958                    if ( evt.shiftKey ) /* shift + tab */ {
959                        if (document.activeElement === firstFocusableEl) {
960                            lastFocusableEl.focus();
961                            evt.preventDefault();
962                        }
963                    } else /* tab */ {
964                        if (document.activeElement === lastFocusableEl) {
965                            firstFocusableEl.focus();
966                            evt.preventDefault();
967                        }
968                    }
969                }
970            })
971        },
972        "openAlert": function () {
973            "use strict";
974            var c = 'tarteaucitron';
975            tarteaucitron.userInterface.css(c + 'Percentage', 'display', 'block');
976            tarteaucitron.userInterface.css(c + 'AlertSmall', 'display', 'none');
977            tarteaucitron.userInterface.css(c + 'AlertBig',   'display', 'block');
978            tarteaucitron.userInterface.addClass(c + 'Root',   'tarteaucitronBeforeVisible');
979
980            //ie compatibility
981            var tacOpenAlertEvent;
982            if(typeof(Event) === 'function') {
983                tacOpenAlertEvent = new Event("tac.open_alert");
984            }else{
985                tacOpenAlertEvent = document.createEvent('Event');
986                tacOpenAlertEvent.initEvent("tac.open_alert", true, true);
987            }
988            //end ie compatibility
989
990            window.dispatchEvent(tacOpenAlertEvent);
991        },
992        "closeAlert": function () {
993            "use strict";
994            var c = 'tarteaucitron';
995            tarteaucitron.userInterface.css(c + 'Percentage', 'display', 'none');
996            tarteaucitron.userInterface.css(c + 'AlertSmall', 'display', 'block');
997            tarteaucitron.userInterface.css(c + 'AlertBig',   'display', 'none');
998            tarteaucitron.userInterface.removeClass(c + 'Root',   'tarteaucitronBeforeVisible');
999            tarteaucitron.userInterface.jsSizing('box');
1000
1001            //ie compatibility
1002            var tacCloseAlertEvent;
1003            if(typeof(Event) === 'function') {
1004                tacCloseAlertEvent = new Event("tac.close_alert");
1005            }else{
1006                tacCloseAlertEvent = document.createEvent('Event');
1007                tacCloseAlertEvent.initEvent("tac.close_alert", true, true);
1008            }
1009            //end ie compatibility
1010
1011            window.dispatchEvent(tacCloseAlertEvent);
1012        },
1013        "toggleCookiesList": function () {
1014            "use strict";
1015            var div = document.getElementById('tarteaucitronCookiesListContainer');
1016
1017            if (div === null) {
1018                return;
1019            }
1020
1021            if (div.style.display !== 'block') {
1022                tarteaucitron.cookie.number();
1023                div.style.display = 'block';
1024                tarteaucitron.userInterface.jsSizing('cookie');
1025                tarteaucitron.userInterface.css('tarteaucitron', 'display', 'none');
1026                tarteaucitron.userInterface.css('tarteaucitronBack', 'display', 'block');
1027                tarteaucitron.fallback(['tarteaucitronInfoBox'], function (elem) {
1028                    elem.style.display = 'none';
1029                }, true);
1030            } else {
1031                div.style.display = 'none';
1032                tarteaucitron.userInterface.css('tarteaucitron', 'display', 'none');
1033                tarteaucitron.userInterface.css('tarteaucitronBack', 'display', 'none');
1034            }
1035        },
1036        "toggle": function (id, closeClass) {
1037            "use strict";
1038            var div = document.getElementById(id);
1039
1040            if (div === null) {
1041                return;
1042            }
1043
1044            if (closeClass !== undefined) {
1045                tarteaucitron.fallback([closeClass], function (elem) {
1046                    if (elem.id !== id) {
1047                        elem.style.display = 'none';
1048                    }
1049                }, true);
1050            }
1051
1052            if (div.style.display !== 'block') {
1053                div.style.display = 'block';
1054            } else {
1055                div.style.display = 'none';
1056            }
1057        },
1058        "order": function (id) {
1059            "use strict";
1060            var main = document.getElementById('tarteaucitronServices_' + id),
1061                allDivs,
1062                store = [],
1063                i;
1064
1065            if (main === null) {
1066                return;
1067            }
1068
1069            allDivs = main.childNodes;
1070
1071            if (typeof Array.prototype.map === 'function' && typeof Enumerable === 'undefined') {
1072                Array.prototype.map.call(main.children, Object).sort(function (a, b) {
1073                //var mainChildren = Array.from(main.children);
1074                //mainChildren.sort(function (a, b) {
1075                    if (tarteaucitron.services[a.id.replace(/Line/g, '')].name > tarteaucitron.services[b.id.replace(/Line/g, '')].name) { return 1; }
1076                    if (tarteaucitron.services[a.id.replace(/Line/g, '')].name < tarteaucitron.services[b.id.replace(/Line/g, '')].name) { return -1; }
1077                    return 0;
1078                }
1078).forEach(function (element) {
1079                    main.appendChild(element);
1080                });
1081            }
1082        },
1083        "jsSizing": function (type) {
1084            "use strict";
1085            var scrollbarMarginRight = 10,
1086                scrollbarWidthParent,
1087                scrollbarWidthChild,
1088                servicesHeight,
1089                e = window,
1090                a = 'inner',
1091                windowInnerHeight = window.innerHeight || document.documentElement.clientHeight || document.body.clientHeight,
1092                mainTop,
1093                mainHeight,
1094                closeButtonHeight,
1095                headerHeight,
1096                cookiesListHeight,
1097                cookiesCloseHeight,
1098                cookiesTitleHeight,
1099                paddingBox,
1100                alertSmallHeight,
1101                cookiesNumberHeight;
1102
1103            if (type === 'box') {
1104                if (document.getElementById('tarteaucitronAlertSmall') !== null && document.getElementById('tarteaucitronCookiesNumber') !== null) {
1105
1106                    // reset
1107                    tarteaucitron.userInterface.css('tarteaucitronCookiesNumber', 'padding', '0px 10px');
1108
1109                    // calculate
1110                    alertSmallHeight = document.getElementById('tarteaucitronAlertSmall').offsetHeight;
1111                    cookiesNumberHeight = document.getElementById('tarteaucitronCookiesNumber').offsetHeight;
1112                    paddingBox = (alertSmallHeight - cookiesNumberHeight) / 2;
1113
1114                    // apply
1115                    tarteaucitron.userInterface.css('tarteaucitronCookiesNumber', 'padding', paddingBox + 'px 10px');
1116                }
1117            } else if (type === 'main') {
1118
1119                // get the real window width for media query
1120                if (window.innerWidth === undefined) {
1121                    a = 'client';
1122                    e = document.documentElement || document.body;
1123                }
1124
1125                // height of the services list container
1126                if (document.getElementById('tarteaucitron') !== null && document.getElementById('tarteaucitronClosePanel') !== null && document.getElementById('tarteaucitronMainLineOffset') !== null) {
1127
1128                    // reset
1129                    tarteaucitron.userInterface.css('tarteaucitronServices', 'height', 'auto');
1130
1131                    // calculate
1132                    mainHeight = document.getElementById('tarteaucitron').offsetHeight;
1133                    closeButtonHeight = document.getElementById('tarteaucitronClosePanel').offsetHeight;
1134
1135                    // apply
1136                    servicesHeight = (mainHeight - closeButtonHeight + 2);
1137                    tarteaucitron.userInterface.css('tarteaucitronServices', 'height', servicesHeight + 'px');
1138                    tarteaucitron.userInterface.css('tarteaucitronServices', 'overflow-x', 'auto');
1139                }
1140
1141                // align the main allow/deny button depending on scrollbar width
1142                if (document.getElementById('tarteaucitronServices') !== null && document.getElementById('tarteaucitronScrollbarChild') !== null) {
1143
1144                    // media query
1145                    if (e[a + 'Width'] <= 479) {
1146                        tarteaucitron.userInterface.css('tarteaucitronScrollbarAdjust', 'marginLeft', '11px');
1147                    } else if (e[a + 'Width'] <= 767) {
1148                        scrollbarMarginRight = 12;
1149                    }
1150
1151                    scrollbarWidthParent = document.getElementById('tarteaucitronServices').offsetWidth;
1152                    scrollbarWidthChild = document.getElementById('tarteaucitronScrollbarChild').offsetWidth;
1153                    tarteaucitron.userInterface.css('tarteaucitronScrollbarAdjust', 'marginRight', ((scrollbarWidthParent - scrollbarWidthChild) + scrollbarMarginRight) + 'px');
1154                }
1155
1156                // center the main panel
1157                if (document.getElementById('tarteaucitron') !== null) {
1158
1159                    // media query
1160                    if (e[a + 'Width'] <= 767) {
1161                        mainTop = 0;
1162                    } else {
1163                        mainTop = ((windowInnerHeight - document.getElementById('tarteaucitron').offsetHeight) / 2) - 21;
1164                    }
1165
1166                    if (document.getElementById('tarteaucitronMainLineOffset') !== null) {
1167                        if (document.getElementById('tarteaucitron').offsetHeight < (windowInnerHeight / 2)) {
1168                            mainTop -= document.getElementById('tarteaucitronMainLineOffset').offsetHeight;
1169                        }
1170                    }
1171
1172                    // correct
1173                    if (mainTop < 0) {
1174                        mainTop = 0;
1175                    }
1176
1177                    // apply
1178                    tarteaucitron.userInterface.css('tarteaucitron', 'top', mainTop + 'px');
1179                }
1180
1181
1182            } else if (type === 'cookie') {
1183
1184                // put cookies list at bottom
1185                if (document.getElementById('tarteaucitronAlertSmall') !== null) {
1186                    tarteaucitron.userInterface.css('tarteaucitronCookiesListContainer', 'bottom', (document.getElementById('tarteaucitronAlertSmall').offsetHeight) + 'px');
1187                }
1188
1189                // height of cookies list
1190                if (document.getElementById('tarteaucitronCookiesListContainer') !== null) {
1191
1192                    // reset
1193                    tarteaucitron.userInterface.css('tarteaucitronCookiesList', 'height', 'auto');
1194
1195                    // calculate
1196                    cookiesListHeight = document.getElementById('tarteaucitronCookiesListContainer').offsetHeight;
1197                    cookiesCloseHeight = document.getElementById('tarteaucitronClosePanelCookie').offsetHeight;
1198                    cookiesTitleHeight = document.getElementById('tarteaucitronCookiesTitle').offsetHeight;
1199
1200                    // apply
1201                    tarteaucitron.userInterface.css('tarteaucitronCookiesList', 'height', (cookie
1201sListHeight - cookiesCloseHeight - cookiesTitleHeight - 2) + 'px');
1202                }
1203            }
1204        }
1205    },
1206    "cookie": {
1207        "owner": {},
1208        "create": function (key, status) {
1209            "use strict";
1210
1211            if (tarteaucitronForceExpire !== '') {
1212                // The number of day(s)/hour(s) can't be higher than 1 year
1213                if ((tarteaucitronExpireInDay && tarteaucitronForceExpire < 365) || (!tarteaucitronExpireInDay && tarteaucitronForceExpire < 8760)) {
1214                    if (tarteaucitronExpireInDay) {
1215                        // Multiplication to tranform the number of days to milliseconds
1216                        timeExpire = tarteaucitronForceExpire * 86400000;
1217                    } else {
1218                        // Multiplication to tranform the number of hours to milliseconds
1219                        timeExpire = tarteaucitronForceExpire * 3600000;
1220                    }
1221                }
1222            }
1223
1224            var d = new Date(),
1225                time = d.getTime(),
1226                expireTime = time + timeExpire, // 365 days
1227                regex = new RegExp("!" + key + "=(wait|true|false)", "g"),
1228                cookie = tarteaucitron.cookie.read().replace(regex, ""),
1229                value = tarteaucitron.parameters.cookieName + '=' + cookie + '!' + key + '=' + status,
1230                domain = (tarteaucitron.parameters.cookieDomain !== undefined && tarteaucitron.parameters.cookieDomain !== '') ? 'domain=' + tarteaucitron.parameters.cookieDomain + ';' : '';
1231
1232            d.setTime(expireTime);
1233            document.cookie = value + '; expires=' + d.toGMTString() + '; path=/;' + domain;
1234        },
1235        "read": function () {
1236            "use strict";
1237            var nameEQ = tarteaucitron.parameters.cookieName + "=",
1238                ca = document.cookie.split(';'),
1239                i,
1240                c;
1241
1242            for (i = 0; i < ca.length; i += 1) {
1243                c = ca[i];
1244                while (c.charAt(0) === ' ') {
1245                    c = c.substring(1, c.length);
1246                }
1247                if (c.indexOf(nameEQ) === 0) {
1248                    return c.substring(nameEQ.length, c.length);
1249                }
1250            }
1251            return '';
1252        },
1253        "purge": function (arr) {
1254            "use strict";
1255            var i;
1256
1257            for (i = 0; i < arr.length; i += 1) {
1258                document.cookie = arr[i] + '=; expires=Thu, 01 Jan 2000 00:00:00 GMT; path=/;';
1259                document.cookie = arr[i] + '=; expires=Thu, 01 Jan 2000 00:00:00 GMT; path=/; domain=.' + location.hostname + ';';
1260                document.cookie = arr[i] + '=; expires=Thu, 01 Jan 2000 00:00:00 GMT; path=/; domain=.' + location.hostname.split('.').slice(-2).join('.') + ';';
1261            }
1262        },
1263        "checkCount": function (key) {
1264            "use strict";
1265            var arr = tarteaucitron.services[key].cookies,
1266                nb = arr.length,
1267                nbCurrent = 0,
1268                html = '',
1269                i,
1270                status = document.cookie.indexOf(key + '=true');
1271
1272            if (status >= 0 && nb === 0) {
1273                html += tarteaucitron.lang.useNoCookie;
1274            } else if (status >= 0) {
1275                for (i = 0; i < nb; i += 1) {
1276                    if (document.cookie.indexOf(arr[i] + '=') !== -1) {
1277                        nbCurrent += 1;
1278                        if (tarteaucitron.cookie.owner[arr[i]] === undefined) {
1279                            tarteaucitron.cookie.owner[arr[i]] = [];
1280                        }
1281                        if (tarteaucitron.cookie.crossIndexOf(tarteaucitron.cookie.owner[arr[i]], tarteaucitron.services[key].name) === false) {
1282                            tarteaucitron.cookie.owner[arr[i]].push(tarteaucitron.services[key].name);
1283                        }
1284                    }
1285                }
1286
1287                if (nbCurrent > 0) {
1288                    html += tarteaucitron.lang.useCookieCurrent + ' ' + nbCurrent + ' cookie';
1289                    if (nbCurrent > 1) {
1290                        html += 's';
1291                    }
1292                    html += '.';
1293                } else {
1294                    html += tarteaucitron.lang.useNoCookie;
1295                }
1296            } else if (nb === 0) {
1297                html = tarteaucitron.lang.noCookie;
1298            } else {
1299                html += tarteaucitron.lang.useCookie + ' ' + nb + ' cookie';
1300                if (nb > 1) {
1301                    html += 's';
1302                }
1303                html += '.';
1304            }
1305
1306            if (document.getElementById('tacCL' + key) !== null) {
1307                document.getElementById('tacCL' + key).innerHTML = html;
1308            }
1309        },
1310        "crossIndexOf": function (arr, match) {
1311            "use strict";
1312            var i;
1313            for (i = 0; i < arr.length; i += 1) {
1314                if (arr[i] === match) {
1315                    return true;
1316                }
1317            }
1318            return false;
vendor: 6,562 bytes, lines 1319-1456
1319        },
1320        "number": function () {
1321            "use strict";
1322            var cookies = document.cookie.split(';'),
1323                nb = (document.cookie !== '') ? cookies.length : 0,
1324                html = '',
1325                i,
1326                name,
1327                namea,
1328                nameb,
1329                c,
1330                d,
1331                s = (nb > 1) ? 's' : '',
1332                savedname,
1333                regex = /^https?\:\/\/([^\/?#]+)(?:[\/?#]|$)/i,
1334                regexedDomain = (tarteaucitron.cdn.match(regex) !== null) ? tarteaucitron.cdn.match(regex)[1] : tarteaucitron.cdn,
1335                host = (tarteaucitron.domain !== undefined) ? tarteaucitron.domain : regexedDomain;
1336
1337            cookies = cookies.sort(function (a, b) {
1338                namea = a.split('=', 1).toString().replace(/ /g, '');
1339                nameb = b.split('=', 1).toString().replace(/ /g, '');
1340                c = (tarteaucitron.cookie.owner[namea] !== undefined) ? tarteaucitron.cookie.owner[namea] : '0';
1341                d = (tarteaucitron.cookie.owner[nameb] !== undefined) ? tarteaucitron.cookie.owner[nameb] : '0';
1342                if (c + a > d + b) { return 1; }
1343                if (c + a < d + b) { return -1; }
1344                return 0;
1345            });
1346
1347            if (document.cookie !== '') {
1348                for (i = 0; i < nb; i += 1) {
1349                    name = cookies[i].split('=', 1).toString().replace(/ /g, '');
1350                    if (tarteaucitron.cookie.owner[name] !== undefined && tarteaucitron.cookie.owner[name].join(' // ') !== savedname) {
1351                        savedname = tarteaucitron.cookie.owner[name].join(' // ');
1352                        html += '<div class="tarteaucitronHidden">';
1353                        html += '     <span class="tarteaucitronTitle tarteaucitronH3" role="heading" aria-level="3">';
1354                        html += '        ' + tarteaucitron.cookie.owner[name].join(' // ');
1355                        html += '    </span>';
1356                        html += '</div><ul class="cookie-list">';
1357                    } else if (tarteaucitron.cookie.owner[name] === undefined && host !== savedname) {
1358                        savedname = host;
1359                        html += '<div class="tarteaucitronHidden">';
1360                        html += '     <span class="tarteaucitronTitle tarteaucitronH3" role="heading" aria-level="3">';
1361                        html += '        ' + host;
1362                        html += '    </span>';
1363                        html += '</div><ul class="cookie-list">';
1364                    }
1365                    html += '<li class="tarteaucitronCookiesListMain">';
1366                    html += '    <div class="tarteaucitronCookiesListLeft"><button type="button" onclick="tarteaucitron.cookie.purge([\'' + tarteaucitron.fixSelfXSS(cookies[i].split('=', 1)) + '\']);tarteaucitron.cookie.number();tarteaucitron.userInterface.jsSizing(\'cookie\');return false"><strong>&times;</strong></button> <strong>' + tarteaucitron.fixSelfXSS(name) + '</strong>';
1367                    html += '    </div>';
1368                    html += '    <div class="tarteaucitronCookiesListRight">' + tarteaucitron.fixSelfXSS(cookies[i].split('=').slice(1).join('=')) + '</div>';
1369                    html += '</li>';
1370                }
1371                html += '</ul>';
1372            } else {
1373                html += '<div class="tarteaucitronCookiesListMain">';
1374                html += '    <div class="tarteaucitronCookiesListLeft"><strong>-</strong></div>';
1375                html += '    <div class="tarteaucitronCookiesListRight"></div>';
1376                html += '</div>';
1377            }
1378
1379            html += '<div class="tarteaucitronHidden" style="height:20px;display:block"></div>';
1380
1381            if (document.getElementById('tarteaucitronCookiesList') !== null) {
1382                document.getElementById('tarteaucitronCookiesList').innerHTML = html;
1383            }
1384
1385            if (document.getElementById('tarteaucitronCookiesNumber') !== null) {
1386                document.getElementById('tarteaucitronCookiesNumber').innerHTML = nb;
1387            }
1388
1389            if (document.getElementById('tarteaucitronCookiesNumberBis') !== null) {
1390                document.getElementById('tarteaucitronCookiesNumberBis').innerHTML = nb + ' cookie' + s;
1391            }
1392
1393            for (i = 0; i < tarteaucitron.job.length; i += 1) {
1394                tarteaucitron.cookie.checkCount(tarteaucitron.job[i]);
1395            }
1396        }
1397    },
1398    "fixSelfXSS": function(html) {
1399        fixed = html.toString().replace(/&/g, "&amp;").replace(/</g, "&lt;").replace(/>/g, "&gt;").replace(/"/g, "&quot;").replace(/'/g, "&#039;");
1400        return fixed;
1401    },
1402    "getLanguage": function () {
1403        "use strict";
1404
1405        var availableLanguages = 'bg,cn,cs,da,de,el,en,es,fi,fr,hu,it,ja,nl,oc,pl,pt,ro,ru,se,sk,tr,vi',
1406            defaultLanguage = 'en';
1407
1408        if (tarteaucitronForceLanguage !== '') {
1409            if (availableLanguages.indexOf(tarteaucitronForceLanguage) !== -1) {
1410                return tarteaucitronForceLanguage;
1411            }
1412        }
1413
1414        if (!navigator) { return 'en'; }
1415
1416        var lang = navigator.language || navigator.browserLanguage ||
1417                navigator.systemLanguage || navigator.userLang || null,
1418            userLanguage = lang ? lang.substr(0, 2) : null;
1419
1420        if (availableLanguages.indexOf(userLanguage) === -1) {
1421            return defaultLanguage;
1422        }
1423        return userLanguage;
1424    },
1425    "getLocale": function () {
1426        "use strict";
1427        if (!navigator) { return 'en_US'; }
1428
1429        var lang = navigator.language || navigator.browserLanguage ||
1430                navigator.systemLanguage || navigator.userLang || null,
1431            userLanguage = lang ? lang.substr(0, 2) : null;
1432
1433        if (userLanguage === 'fr') {
1434            return 'fr_FR';
1435        } else if (userLanguage === 'en') {
1436            return 'en_US';
1437        } else if (userLanguage === 'de') {
1438            return 'de_DE';
1439        } else if (userLanguage === 'es') {
1440            return 'es_ES';
1441        } else if (userLanguage === 'it') {
1442            return 'it_IT';
1443        } else if (userLanguage === 'pt') {
1444            return 'pt_PT';
1445        } else if (userLanguage === 'nl') {
1446            return 'nl_NL';
1447        } else if (userLanguage === 'el') {
1448            return 'el_EL';
1449        } else {
1450            return 'en_US';
1451        }
1452    },
1453    "addScript": function (url, id, callback, execute, attrName, attrVal, internal) {
1454        "use strict";
1455        var script,
1456            done = false;
1457
1458        if (execute === false) {
1459            if (typeof callback === 'function') {
1460                callback();
1461            }
1462        } else {
1463            script = document.createElement('script');
1464            script.type = 'text/javascript';
1465            script.id = (id !== undefined) ? id : '';
1466            script.async = true;
1467            script.src = url;
1468
1469            if (attrName !== undefined && attrVal !== undefined) {
1470                script.setAttribute(attrName, attrVal);
1471            }
1472
1473            if (typeof callback === 'function') {
1474                if ( !tarteaucitron.parameters.useExternalJs ) {
1475                    script.onreadystatechange = script.onload = function () {
1476                        var state = script.readyState;
1477                        if (!done && (!state || /loaded|complete/.test(state))) {
1478                            done = true;
1479                            callback();
1480                        }
1481                    };
1482                } else {
1483                    callback();
1484                }
1485            }
1486
1487            if ( !tarteaucitron.parameters.useExternalJs || !internal ) {
1488                document.getElementsByTagName('head')[0].appendChild(script);
1489            }
1490        }
1491    },
1492    "addInternalScript": function (url, id, callback, execute, attrName, attrVal) {
1493        tarteaucitron.addScript(url, id, callback, execute, attrName, attrVal, true);
1494    },
1495    "makeAsync": {
1496        "antiGhost": 0,
1497        "buffer": '',
1498        "init": function (url, id) {
1499            "use strict";
1500            var savedWrite = document.write,
1501                savedWriteln = document.writeln;
1502
1503            document.write = function (content) {
1504                tarteaucitron.makeAsync.buffer += content;
1505            };
1506            document.writeln = function (content) {
1507                tarteaucitron.makeAsync.buffer += content.concat("\n");
1508            };
1509
1510            setTimeout(function () {
1511                document.write = savedWrite;
1512                document.writeln = savedWriteln;
1513            }, 20000);
1514
1515            tarteaucitron.makeAsync.getAndParse(url, id);
1516        },
1517        "getAndParse": function (url, id) {
1518            "use strict";
1519            if (tarteaucitron.makeAsync.antiGhost > 9) {
1520                tarteaucitron.makeAsync.antiGhost = 0;
1521                return;
1522            }
1523            tarteaucitron.makeAsync.antiGhost += 1;
1524            tarteaucitron.addInternalScript(url, '', function () {
1525                if (document.getElementById(id) !== null) {
1526                    document.getElementById(id).innerHTML += "<span style='display:none'>&nbsp;</span>" + tarteaucitron.makeAsync.buffer;
1527                    tarteaucitron.makeAsync.buffer = '';
1528                    tarteaucitron.makeAsync.execJS(id);
1529                }
1530            });
1531        },
1532        "execJS": function (id) {
1533            /* not strict because third party scripts may have errors */
1534            var i,
1535                scripts,
1536                childId,
1537                type;
1538
1539            if (document.getElementById(id) === null) {
1540                return;
1541            }
1542
1543            scripts = document.getElementById(id).getElementsByTagName('script');
1544            for (i = 0; i < scripts.length; i += 1) {
1545                type = (scripts[i].getAttribute('type') !== null) ? scripts[i].getAttribute('type') : '';
1546                if (type === '') {
1547                    type = (scripts[i].getAttribute('language') !== null) ? scripts[i].getAttribute('language') : '';
1548                }
1549                if (scripts[i].getAttribute('src') !== null && scripts[i].getAttribute('src') !== '') {
1550                    childId = id + Math.floor(Math.random() * 99999999999);
1551                    document.getElementById(id).innerHTML += '<div id="' + childId + '"></div>';
1552                    tarteaucitron.makeAsync.getAndParse(scripts[i].getAttribute('src'), childId);
1553                } else if (type.indexOf('javascript') !== -1 || type === '') {
1554                    eval(scripts[i].innerHTML);
1555                }
1556            }
1557        }
1558    },
1559    "fallback": function (matchClass, content, noInner) {
1560        "use strict";
1561        var elems = document.getElementsByTagName('*'),
1562            i,
1563            index = 0;
1564
1565        for (i in elems) {
1566            if (elems[i] !== undefined) {
1567                for (index = 0; index < matchClass.length; index += 1) {
1568                    if ((' ' + elems[i].className + ' ')
1569                            .indexOf(' ' + matchClass[index] + ' ') > -1) {
1570                        if (typeof content === 'function') {
1571                            if (noInner === true) {
1572                                content(elems[i]);
1573                            } else {
1574                                elems[i].innerHTML = content(elems[i]);
1575                            }
1576                        } else {
1577                            elems[i].innerHTML = content;
1578                        }
1579                    }
1580                }
1581            }
1582        }
1583    },
1584    "engage": function (id) {
1585        "use strict";
1586        var html = '',
1587            r = Math.floor(Math.random() * 100000),
1588            engage = tarteaucitron.services[id].name + ' ' + tarteaucitron.lang.fallback;
1589
1590        if (tarteaucitron.lang['engage-' + id] !== undefined) {
1591            engage = tarteaucitron.lang['engage-' + id];
1592        }
1593
1594        html += '<div class="tac_activate">';
1595        html += '   <div class="tac_float">';
1596        html += '      ' + engage;
1597        html += '      <button type="button" class="tarteaucitronAllow" id="Eng' + r + 'ed' + id + '" onclick="tarteaucitron.userInterface.respond(this, true);">';
1598        html += '          &#10003; ' + tarteaucitron.lang.allow;
1599        html += '       </button>';
1600        html += '   </div>';
1601        html += '</div>';
1602
1603        return html;
1604    },
1605    "extend": function (a, b) {
1606        "use strict";
1607        var prop;
1608        for (prop in b) {
1609            if (b.hasOwnProperty(prop)) {
1610                a[prop] = b[prop];
1611            }
1612        }
1613    },
1614    "proTemp": '',
1615    "proTimer": function () {
1616        "use strict";
1617        setTimeout(tarteaucitron.proPing, 500);
1618    },
1619    "pro": function (list) {
1620        "use strict";
1621        tarteaucitron.proTemp += list;
1622        clearTimeout(tarteaucitron.proTimer);
1623        tarteaucitron.proTimer = setTimeout(tarteaucitron.proPing, 500);
1624    },
1625    "proPing": function () {
1626        "use strict";
1627        if (tarteaucitron.uuid !== '' && tarteaucitron.uuid !== undefined && tarteaucitron.proTemp !== '') {
1628            var div = document.getElementById('tarteaucitronPremium'),
1629                timestamp = new Date().getTime(),
1630                url = 'https://tarteaucitron.io/log/?';
1631
1632            if (div === null) {
1633                return;
1634            }
1635
1636            url += 'account=' + tarteaucitron.uuid + '&';
1637            url += 'domain=' + tarteaucitron.domain + '&';
1638            url += 'status=' + encodeURIComponent(tarteaucitron.proTemp) + '&';
1639            url += '_time=' + timestamp;
1640
1641            div.innerHTML = '<img src="' + url + '" style="display:none" />';
1642
1643            tarteaucitron.proTemp = '';
1644        }
1645
1646        tarteaucitron.cookie.number();
1647    },
1648    "AddOrUpdate" : function(source, custom){
1649        /**
1650         Utility function to Add or update the fields of obj1 with the ones in obj2
1651         */
1652        for(key in custom){
1653            if(custom[key] instanceof Object){
1654                source[key] = tarteaucitron.AddOrUpdate(source[key], custom[key]);
1655            }else{
1656                source[key] = custom[key];
1657            }
1658        }
1659        return source;
1660    },
1661    "getElemWidth": function(elem) {
1662        return elem.getAttribute('width') || elem.clientWidth;
1663    },
1664    "getElemHeight": function(elem) {
1665        return elem.getAttribute('height') || elem.clientHeight;
1666    }
1667};

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.