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