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