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