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