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