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