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