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