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