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