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