PageSourceSearch

https://www.pechmerle.com/grotte-ornee-lot-midi-pyrenees/plugins/m…/tarteaucitron.js-master/tarteaucitron.js

js pechmerle.com collected 2026-10-02 05:59:31 UTC 62,189 bytes, 1,288 lines download raw bytes

1/*jslint browser: true, evil: true */
2
3// define correct path for files inclusion
4var scripts = document.getElementsByTagName('script'),
5    path = scripts[scripts.length - 1].src.split('?')[0],
6    cdn = path.split('/').slice(0, -1).join('/') + '/',
7    alreadyLaunch = (alreadyLaunch === undefined) ? 0 : alreadyLaunch,
8    tarteaucitronForceLanguage = (tarteaucitronForceLanguage === undefined) ? '' : tarteaucitronForceLanguage,
9    tarteaucitronProLoadServices,
10    tarteaucitronNoAdBlocker = false;
11console.warn('start tarteaucitronForceLanguage',tarteaucitronForceLanguage);
12var tarteaucitron = {
13    "version": 323,
14    "cdn": cdn,
15    "user": {},
16    "lang": {},
17    "services": {},
18    "added": [],
19    "idprocessed": [],
20    "state": [],
21    "launch": [],
22    "parameters": {},
23    "isAjax": false,
24    "reloadThePage": false,
25    "init": function (params) {
26        "use strict";
27        var origOpen;
28        
29        tarteaucitron.parameters = params;
30        if (alreadyLaunch === 0) {
31            alreadyLaunch = 1;
32            if (window.addEventListener) {
33                window.addEventListener("load", function () {
34                    tarteaucitron.load();
35                    tarteaucitron.fallback(['tarteaucitronOpenPanel'], function (elem) {
36                        elem.addEventListener("click", function (event) {
37                            tarteaucitron.userInterface.openPanel
37();
38                            event.preventDefault();
39                        }, false);
40                    }, true);
41                }, false);
42                window.addEventListener("scroll", function () {
43                    var scrollPos = window.pageYOffset || document.documentElement.scrollTop,
44                        documentHeight = document.documentElement.clientHeight,
45                        heightPosition;
46                    if (document.getElementById('tarteaucitronAlertBig') !== null && !tarteaucitron.highPrivacy) {
47                        if (document.getElementById('tarteaucitronAlertBig').style.display === 'block') {
48                            heightPosition = document.getElementById('tarteaucitronAlertBig').offsetHeight + 'px';
49                            
50                            if (scrollPos >= documentHeight) {//(screen.height * 2)
51                                tarteaucitron.userInterface.respondAll(true);
52                            } else /*if (scrollPos > (screen.height / 2))*/ {
53                                document.getElementById('tarteaucitronDisclaimerAlert').innerHTML = '<b>' + tarteaucitron.lang.alertBigScroll + '</b> ' + tarteaucitron.lang.alertBig;
54                            }
55                            
56                            if (tarteaucitron.orientation === 'top') {
57                                document.getElementById('tarteaucitronPercentage').style.top = heightPosition;
58                            } else {
59                                document.getElementById('tarteaucitronPercentage').style.bottom = heightPosition;
60                            }
61                            /*document.getElementById('tarteaucitronPercentage').style.width = ((100 / (screen.height * 2)) * scrollPos) + '%';*/
62                            document.getElementById('tarteaucitronPercentage').style.width = ((100 / documentHeight) * scrollPos) + '%';
63                        }
64                    }
65                }, false);
66                window.addEventListener("keydown", function (evt) {
67                    if (evt.keyCode === 27) {
68                        tarteaucitron.userInterface.closePanel();
69                    }
70                }, false);
71                window.addEventListener("hashchange", function () {
72                    if (document.location.hash === tarteaucitron.hashtag && tarteaucitron.hashtag !== '') {
73                        tarteaucitron.userInterface.openPanel();
74                    }
75                }, false);
76                window.addEventListener("resize", function () {
77                    if (document.getElementById('tarteaucitron') !== null) {
78                        if (document.getElementById('tarteaucitron').style.display === 'block') {
79                            tarteaucitron.userInterface.jsSizing('main');
80                        }
81                    }
82                    
83                    if (document.getElementById('tarteaucitronCookiesListContainer') !== null) {
84                        if (document.getElementById('tarteaucitronCookiesListContainer').style.display === 'block') {
85                            tarteaucitron.userInterface.jsSizing('cookie');
86                        }
87                    }
88                }, false);
89            } else {
90                window.attachEvent("onload", function () {
91                    tarteaucitron.load();
92                    tarteaucitron.fallback(['tarteaucitronOpenPanel'], function (elem) {
93                        elem.attachEvent("onclick", function (event) {
94                            tarteaucitron.userInterface.openPanel
94();
95                            event.preventDefault();
96                        });
97                    }, true);
98                });
99                window.attachEvent("onscroll", function () {
100                    var scrollPos = window.pageYOffset || document.documentElement.scrollTop,
101                        documentHeight = document.documentElement.clientHeight,
102                        heightPosition;
103                    if (document.getElementById('tarteaucitronAlertBig') !== null && !tarteaucitron.highPrivacy) {
104                        if (document.getElementById('tarteaucitronAlertBig').style.display === 'block') {
105                            heightPosition = document.getElementById('tarteaucitronAlertBig').offsetHeight + 'px';
106                            
107                            if (scrollPos > documentHeight) {/*(screen.height * 2)*/
108                                tarteaucitron.userInterface.respondAll(true);
109                            } else /*if (scrollPos > (screen.height / 2))*/ {
110                                document.getElementById('tarteaucitronDisclaimerAlert').innerHTML = '<b>' + tarteaucitron.lang.alertBigScroll + '</b> ' + tarteaucitron.lang.alertBig;
111                            }
112                            if (tarteaucitron.orientation === 'top') {
113                                document.getElementById('tarteaucitronPercentage').style.top = heightPosition;
114                            } else {
115                                document.getElementById('tarteaucitronPercentage').style.bottom = heightPosition;
116                            }
117                            document.getElementById('tarteaucitronPercentage').style.width = ((100 / documentHeight) * scrollPos) + '%';
118                        }
119                    }
120                });
121                window.attachEvent("onkeydown", function (evt) {
122                    if (evt.keyCode === 27) {
123                        tarteaucitron.userInterface.closePanel();
124                    }
125                });
126                window.attachEvent("onhashchange", function () {
127                    if (document.location.hash === tarteaucitron.hashtag && tarteaucitron.hashtag !== '') {
128                        tarteaucitron.userInterface.openPanel();
129                    }
130                });
131                window.attachEvent("onresize", function () {
132                    if (document.getElementById('tarteaucitron') !== null) {
133                        if (document.getElementById('tarteaucitron').style.display === 'block') {
134                            tarteaucitron.userInterface.jsSizing('main');
135                        }
136                    }
137                    
138                    if (document.getElementById('tarteaucitronCookiesListContainer') !== null) {
139                        if (document.getElementById('tarteaucitronCookiesListContainer').style.display === 'block') {
140                            tarteaucitron.userInterface.jsSizing('cookie');
141                        }
142                    }
143                });
144            }
145            
146            if (typeof XMLHttpRequest !== 'undefined') {
147                origOpen = XMLHttpRequest.prototype.open;
148                XMLHttpRequest.prototype.open = function () {
149                    
150                    if (window.addEventListener) {
151                        this.addEventListener("load", function () {
152                            if (typeof tarteaucitronProLoadServices === 'function') {
153                                tarteaucitronProLoadServices();
154                            }
155                        }, false);
156                    } else if (typeof this.attachEvent !== 'undefined') {
157                        this.attachEvent("onload", function () {
158                            if (typeof tarteaucitronProLoadServices === 'function') {
159                                tarteaucitronProLoadServices();
160                            }
161                        });
162                    } else {
163                        if (typeof tarteaucitronProLoadServices === 'function') {
164                            setTimeout(tarteaucitronProLoadServices, 1000);
165                        }
166                    }
167                    
168                    try {
169                        origOpen.apply(this, arguments);
170                    } catch (err) {}
171                };
172            }
173        }
174    },
175    "load": function () {
176        "use strict";
177        var cdn = tarteaucitron.cdn,
178            language = tarteaucitron.getLanguage(),
179            pathToLang = cdn + 'lang/tarteaucitron.' + language + '.js?v=' + tarteaucitron.version,
180            pathToServices = cdn + 'tarteaucitron.services.js?v=' + tarteaucitron.version,
181            linkElement = document.createElement('link'),
182            defaults = {
183                "adblocker": false,
184                "hashtag": '#tarteaucitron',
185                "highPrivacy": false,
186                "orientation": "top",
187                "removeCredit": false,
188                "showAlertSmall": true,
189                "cookieslist": true,
190                "customLanguage":false, // friss_1
191            },
192            params = tarteaucitron.parameters;
193        
194        // Step 0: get params
195        if (params !== undefined) {
196            tarteaucitron.extend(defaults, params);
197        }
198        
199        // global
200        tarteaucitron.orientation = defaults.orientation;
201        tarteaucitron.hashtag = defaults.hashtag;
202        tarteaucitron.highPrivacy = defaults.highPrivacy;
203
204        tarteaucitron.customLanguage = defaults.customLanguage; // friss_2
205
206        // Step 1: load css
207        linkElement.rel = 'stylesheet';
208        linkElement.type = 'text/css';
209        linkElement.href = cdn + 'css/tarteaucitron.css?v=' + tarteaucitron.version;
210        document.getElementsByTagName('head')[0].appendChild(linkElement);
211
212
213
214        // Step 2: load language and services
215        tarteaucitron.addScript(pathToLang, '', function () {
216
217            if(false!==tarteaucitron.customLanguage && typeof tarteaucitron.customLanguage === 'object') // friss_3
218            {
219                tarteaucitron.extend(tarteaucitron.lang, tarteaucitron.customLanguage);
220            }
221            
222            tarteaucitron.addScript(pathToServices, '', function () {
223
224                var body = document.body,
225                    div = document.createElement('div'),
226                    html = '',
227                    index,
228                    orientation = 'Top',
229                    cat = ['ads', 'analytic', 'api', 'comment', 'social', 'support', 'video', 'other'],
230                    i;
231                
232                cat = cat.sort(function (a, b) {
233                    if (tarteaucitron.lang[a].title > tarteaucitron.lang[b].title) { return 1; }
234                    if (tarteaucitron.lang[a].title < tarteaucitron.lang[b].title) { return -1; }
235                    return 0;
236                });
237
238                // Step 3: prepare the html
239                html += '<div id="tarteaucitronPremium"></div>';
240                html += '<div id="tarteaucitronBack" onclick="tarteaucitron.userInterface.closePanel();"></div>';
241                html += '<div id="tarteaucitron">';
242                html += '   <div id="tarteaucitronClosePanel" onclick="tarteaucitron.userInterface.closePanel();">';
243                html += '       ' + tarteaucitron.lang.close;
244                html += '   </div>';
245                html += '   <div id="tarteaucitronServices">';
246                html += '      <div class="tarteaucitronLine tarteaucitronMainLine" id="tarteaucitronMainLineOffset">';
247                html += '         <div class="tarteaucitronName">';
248                html += '            <b><a href="#" onclick="tarteaucitron.userInterface.toggle(\'tarteaucitronInfo\', \'tarteaucitronInfoBox\');return false">&#10011;</a> ' + tarteaucitron.lang.all + '</b>';
249                html += '         </div>';
250                html += '         <div class="tarteaucitronAsk" id="tarteaucitronScrollbarAdjust">';
251                html += '            <div id="tarteaucitronAllAllowed" class="tarteaucitronAllow" onclick="tarteaucitron.userInterface.respondAll(true);">';
252                html += '               &#10003; ' + tarteaucitron.lang.allow;
253                html += '            </div> ';
254                html += '            <div id="tarteaucitronAllDenied" class="tarteaucitronDeny" onclick="tarteaucitron.userInterface.respondAll(false);">';
255                html += '               &#10007; ' + tarteaucitron.lang.deny;
256                html += '            </div>';
257                html += '         </div>';
258                html += '      </div>';
259                html += '      <div id="tarteaucitronInfo" class="tarteaucitronInfoBox">';
260                html += '         ' + tarteaucitron.lang.disclaimer;
261                if (defaults.removeCredit === false) {
262                    html += '        <br/><br/>';
263                    html += '        <a href="https://opt-out.ferank.eu/" rel="nofollow" target="_blank" rel="noopener">' + tarteaucitron.lang.credit + '</a>';
264                }
265                html += '      </div>';
266                html += '      <div class="tarteaucitronBorder" id="tarteaucitronScrollbarParent">';
267                html += '         <div class="clear"></div>';
268                for (i = 0; i < cat.length; i += 1) {
269                    html += '         <div id="tarteaucitronServicesTitle_' + cat[i] + '" class="tarteaucitronHidden">';
270                    html += '            <div class="tarteaucitronTitle">';
271                    html += '               <a href="#" onclick="tarteaucitron.userInterface.toggle(\'tarteaucitronDetails' + cat[i] + '\', \'tarteaucitronInfoBox\');return false">&#10011;</a> ' + tarteaucitron.lang[cat[i]].title;
272                    html += '            </div>';
273                    html += '            <div id="tarteaucitronDetails' + cat[i] + '" class="tarteaucitronDetails tarteaucitronInfoBox">';
274                    html += '               ' + tarteaucitron.lang[cat[i]].details;
275                    html += '            </div>';
276                    html += '         </div>';
277                    html += '         <div id="tarteaucitronServices_' + cat[i] + '"></div>';
278                }
279                html += '         <div class="tarteaucitronHidden" id="tarteaucitronScrollbarChild" style="height:20px;
279display:block"></div>';
280                html += '       </div>';
281                html += '   </div>';
282                html += '</div>';
283                
284                if (defaults.orientation === 'bottom') {
285                    orientation = 'Bottom';
286                }
287                
288                if (defaults.highPrivacy) {
289                    html += '<div id="tarteaucitronAlertBig" class="tarteaucitronAlertBig' + orientation + '">';
290                    html += '   <span id="tarteaucitronDisclaimerAlert">';
291                    html += '       ' + tarteaucitron.lang.alertBigPrivacy;
292                    html += '   </span>';
293                    html += '   <span id="tarteaucitronPersonalize" onclick="tarteaucitron.userInterface.respondAll(true);">';
294                    html += '       &#10003; ' + tarteaucitron.lang.acceptAll;
295                    html += '   </span>';
296                    html += '   <span id="tarteaucitronPersonalize" onclick="tarteaucitron.userInterface.openPanel();">';
297                    html += '       ' + tarteaucitron.lang.personalize;
298                    html += '   </span>';
299                    html += '</div>';
300                } else {
301                    html += '<div id="tarteaucitronAlertBig" class="tarteaucitronAlertBig' + orientation + '">';
302                    html += '   <span id="tarteaucitronDisclaimerAlert">';
303                    html += '       ' + tarteaucitron.lang.alertBigClick + ' ' + tarteaucitron.lang.alertBig;
304                    html += '   </span>';
305                    html += '   <span id="tarteaucitronPersonalize" onclick="tarteaucitron.userInterface.respondAll(true);">';
306                    html += '       &#10003; ' + tarteaucitron.lang.acceptAll;
307                    html += '   </span>';
308                    html += '   <span id="tarteaucitronCloseAlert" onclick="tarteaucitron.userInterface.openPanel
308();">';
309                    html += '       ' + tarteaucitron.lang.personalize;
310                    html += '   </span>';
311                    html += '</div>';
312                    html += '<div id="tarteaucitronPercentage"></div>';
313                }
314                
315                if (defaults.showAlertSmall === true) {
316                    html += '<div id="tarteaucitronAlertSmall">';
317                    html += '   <div id="tarteaucitronManager" onclick="tarteaucitron.userInterface.openPanel();">';
318                    html += '       ' + tarteaucitron.lang.alertSmall;
319                    html += '       <div id="tarteaucitronDot">';
320                    html += '           <span id="tarteaucitronDotGreen"></span>';
321                    html += '           <span id="tarteaucitronDotYellow"></span>';
322                    html += '           <span id="tarteaucitronDotRed"></span>';
323                    html += '       </div>';
324                    if (defaults.cookieslist === true) {
325                        html += '   </div><!-- @whitespace';
326                        html += '   --><div id="tarteaucitronCookiesNumber" onclick="tarteaucitron.userInterface.toggleCookiesList();">0</div>';
327                        html += '   <div id="tarteaucitronCookiesListContainer">';
328                        html += '       <div id="tarteaucitronClosePanelCookie" onclick="tarteaucitron.userInterface.closePanel();">';
329                        html += '           ' + tarteaucitron.lang.close;
330                        html += '       </div>';
331                        html += '       <div class="tarteaucitronCookiesListMain" id="tarteaucitronCookiesTitle">';
332                        html += '            <b id="tarteaucitronCookiesNumberBis">0 cookie</b>';
333                        html += '       </div>';
334                        html += '       <div id="tarteaucitronCookiesList"></div>';
335                        html += '    </div>';
336                    } else {
337                        html += '   </div>';
338                    }
339                    html += '</div>';
340                }
341                
342                tarteaucitron.addScript(tarteaucitron.cdn + 'advertising.js?v=' + tarteaucitron.version, '', function () {
343                    if (tarteaucitronNoAdBlocker === true || defaults.adblocker === false) {
344                        div.id = 'tarteaucitronRoot';
345                        body.appendChild(div, body);
346                        div.innerHTML = html;
347                
348                        if (tarteaucitron.job !== undefined) {
349                            tarteaucitron.job = tarteaucitron.cleanArray(tarteaucitron.job);
350                            for (index = 0; index < tarteaucitron.job.length; index += 1) {
351                                tarteaucitron.addService(tarteaucitron.job[index]);
352                            }
353                        }
354                
355                        tarteaucitron.isAjax = true;
356                        tarteaucitron.job.push = function (id) {
357                    
358                            // ie <9 hack
359                            if (typeof tarteaucitron.job.indexOf === 'undefined') {
360                                tarteaucitron.job.indexOf = function (obj, start) {
361                                    var i,
362                                        j = this.length;
363                                    for (i = (start || 0); i < j; i += 1) {
364                                        if (this[i] === obj) { return i; }
365                                    }
366                                    return -1;
367                                };
368                            }
369                    
370                            if (tarteaucitron.job.indexOf(id) === -1) {
371                                Array.prototype.push.call(this, id);
372                            }
373                            tarteaucitron.launch[id] = false;
374                            tarteaucitron.addService(id);
375                        };
376                
377                        if (document.location.hash === tarteaucitron.hashtag && tarteaucitron.hashtag !== '') {
378                            tarteaucitron.userInterface.openPanel
378();
379                        }
380                
381                        tarteaucitron.cookie.number();
382                        setInterval(tarteaucitron.cookie.number, 60000);
383                    }
384                }, defaults.adblocker);
385                
386                if (defaults.adblocker === true) {
387                    setTimeout(function () {
388                        if (tarteaucitronNoAdBlocker === false) {
389                            html = '<div id="tarteaucitronAlertBig" class="tarteaucitronAlertBig' + orientation + '" style="display:block">';
390                            html += '   <span id="tarteaucitronDisclaimerAlert">';
391                            html += '       ' + tarteaucitron.lang.adblock + '<br/>';
392                            html += '       <b>' + tarteaucitron.lang.adblock_call + '</b>';
393                            html += '   </span>';
394                            html += '   <span id="tarteaucitronPersonalize" onclick="location.reload();">';
395                            html += '       ' + tarteaucitron.lang.reload;
396                            html += '   </span>';
397                            html += '</div>';
398                            html += '<div id="tarteaucitronPremium"></div>';
399                            div.id = 'tarteaucitronRoot';
400                            body.appendChild(div, body);
401                            div.innerHTML = html;
402                            tarteaucitron.pro('!adblocker=true');
403                        } else {
404                            tarteaucitron.pro('!adblocker=false');
405                        }
406                    }, 1500);
407                }
408            });
409        });
410    },
411    "addService": function (serviceId) {
412        "use strict";
413        var html = '',
414            s = tarteaucitron.services,
415            service = s[serviceId],
416            cookie = tarteaucitron.cookie.read(),
417            hostname = document.location.hostname,
418            hostRef = document.referrer.split('/')[2],
419            isNavigating = (hostRef === hostname) ? true : false,
420            isAutostart = (!service.needConsent) ? true : false,
421            isWaiting = (cookie.indexOf(service.key + '=wait') >= 0) ? true : false,
422            isDenied = (cookie.indexOf(service.key + '=false') >= 0) ? true : false,
423            isAllowed = (cookie.indexOf(service.key + '=true') >= 0) ? true : false,
424            isResponded = (cookie.indexOf(service.key + '=false') >= 0 || cookie.indexOf(service.key + '=true') >= 0) ? true : false;
425
426        if (tarteaucitron.added[service.key] !== true) {
427            tarteaucitron.added[service.key] = true;
428            
429            html += '<div id="' + service.key + 'Line" class="tarteaucitronLine">';
430            html += '   <div class="tarteaucitronName">';
431            html += '       <b>' + service.name + '</b><br/>';
432            html += '       <span id="tacCL' + service.key + '" class="tarteaucitronListCookies"></span><br/>';
433            html += '       <a href="https://opt-out.ferank.eu/service/' + service.key + '/" target="_blank" rel="noopener">';
434            html += '           ' + tarteaucitron.lang.more;
435            html += '       </a>';
436            html += '        - ';
437            html += '       <a href="' + service.uri + '" target="_blank" rel="noopener">';
438            html += '           ' + tarteaucitron.lang.source;
439            html += '       </a>';
440            html += '   </div>';
441            html += '   <div class="tarteaucitronAsk">';
442            html += '       <div id="' + service.key + 'Allowed" class="tarteaucitronAllow" onclick="tarteaucitron.userInterface.respond(this, true);">';
443            html += '           &#10003; ' + tarteaucitron.lang.allow;
444            html += '       </div> ';
445            html += '       <div id="' + service.key + 'Denied" class="tarteaucitronDeny" onclick="tarteaucitron.userInterface.respond(this, false);">';
446            html += '           &#10007; ' + tarteaucitron.lang.deny;
447            html += '       </div>';
448            html += '   </div>';
449            html += '</div>';
450           
451            tarteaucitron.userInterface.css('tarteaucitronServicesTitle_' + service.type, 'display', 'block');
452            
453            if (document.getElementById('tarteaucitronServices_' + service.type) !== null) {
454                document.getElementById('tarteaucitronServices_' + service.type).innerHTML += html;
455            }
456            
457            tarteaucitron.userInterface.order(service.type);
458        }
459
460        // allow by default for non EU
461        if (isResponded === false && tarteaucitron.user.bypass === true) {
462            isAllowed = true;
463            tarteaucitron.cookie.create(service.key, true);
464        }
465       
466        if ((!isResponded && (isAutostart || (isNavigating && isWaiting)) && !tarteaucitron.highPrivacy) || isAllowed) {
467            if (!isAllowed) {
468                tarteaucitron.cookie.create(service.key, true);
469            }
470            if (tarteaucitron.launch[service.key] !== true) {
471                tarteaucitron.launch[service.key] = true;
472                service.js();
473            }
474            tarteaucitron.state[service.key] = true;
475            tarteaucitron.userInterface.color(service.key, true);
476        } else if (isDenied) {
477            if (typeof service.fallback === 'function') {
478                service.fallback();
479            }
480            tarteaucitron.state[service.key] = false;
481            tarteaucitron.userInterface.color(service.key, false);
482        } else if (!isResponded) {
483            tarteaucitron.cookie.create(service.key, 'wait');
484            if (typeof service.fallback === 'function') {
485                service.fallback();
486            }
487            tarteaucitron.userInterface.color(service.key, 'wait');
488            tarteaucitron.userInterface.openAlert();
489        }
490
491        tarteaucitron.cookie.checkCount(service.key);
492    },
493    "cleanArray": function cleanArray(arr) {
494        "use strict";
495        var i,
496            len = arr.length,
497            out = [],
498            obj = {},
499            s = tarteaucitron.services;
500 
501        for (i = 0; i < len; i += 1) {
502            if (!obj[arr[i]]) {
503                obj[arr[i]] = {};
504                if (tarteaucitron.services[arr[i]] !== undefined) {
505                    out.push(arr[i]);
506                }
507            }
508        }
509                
510        out = out.sort(function (a, b) {
511            if (s[a].type + s[a].key > s[b].type + s[b].key) { return 1; }
512            if (s[a].type + s[a].key < s[b].type + s[b].key) { return -1; }
513            return 0;
514        });
515                    
516        return out;
517    },
518    "userInterface": {
519        "css": function (id, property, value) {
520            "use strict";
521            if (document.getElementById(id) !== null) {
522                document.getElementById(id).style[property] = value;
523            }
524        },
525        "respondAll": function (status) {
526            "use strict";
527            var s = tarteaucitron.services,
528                service,
529                key,
530                index = 0;
531            
532            for (index = 0; index < tarteaucitron.job.length; index += 1) {
533                service = s[tarteaucitron.job[index]];
534                key = service.key;
535                if (tarteaucitron.state[key] !== status) {
536                    if (status === false && tarteaucitron.launch[key] === true) {
537                        tarteaucitron.reloadThePage = true;
538                    }
539                    if (tarteaucitron.launch[key] !== true && status === true) {
540                        tarteaucitron.launch[key] = true;
541                        tarteaucitron.services[key].js();
542                    }
543                    tarteaucitron.state[key] = status;
544                    tarteaucitron.cookie.create(key, status);
545                    tarteaucitron.userInterface.color(key, status);
546                }
547            }
548        },
549        "respond": function (el, status) {
550            "use strict";
551            var key = el.id.replace(new RegExp("(Eng[0-9]+|Allow|Deni)ed", "g"), '');
552        
553            // return if same state
554            if (tarteaucitron.state[key] === status) {
555                return;
556            }
557            
558            if (status === false && tarteaucitron.launch[key] === true) {
559                tarteaucitron.reloadThePage = true;
560            }
561        
562            // if not already launched... launch the service
563            if (status === true) {
564                if (tarteaucitron.launch[key] !== true) {
565                    tarteaucitron.launch[key] = true;
566                    tarteaucitron.services[key].js();
567                }
568            }
569            tarteaucitron.state[key] = status;
570            tarteaucitron.cookie.create(key, status);
571            tarteaucitron.userInterface.color(key, status);
572        },
573        "color": function (key, status) {
574            "use strict";
575            var gray = '#808080',
576                greenDark = '#1B870B',
577                greenLight = '#E6FFE2',
578                redDark = '#9C1A1A',
579                redLight = '#FFE2E2',
580                yellowDark = '#FBDA26',
581                c = 'tarteaucitron',
582                nbDenied = 0,
583                nbPending = 0,
584                nbAllowed = 0,
585                sum = tarteaucitron.job.length,
586                index;
587
588            if (status === true) {
589                tarteaucitron.userInterface.css(key + 'Line', 'borderLeft', '5px solid ' + greenDark);
590                tarteaucitron.userInterface.css(key + 'Allowed', 'backgroundColor', greenDark);
591                tarteaucitron.userInterface.css(key + 'Denied', 'backgroundColor', gray);
592            } else if (status === false) {
593                tarteaucitron.userInterface.css(key + 'Line', 'borderLeft', '5px solid ' + redDark);
594                tarteaucitron.userInterface.css(key + 'Allowed', 'backgroundColor', gray);
595                tarteaucitron.userInterface.css(key + 'Denied', 'backgroundColor', redDark);
596            }
597
598            // check if all services are allowed
599            for (index = 0; index < sum; index += 1) {
600                if (tarteaucitron.state[tarteaucitron.job[index]] === false) {
601                    nbDenied += 1;
602                } else if (tarteaucitron.state[tarteaucitron.job[index]] === undefined) {
603                    nbPending += 1;
604                } else if (tarteaucitron.state[tarteaucitron.job[index]] === true) {
605                    nbAllowed += 1;
606                }
607            }
608        
609            tarteaucitron.userInterface.css(c + 'DotGreen', 'width', ((100 / sum) * nbAllowed) + '%');
610            tarteaucitron.userInterface.css(c + 'DotYellow', 'width', ((100 / sum) * nbPending) + '%');
611            tarteaucitron.userInterface.css(c + 'DotRed', 'width', ((100 / sum) * nbDenied) + '%');
612            
613            if (nbDenied === 0 && nbPending === 0) {
614                tarteaucitron.userInterface.css(c + 'AllAllowed', 'backgroundColor', greenDark);
615                tarteaucitron.userInterface.css(c + 'AllDenied', 'backgroundColor', gray);
616            } else if (nbAllowed === 0 && nbPending === 0) {
617                tarteaucitron.userInterface.css(c + 'AllAllowed', 'backgroundColor', gray);
618                tarteaucitron.userInterface.css(c + 'AllDenied', 'backgroundColor', redDark);
619            } else {
620                tarteaucitron.userInterface.css(c + 'AllAllowed', 'backgroundColor', gray);
621                tarteaucitron.userInterface.css(c + 'AllDenied', 'backgroundColor', gray);
622            }
623            
624            // close the alert if all service have been reviewed
625            if (nbPending === 0) {
626                tarteaucitron.userInterface.closeAlert();
627            }
628            
629            if (tarteaucitron.services[key].cookies.length > 0 && status === false) {
630                tarteaucitron.cookie.purge(tarteaucitron.services[key].cookies);
631            }
632            
633            if (status === true) {
634                if (document.getElementById('tacCL' + key) !== null) {
635                    document.getElementById('tacCL' + key).innerHTML = '...';
636                }
637                setTimeout(function () {
638                    tarteaucitron.cookie.checkCount(key);
639                }, 2500);
640            } else {
641                tarteaucitron.cookie.checkCount(key);
642            }
643        },
644        "openPanel": function () {
645            "use strict";
646            tarteaucitron.userInterface.css('tarteaucitron', 'display', 'block');
647            tarteaucitron.userInterface.css('tarteaucitronBack', 'display', 'block');
648            tarteaucitron.userInterface.css('tarteaucitronCookiesListContainer', 'display', 'none');
649            tarteaucitron.userInterface.jsSizing('main');
650        },
651        "closePanel": function () {
652            "use strict";
653            
654            if (document.location.hash === tarteaucitron.hashtag) {
655                document.location.hash = '';
656            }
657            tarteaucitron.userInterface.css('tarteaucitron', 'display', 'none');
658            tarteaucitron.userInterface.css('tarteaucitronCookiesListContainer', 'display', 'none');
659            
660            tarteaucitron.fallback(['tarteaucitronInfoBox'], function (elem) {
661                elem.style.display = 'none';
662            }, true);
663            
664            if (tarteaucitron.reloadThePage === true) {
665                window.location.reload();
666            } else {
667                tarteaucitron.userInterface.css('tarteaucitronBack', 'display', 'none');
668            }
669        },
670        "openAlert": function () {
671            "use strict";
672            var c = 'tarteaucitron';
673            tarteaucitron.userInterface.css(c + 'Percentage', 'display', 'block');
674            tarteaucitron.userInterface.css(c + 'AlertSmall', 'display', 'none');
675            tarteaucitron.userInterface.css(c + 'AlertBig',   'display', 'block');
676        },
677        "closeAlert": function () {
678            "use strict";
679            var c = 'tarteaucitron';
680            tarteaucitron.userInterface.css(c + 'Percentage', 'display', 'none');
681            tarteaucitron.userInterface.css(c + 'AlertSmall', 'display', 'block');
682            tarteaucitron.userInterface.css(c + 'AlertBig',   'display', 'none');
683            tarteaucitron.userInterface.jsSizing('box');
684        },
685        "toggleCookiesList": function () {
686            "use strict";
687            var div = document.getElementById('tarteaucitronCookiesListContainer');
688            
689            if (div === null) {
690                return;
691            }
692            
693            if (div.style.display !== 'block') {
694                tarteaucitron.cookie.number();
695                div.style.display = 'block';
696                tarteaucitron.userInterface.jsSizing('cookie');
697                tarteaucitron.userInterface.css('tarteaucitron', 'display', 'none');
698                tarteaucitron.userInterface.css('tarteaucitronBack', 'display', 'block');
699                tarteaucitron.fallback(['tarteaucitronInfoBox'], function (elem) {
700                    elem.style.display = 'none';
701                }, true);
702            } else {
703                div.style.display = 'none';
704                tarteaucitron.userInterface.css('tarteaucitron', 'display', 'none');
705                tarteaucitron.userInterface.css('tarteaucitronBack', 'display', 'none');
706            }
707        },
708        "toggle": function (id, closeClass) {
709            "use strict";
710            var div = document.getElementById(id);
711            
712            if (div === null) {
713                return;
714            }
715            
716            if (closeClass !== undefined) {
717                tarteaucitron.fallback([closeClass], function (elem) {
718                    if (elem.id !== id) {
719                        elem.style.display = 'none';
720                    }
721                }, true);
722            }
723            
724            if (div.style.display !== 'block') {
725                div.style.display = 'block';
726            } else {
727                div.style.display = 'none';
728            }
729        },
730        "order": function (id) {
731            "use strict";
732            var main = document.getElementById('tarteaucitronServices_' + id),
733                allDivs,
734                store = [],
735                i;
736
737            if (main === null) {
738                return;
739            }
740            
741            allDivs = main.childNodes;
742            
743            if (typeof Array.prototype.map === 'function') {
744                Array.prototype.map.call(main.children, Object).sort(function (a, b) {
745                    if (tarteaucitron.services[a.id.replace(/Line/g, '')].name > tarteaucitron.services[b.id.replace(/Line/g, '')].name) { return 1; }
746                    if (tarteaucitron.services[a.id.replace(/Line/g, '')].name < tarteaucitron.services[b.id.replace(/Line/g, '')].name) { return -1; }
747                    return 0;
748                }
748).forEach(function (element) {
749                    main.appendChild(element);
750                });
751            }
752        },
753        "jsSizing": function (type) {
754            "use strict";
755            var scrollbarMarginRight = 10,
756                scrollbarWidthParent,
757                scrollbarWidthChild,
758                servicesHeight,
759                e = window,
760                a = 'inner',
761                windowInnerHeight = window.innerHeight || document.documentElement.clientHeight || document.body.clientHeight,
762                mainTop,
763                mainHeight,
764                closeButtonHeight,
765                headerHeight,
766                cookiesListHeight,
767                cookiesCloseHeight,
768                cookiesTitleHeight,
769                paddingBox,
770                alertSmallHeight,
771                cookiesNumberHeight;
772            
773            if (type === 'box') {
774                if (document.getElementById('tarteaucitronAlertSmall') !== null && document.getElementById('tarteaucitronCookiesNumber') !== null) {
775                    
776                    // reset
777                    tarteaucitron.userInterface.css('tarteaucitronCookiesNumber', 'padding', '0px 10px');
778                    
779                    // calculate
780                    alertSmallHeight = document.getElementById('tarteaucitronAlertSmall').offsetHeight;
781                    cookiesNumberHeight = document.getElementById('tarteaucitronCookiesNumber').offsetHeight;
782                    paddingBox = (alertSmallHeight - cookiesNumberHeight) / 2;
783                    
784                    // apply
785                    tarteaucitron.userInterface.css('tarteaucitronCookiesNumber', 'padding', paddingBox + 'px 10px');
786                }
787            } else if (type === 'main') {
788
789                // get the real window width for media query
790                if (window.innerWidth === undefined) {
791                    a = 'client';
792                    e = document.documentElement || document.body;
793                }
794
795                // height of the services list container
796                if (document.getElementById('tarteaucitron') !== null && document.getElementById('tarteaucitronClosePanel') !== null && document.getElementById('tarteaucitronMainLineOffset') !== null) {
797                    
798                    // reset
799                    tarteaucitron.userInterface.css('tarteaucitronScrollbarParent', 'height', 'auto');
800                    
801                    // calculate
802                    mainHeight = document.getElementById('tarteaucitron').offsetHeight;
803                    closeButtonHeight = document.getElementById('tarteaucitronClosePanel').offsetHeight;
804                    headerHeight = document.getElementById('tarteaucitronMainLineOffset').offsetHeight;
805                    
806                    // apply
807                    servicesHeight = (mainHeight - closeButtonHeight - headerHeight + 1);
808                    tarteaucitron.userInterface.css('tarteaucitronScrollbarParent', 'height', servicesHeight + 'px');
809                }
810                
811                // align the main allow/deny button depending on scrollbar width
812                if (document.getElementById('tarteaucitronScrollbarParent') !== null && document.getElementById('tarteaucitronScrollbarChild') !== null) {
813                    
814                    // media query
815                    if (e[a + 'Width'] <= 479) {
816                        tarteaucitron.userInterface.css('tarteaucitronScrollbarAdjust', 'marginLeft', '11px');
817                    } else if (e[a + 'Width'] <= 767) {
818                        scrollbarMarginRight = 12;
819                    }
820                    
821                    scrollbarWidthParent = document.getElementById('tarteaucitronScrollbarParent').offsetWidth;
822                    scrollbarWidthChild = document.getElementById('tarteaucitronScrollbarChild').offsetWidth;
823                    tarteaucitron.userInterface.css('tarteaucitronScrollbarAdjust', 'marginRight', ((scrollbarWidthParent - scrollbarWidthChild) + scrollbarMarginRight) + 'px');
824                }
825                
826                // center the main panel
827                if (document.getElementById('tarteaucitron') !== null) {
828                    
829                    // media query
830                    if (e[a + 'Width'] <= 767) {
831                        mainTop = 0;
832                    } else {
833                        mainTop = ((windowInnerHeight - document.getElementById('tarteaucitron').offsetHeight) / 2) - 21;
834                    }
835                    
836                    // correct
837                    if (mainTop < 0) {
838                        mainTop = 0;
839                    }
840                    
841                    if (document.getElementById('tarteaucitronMainLineOffset') !== null) {
842                        if (document.getElementById('tarteaucitron').offsetHeight < (windowInnerHeight / 2)) {
843                            mainTop -= document.getElementById('tarteaucitronMainLineOffset').offsetHeight;
844                        }
845                    }
846                    
847                    // apply
848                    tarteaucitron.userInterface.css('tarteaucitron', 'top', mainTop + 'px');
849                }
850
851
852            } else if (type === 'cookie') {
853                
854                // put cookies list at bottom
855                if (document.getElementById('tarteaucitronAlertSmall') !== null) {
856                    tarteaucitron.userInterface.css('tarteaucitronCookiesListContainer', 'bottom', (document.getElementById('tarteaucitronAlertSmall').offsetHeight) + 'px');
857                }
858                
859                // height of cookies list
860                if (document.getElementById('tarteaucitronCookiesListContainer') !== null) {
861                    
862                    // reset
863                    tarteaucitron.userInterface.css('tarteaucitronCookiesList', 'height', 'auto');
864                    
865                    // calculate
866                    cookiesListHeight = document.getElementById('tarteaucitronCookiesListContainer').offsetHeight;
867                    cookiesCloseHeight = document.getElementById('tarteaucitronClosePanelCookie').offsetHeight;
868                    cookiesTitleHeight = document.getElementById('tarteaucitronCookiesTitle').offsetHeight;
869                    
870                    // apply
871                    tarteaucitron.userInterface.css('tarteaucitronCookiesList', 'height', (cookie
871sListHeight - cookiesCloseHeight - cookiesTitleHeight - 2) + 'px');
872                }
873            }
874        }
875    },
876    "cookie": {
877        "owner": {},
878        "create": function (key, status) {
879            "use strict";
880            var d = new Date(),
881                time = d.getTime(),
882                expireTime = time + 31536000000, // 365 days
883                regex = new RegExp("!" + key + "=(wait|true|false)", "g"),
884                cookie = tarteaucitron.cookie.read().replace(regex, ""),
885                value = 'tarteaucitron=' + cookie + '!' + key + '=' + status,
886                domain = (tarteaucitron.parameters.cookieDomain !== undefined && tarteaucitron.parameters.cookieDomain !== '') ? 'domain=' + tarteaucitron.parameters.cookieDomain + ';' : '';
887
888          if (tarteaucitron.cookie.read().indexOf(key + '=' + status) === -1) {
889                tarteaucitron.pro('!' + key + '=' + status);
890            }
891
892            d.setTime(expireTime);
893            document.cookie = value + '; expires=' + d.toGMTString() + '; path=/;' + domain;
894        },
895        "read": function () {
896            "use strict";
897            var nameEQ = "tarteaucitron=",
898                ca = document.cookie.split(';'),
899                i,
900                c;
901
902            for (i = 0; i < ca.length; i += 1) {
903                c = ca[i];
904                while (c.charAt(0) === ' ') {
905                    c = c.substring(1, c.length);
906                }
907                if (c.indexOf(nameEQ) === 0) {
908                    return c.substring(nameEQ.length, c.length);
909                }
910            }
911            return '';
912        },
913        "purge": function (arr) {
914            "use strict";
915            var i;
916            
917            for (i = 0; i < arr.length; i += 1) {
918                document.cookie = arr[i] + '=; expires=Thu, 01 Jan 2000 00:00:00 GMT; path=/;';
919                document.cookie = arr[i] + '=; expires=Thu, 01 Jan 2000 00:00:00 GMT; path=/; domain=.' + location.hostname + ';';
920                document.cookie = arr[i] + '=; expires=Thu, 01 Jan 2000 00:00:00 GMT; path=/; domain=.' + location.hostname.split('.').slice(-2).join('.') + ';';
921            }
922        },
923        "checkCount": function (key) {
924            "use strict";
925            var arr = tarteaucitron.services[key].cookies,
926                nb = arr.length,
927                nbCurrent = 0,
928                html = '',
929                i,
930                status = document.cookie.indexOf(key + '=true');
931            
932            if (status >= 0 && nb === 0) {
933                html += tarteaucitron.lang.useNoCookie;
934            } else if (status >= 0) {
935                for (i = 0; i < nb; i += 1) {
936                    if (document.cookie.indexOf(arr[i] + '=') !== -1) {
937                        nbCurrent += 1;
938                        if (tarteaucitron.cookie.owner[arr[i]] === undefined) {
939                            tarteaucitron.cookie.owner[arr[i]] = [];
940                        }
941                        if (tarteaucitron.cookie.crossIndexOf(tarteaucitron.cookie.owner[arr[i]], tarteaucitron.services[key].name) === false) {
942                            tarteaucitron.cookie.owner[arr[i]].push(tarteaucitron.services[key].name);
943                        }
944                    }
945                }
946                
947                if (nbCurrent > 0) {
948                    html += tarteaucitron.lang.useCookieCurrent + ' ' + nbCurrent + ' cookie';
949                    if (nbCurrent > 1) {
950                        html += 's';
951                    }
952                    html += '.';
953                } else {
954                    html += tarteaucitron.lang.useNoCookie;
955                }
956            } else if (nb === 0) {
957                html = tarteaucitron.lang.noCookie;
958            } else {
959                html += tarteaucitron.lang.useCookie + ' ' + nb + ' cookie';
960                if (nb > 1) {
961                    html += 's';
962                }
963                html += '.';
964            }
965            
966            if (document.getElementById('tacCL' + key) !== null) {
967                document.getElementById('tacCL' + key).innerHTML = html;
968            }
969        },
970        "crossIndexOf": function (arr, match) {
971            "use strict";
972            var i;
973            for (i = 0; i < arr.length; i += 1) {
974                if (arr[i] === match) {
975                    return true;
976                }
977            }
978            return false;
979        },
980        "number": function () {
981            "use strict";
982            var cookies = document.cookie.split(';'),
983                nb = (document.cookie !== '') ? cookies.length : 0,
984                html = '',
985                i,
986                name,
987                namea,
988                nameb,
989                c,
990                d,
991                s = (nb > 1) ? 's' : '',
992                savedname,
993                regex = /^https?\:\/\/([^\/?#]+)(?:[\/?#]|$)/i,
994                regexedDomain = (tarteaucitron.cdn.match(regex) !== null) ? tarteaucitron.cdn.match(regex)[1] : tarteaucitron.cdn,
995                host = (tarteaucitron.domain !== undefined) ? tarteaucitron.domain : regexedDomain;
996            
997            cookies = cookies.sort(function (a, b) {
998                namea = a.split('=', 1).toString().replace(/ /g, '');
999                nameb = b.split('=', 1).toString().replace(/ /g, '');
1000                c = (tarteaucitron.cookie.owner[namea] !== undefined) ? tarteaucitron.cookie.owner[namea] : '0';
1001                d = (tarteaucitron.cookie.owner[nameb] !== undefined) ? tarteaucitron.cookie.owner[nameb] : '0';
1002                if (c + a > d + b) { return 1; }
1003                if (c + a < d + b) { return -1; }
1004                return 0;
1005            });
1006            
1007            if (document.cookie !== '') {
1008                for (i = 0; i < nb; i += 1) {
1009                    name = cookies[i].split('=', 1).toString().replace(/ /g, '');
1010                    if (tarteaucitron.cookie.owner[name] !== undefined && tarteaucitron.cookie.owner[name].join(' // ') !== savedname) {
1011                        savedname = tarteaucitron.cookie.owner[name].join(' // ');
1012                        html += '<div class="tarteaucitronHidden">';
1013                        html += '     <div class="tarteaucitronTitle">';
1014                        html += '        ' + tarteaucitron.cookie.owner[name].join(' // ');
1015                        html += '    </div>';
1016                        html += '</div>';
1017                    } else if (tarteaucitron.cookie.owner[name] === undefined && host !== savedname) {
1018                        savedname = host;
1019                        html += '<div class="tarteaucitronHidden">';
1020                        html += '     <div class="tarteaucitronTitle">';
1021                        html += '        ' + host;
1022                        html += '    </div>';
1023                        html += '</div>';
1024                    }
1025                    html += '<div class="tarteaucitronCookiesListMain">';
1026                    html += '    <div class="tarteaucitronCookiesListLeft"><a href="#" onclick="tarteaucitron.cookie.purge([\'' + cookies[i].split('=', 1) + '\']);tarteaucitron.cookie.number();tarteaucitron.userInterface.jsSizing(\'cookie\');return false"><b>&times;</b></a> <b>' + name + '</b>';
1027                    html += '    </div>';
1028                    html += '    <div class="tarteaucitronCookiesListRight">' + cookies[i].split('=').slice(1).join('=') + '</div>';
1029                    html += '</div>';
1030                }
1031            } else {
1032                html += '<div class="tarteaucitronCookiesListMain">';
1033                html += '    <div class="tarteaucitronCookiesListLeft"><b>-</b></div>';
1034                html += '    <div class="tarteaucitronCookiesListRight"></div>';
1035                html += '</div>';
1036            }
1037            
1038            html += '<div class="tarteaucitronHidden" style="height:20px;display:block"></div>';
1039            
1040            if (document.getElementById('tarteaucitronCookiesList') !== null) {
1041                document.getElementById('tarteaucitronCookiesList').innerHTML = html;
1042            }
1043            
1044            if (document.getElementById('tarteaucitronCookiesNumber') !== null) {
1045                document.getElementById('tarteaucitronCookiesNumber').innerHTML = nb;
1046            }
1047            
1048            if (document.getElementById('tarteaucitronCookiesNumberBis') !== null) {
1049                document.getElementById('tarteaucitronCookiesNumberBis').innerHTML = nb + ' cookie' + s;
1050            }
1051            
1052            for (i = 0; i < tarteaucitron.job.length; i += 1) {
1053                tarteaucitron.cookie.checkCount(tarteaucitron.job[i]);
1054            }
1055        }
1056    },
1057    "getLanguage": function () {
1058        "use strict";
1059        if (!navigator) { return 'en'; }
1060        
1061        var availableLanguages = 'cs,en,fr,es,it,de,pt,pl,ru',
1062            defaultLanguage = 'en',
1063            lang = navigator.language || navigator.browserLanguage ||
1064                navigator.systemLanguage || navigator.userLang || null,
1065            userLanguage = lang.substr(0, 2);
1066    if (tarteaucitronForceLanguage == '' &&  mill_rgpd_vars_from_php.lang_custom.tarteaucitronForceLanguage!==''){
1067        tarteaucitronForceLanguage = mill_rgpd_vars_from_php.lang_custom.tarteaucitronForceLanguage;
1068    }
1069   
1070console.warn('tarteaucitronForceLanguage',tarteaucitronForceLanguage);
1071        if (tarteaucitronForceLanguage !== '') {
1072            if (availableLanguages.indexOf(tarteaucitronForceLanguage) !== -1) {
1073                return tarteaucitronForceLanguage;
1074            }
1075        }
1076        
1077        if (availableLanguages.indexOf(userLanguage) === -1) {
1078            return defaultLanguage;
1079        }
1080        return userLanguage;
1081    },
1082    "getLocale": function () {
1083        "use strict";
1084        if (!navigator) { return 'en_US'; }
1085        
1086        var lang = navigator.language || navigator.browserLanguage ||
1087                navigator.systemLanguage || navigator.userLang || null,
1088            userLanguage = lang.substr(0, 2);
1089        
1090        if (userLanguage === 'fr') {
1091            return 'fr_FR';
1092        } else if (userLanguage === 'en') {
1093            return 'en_US';
1094        } else if (userLanguage === 'de') {
1095            return 'de_DE';
1096        } else if (userLanguage === 'es') {
1097            return 'es_ES';
1098        } else if (userLanguage === 'it') {
1099            return 'it_IT';
1100        } else if (userLanguage === 'pt') {
1101            return 'pt_PT';
1102        } else {
1103            return 'en_US';
1104        }
1105    },
1106    "addScript": function (url, id, callback, execute, attrName, attrVal) {
1107        //console.log(url);
1108        "use strict";
1109        var script,
1110            done = false;
1111        
1112        if (execute === false) {
1113            if (typeof callback === 'function') {
1114                callback();
1115            }
1116        } else {
1117            script = document.createElement('script');
1118            script.type = 'text/javascript';
1119            script.id = (id !== undefined) ? id : '';
1120            script.async = true;
1121            script.src = url;
1122            
1123            if (attrName !== undefined && attrVal !== undefined) {
1124                script.setAttribute(attrName, attrVal);
1125            }
1126
1127            if (typeof callback === 'function') {
1128                script.onreadystatechange = script.onload = function () {
1129                    var state = script.readyState;
1130                    if (!done && (!state || /loaded|complete/.test(state))) {
1131                        done = true;
1132                        callback();
1133                    }
1134                };
1135            }
1136    
1137            document.getElementsByTagName('head')[0].appendChild(script);
1138        }
1139    },
1140    "makeAsync": {
1141        "antiGhost": 0,
1142        "buffer": '',
1143        "init": function (url, id) {
1144            "use strict";
1145            var savedWrite = document.write,
1146                savedWriteln = document.writeln;
1147
1148            document.write = function (content) {
1149                tarteaucitron.makeAsync.buffer += content;
1150            };
1151            document.writeln = function (content) {
1152                tarteaucitron.makeAsync.buffer += content.concat("\n");
1153            };
1154        
1155            setTimeout(function () {
1156                document.write = savedWrite;
1157                document.writeln = savedWriteln;
1158            }, 20000);
1159            
1160            tarteaucitron.makeAsync.getAndParse(url, id);
1161        },
1162        "getAndParse": function (url, id) {
1163            "use strict";
1164            if (tarteaucitron.makeAsync.antiGhost > 9) {
1165                tarteaucitron.makeAsync.antiGhost = 0;
1166                return;
1167            }
1168            tarteaucitron.makeAsync.antiGhost += 1;
1169            tarteaucitron.addScript(url, '', function () {
1170                if (document.getElementById(id) !== null) {
1171                    document.getElementById(id).innerHTML += "<span style='display:none'>&nbsp;</span>" + tarteaucitron.makeAsync.buffer;
1172                    tarteaucitron.makeAsync.buffer = '';
1173                    tarteaucitron.makeAsync.execJS(id);
1174                }
1175            });
1176        },
1177        "execJS": function (id) {
1178            /* not strict because third party scripts may have errors */
1179            var i,
1180                scripts,
1181                childId,
1182                type;
1183
1184            if (document.getElementById(id) === null) {
1185                return;
1186            }
1187            
1188            scripts = document.getElementById(id).getElementsByTagName('script');
1189            for (i = 0; i < scripts.length; i += 1) {
1190                type = (scripts[i].getAttribute('type') !== null) ? scripts[i].getAttribute('type') : '';
1191                if (type === '') {
1192                    type = (scripts[i].getAttribute('language') !== null) ? scripts[i].getAttribute('language') : '';
1193                }
1194                if (scripts[i].getAttribute('src') !== null && scripts[i].getAttribute('src') !== '') {
1195                    childId = id + Math.floor(Math.random() * 99999999999);
1196                    document.getElementById(id).innerHTML += '<div id="' + childId + '"></div>';
1197                    tarteaucitron.makeAsync.getAndParse(scripts[i].getAttribute('src'), childId);
1198                } else if (type.indexOf('javascript') !== -1 || type === '') {
1199                    eval(scripts[i].innerHTML);
1200                }
1201            }
1202        }
1203    },
1204    "fallback": function (matchClass, content, noInner) {
1205        "use strict";
1206        var elems = document.getElementsByTagName('*'),
1207            i,
1208            index = 0;
1209
1210        for (i in elems) {
1211            if (elems[i] !== undefined) {
1212                for (index = 0; index < matchClass.length; index += 1) {
1213                    if ((' ' + elems[i].className + ' ')
1214                            .indexOf(' ' + matchClass[index] + ' ') > -1) {
1215                        if (typeof content === 'function') {
1216                            if (noInner === true) {
1217                                content(elems[i]);
1218                            } else {
1219                                elems[i].innerHTML = content(elems[i]);
1220                            }
1221                        } else {
1222                            elems[i].innerHTML = content;
1223                        }
1224                    }
1225                }
1226            }
1227        }
1228    },
1229    "engage": function (id) {
1230        "use strict";
1231        var html = '',
1232            r = Math.floor(Math.random() * 100000);
1233                
1234        html += '<div class="tac_activate">';
1235        html += '   <div class="tac_float">';
1236        html += '      <b>' + tarteaucitron.services[id].name + '</b> ' + tarteaucitron.lang.fallback;
1237        html += '      <div class="tarteaucitronAllow" id="Eng' + r + 'ed' + id + '" onclick="tarteaucitron.userInterface.respond(this, true);">';
1238        html += '          &#10003; ' + tarteaucitron.lang.allow;
1239        html += '       </div>';
1240        html += '   </div>';
1241        html += '</div>';
1242        
1243        return html;
1244    },
1245    "extend": function (a, b) {
1246        "use strict";
1247        var prop;
1248        for (prop in b) {
1249            if (b.hasOwnProperty(prop)) {
1250                a[prop] = b[prop];
1251            }
1252        }
1253    },
1254    "proTemp": '',
1255    "proTimer": function () {
1256        "use strict";
1257        setTimeout(tarteaucitron.proPing, 1000);
1258    },
1259    "pro": function (list) {
1260        "use strict";
1261        tarteaucitron.proTemp += list;
1262        clearTimeout(tarteaucitron.proTimer);
1263        tarteaucitron.proTimer = setTimeout(tarteaucitron.proPing, 2500);
1264    },
1265    "proPing": function () {
1266        "use strict";
1267        if (tarteaucitron.uuid !== '' && tarteaucitron.uuid !== undefined && tarteaucitron.proTemp !== '') {
1268            var div = document.getElementById('tarteaucitronPremium'),
1269                timestamp = new Date().getTime(),
1270                url = '//opt-out.ferank.eu/premium.php?';
1271            
1272            if (div === null) {
1273                return;
1274            }
1275            
1276            url += 'domain=' + tarteaucitron.domain + '&';
1277            url += 'uuid=' + tarteaucitron.uuid + '&';
1278            url += 'c=' + encodeURIComponent(tarteaucitron.proTemp) + '&';
1279            url += '_' + timestamp;
1280            
1281            div.innerHTML = '<img src="' + url + '" style="display:none" />';
1282            
1283            tarteaucitron.proTemp = '';
1284        }
1285        
1286        tarteaucitron.cookie.number();
1287    }
1288};

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.