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